amuck-landowner

Anyone using Zend OpCache? Hitting limits problem

libro22

Member
I tried running opcache for about a month now with 1.5gb allocated cache limit. I had no problems until today.

It seems that I've been hitting the cache limit as I'm seeing this error in the logs "Fatal Error Unable to allocate shared memory segment". I restarted the server to clean up the cache. I'm planning to increase the cache limit later on.

My question is, should PHP's memory_limit be always bigger than the cache's limit? I have mine set to 128M.
 

Wintereise

New Member
Erm, memory limit is the limit for a single instance of a script's possible allocation.

The zend one is collective, so no.
 

libro22

Member
Erm, memory limit is the limit for a single instance of a script's possible allocation.

The zend one is collective, so no.
Saw a thread in zend forum, saying that memory_limit should be bigger than cache limit. Did not believe it too.

Have you checked the status of the opcache using one of the available status scripts? https://rtcamp.com/tutorials/php/zend-opcache/

1.5GB is massive.  I haven't seen anyone need that much before.
Lots of shared websites, although it reaches 60-80% at a given time with 92-98% hit rate. Been using opcache gui.
 
Last edited by a moderator:

splitice

Just a little bit crazy...
Verified Provider
a 1.5gb SHM? Thats alot of PHP ops.

 

Increasing the size of the Linux shared memory segment

The size of the shared memory segment is controlled by the kernel
parameters shmmax and shmall. In some early versions of the kernel
this needed to be changed and the kernel rebuilt. Since the 2.2
version of the kernel it can be changed while the system is running
with a command like

echo "67108864" >/proc/sys/kernel/shmmax
echo "67108864" >/proc/sys/kernel/shmall
Increasing the size of the Linux shared memory segment

The size of the shared memory segment is controlled by the kernel
parameters shmmax and shmall. In some early versions of the kernel
this needed to be changed and the kernel rebuilt. Since the 2.2
version of the kernel it can be changed while the system is running
with a command like

echo "67108864" >/proc/sys/kernel/shmmax
echo "67108864" >/proc/sys/kernel/shmall

would set it to 64MB. Also note that this needs to be done after each
boot so you want to put this in /etc/rc.d/rc.local so it is done at boot.

On recent version of Linux you can also control this at boot by using
sysctl. Place an entry in /etc/sysctl.conf like,

kernel.shmmax=134217728
kernel.shmall=134217728

which will be processed at your next reboot and set it to 128MB,
128*1024*1024. Larger values are supported.


Check the manuals that came with your Linux distribution or the
How-To documents to see about rebuilding your kernel if you prefer.

 
 
Top
amuck-landowner