Zend Opcache does not cache all files (CentOS 6.7 + Nginx 1.8.1 + PHP 7 + Laravel 5.1)

So, we have a project based on Laravel 5.1 that we want to publish in the near future, but we notice poor performance, and we are trying to optimize the server configuration.

As indicated in the header, we are deploying this on a CentOS 6.7 server, with Nginx 1.8.1 and PHP 7 with PHP-FPM. Since CentOS 6.7 repositories do not offer PHP 7, we use IUS replacement packages.

One of the things that we noticed that can lead to poor performance is the fact that Zend Opcache, despite the fact that it is turned on and works (we have a good rating), does not seem to cache all the files in our project . We use opcache-gui to visualize the contents of the cache, and although many project files are (including files from third-party libraries), most of them are missing, including our main controller and many supporting classes. In fact, when we turned off Opcache, the response time remains almost the same. The opcache blacklist is currently empty, so there is no reason why they are not included.

We tried to force the caching of missing files using opcache_compile_file (), and although the files are collected and cached, they never receive any hits.

I realized that Opcache will cache all executables, but this is not like what is happening here. I looked through the opcache options, but could not find one that would explicitly affect this behavior except the blacklist.

Is there anything else I'm missing? Any other criteria PHP relied on when deciding what to do with the cache or not?

Any help on this will be appreciated!

+6
source share
1 answer

Can you check the value of opcache.max_file_size ? Perhaps your problem, since the compiled files are larger than the original file.

Can you check files that you don't see in opcache-gui with http://php.net/opcache-is-script-cached ?

Also, as a test, can you try compiling compilation? Use http://php.net/opcache-compile-file . It is easy to see if it is true , and if it can compile it first.

0
source

All Articles