PHP-APC is exceeding limit apc.shm_size often

alternative-php-cachecachephp5

I am implementing the apc on a shared server that currently has 1000 sites (using wordpress, moodle, etc.). I'm Looking for the admin page, and I see "Cache full count" is growing rapidly. I've tried increasing the value of "apc.shm_size" reduce value "apc.ttl" increase the value "apc.shm_segments" but I can not resolve this issue. What am I doing wrong? I'm putting down some information:

apc.ini:

extension=apc.so

apc.shm_size = 256

apc.enabled = 1

apc.ttl = 300

apc.user_ttl = 300

Ubuntu: 12.04

PHP: 5.3.10

APC: 3.1.7

Server has 16GB memory

Limit share memory: 256MB

Is there any possibility of not clearing the cache when it reaches 100%?

Best Answer

Try setting your apc.gc_ttl to something low, like 600, and your apc.max_file_size, which is the largest size APC will cache, to something like 2M.

apc.gc_ttl = 600
apc.max_file_size = 2M

Also, as Michael pointed out, 256M for 1000 sites is really quite low.

First, try increasing the apc.shm_size limit.

apc.shm_size = 2048M

If you're hitting the kernel shared memory limit, which can be related, but isn't always, try increasing the apc.shm_segments.

apc.shm_segments = 10
apc.shm_size = 256M
apc.max_file_size = 2
Related Topic