zendtech / ZendOptimizerPlus

Other
914 stars 142 forks source link

opcache.revalidate_freq #139

Closed nodesocket closed 10 years ago

nodesocket commented 10 years ago

Can you explain this directive a bit further? Does this mean, if I set:

opcache.revalidate_freq=60

Potentially php code can be stale for 60 seconds before its flushed from the opcodecache?

rlerdorf commented 10 years ago

That's correct

nodesocket commented 10 years ago

What is the file is accessed (read), does it still have to wait the 60 seconds to potentially flush?

rlerdorf commented 10 years ago

The revalidate_freq determines how frequently a stat() is called on a file to see if it has been modified. If it is newer than the compiled version in the cache it will be recompiled at that point.

I don't understand your question about a file being read. On a normal request the file isn't read or accessed in any way. It is entirely served from the cache. Do you mean if something out of band reads it? If so, that has no bearing on the cache. The cache will still only check every revalidate_freq seconds and on that check it looks at the modification time. It doesn't care about read access/atime.

nodesocket commented 10 years ago

Thanks makes sense. So recommending a value of 60 seconds seems excessively high. Won't people will go nuts when they are developing and not seeing their changes?

rlerdorf commented 10 years ago

You shouldn't have the opcache on at all during dev, or if you do set it to 0. Plus the default and the suggested value is 2 as per http://www.php.net/manual/en/opcache.configuration.php

nodesocket commented 10 years ago

Agree. Just updated my production severs which get code pushed via git to opcache.revalidate_freq=15. Development servers have it at opcache.revalidate_freq=1. Thanks for the insights and clarification Rasmus.

//cheers