0% using OPcache and PHP-FPM / Nginx

I am trying to get PHP 5.5 OPcache to work on an Nginx / PHP-FPM installation running on Ubuntu 14.04 in Vagrant.

I have a directory /etc/php5/mods-available/opcache.ini

configured like this:

zend_extension=opcache.so

opcache.enable=1
opcache.memory_consumption=256
opcache.max_accelerated_files=50000

      

Startup php -v

and phpinfo()

shows OPcache is enabled and opcache-status is loaded and opcache-gui shows the same.

In the OPcache GUI I can see that files are being cached and I have also confirmed this by setting OPcache to enter verbose mode. The problem is ... they never hit!

I ran ApacheBench to hammer the application and no hit was recorded - 0 hits and 103 misses. I even tested a file hello_world.php

that just executes echo 'Hello, world!';

and it also logs as "miss".

Anyone can figure out what might be wrong?

Update: I was able to get a reproducible hit log case. If right after starting service php5-fpm restart

I run ApacheBench with 100 concurrent connections, the cache hits> 75%. From now on, every "normal" update is also recorded as a hit.

However, if I restart php-fpm and my initial requests are "normal" (eg only from my web browser) and then I run ApacheBench with 100 concurrent connections - they all miss ...

He, like the initial requests, must clog the server in order for the hits from now on to be ... really strange! I am guessing it might have something to do with php-fpm spawning processes, but I am actually new to the field, so if this gives anyone a hint - please help!

+3
php nginx opcache ubuntu-10.04


source to share


No one has answered this question yet

Check out similar questions:

4270
Link. What does this symbol mean in PHP?
2776
How can I prevent SQL injection in PHP?
2414
Why shouldn't I use the mysql_ * functions in PHP?
2335
Removing an element from an array in PHP
954
Node.js + Nginx - Now What?
216
How to use PHP OPCache?
23
Difference between APC, APCu and Opcache?
4
Enabling Opcache does not work
0
opcache is enabled, but why can't I see any difference
0
PHP-FPM using Opcache trying to open other cached pool files



All Articles
Loading...
X
Show
Funny
Dev
Pics