Zend Opcache auto flush (reset?)

I may simply be terrible at research, but I can’t seem to find an answer to this. I have opcache set to use 128M of memory (that’s all I can allow it to use at the moment until I get some more RAM for my VPS). WHAT IN THE WORLD HAPPENS WHEN OPCACHE HITS THAT LIMIT? I can’t find the answer to that anywhere. I’m guessing something not good. Is there a way to specify how often it should flush the cache and start from fresh? Is there a way to have it auto flush when it gets close to or hits the limit? So far the only way I know of clearing it is to manually restart php5-fpm. But that’s not very practical and even if I set a cron job to have php5-fpm restart once a day or something to clear the cache, it still feels to me like that’s not really a “solution”. At least not one that’s not half-baked.

If it helps I am on the latest version of PHP, using Nginx, and running a WordPress site. Getting ~80,000 hits per month.

Related posts

Leave a Reply

1 comment

  1. Have a close look at the corresponding manual (e.g. opcache.force-restart-timeout). You can schedule a restart if you want, or simply increase the frequency in which the timestamps are compared. The default behavior of Opcache is to throw out the oldest files and free memory.

    If you have performance issues, disable all of these features. Set the TTL to zero, never check the timestamps and only reload your PHP files if you apply an update to the actual PHP files. The cache will be filled once with all your stuff and that’s it. Of course the 128 MB should therefore be enough to cache all possible script execution paths. I think a default WordPress installation should easily fit into such a cache, but it might not if you have some extensions (I really don’t know).