What is the minimal amount of shm Space APC needs to operate properly? I'm currently running a Wordpress blog on a VPS based on virtuozzo and I can't set kernel shm to anything above 32 mb. Is there any way of telling APC to use "normal" memory instead of shared one (I've got plenty of ram...)

My current apc.ini looks like this, yet apc tells met that it's using just 30 MB (1 Segment(s) with 30.0 MBytes (mmap memory, pthread mutex locking)):

extension = apc.so
apc.enabled = 1
apc.shm_segments = 15
apc.num_files_hint = 2700
apc.user_entries_hint = 2700
apc.ttl = 7200
apc.user_ttl = 3600
apc.gc_ttl = 600
apc.cache_by_default = 1
apc.max_file_size = 2M
apc.stat = 1

Use the files apc.php from the APC package to check how APC use memory. Increase it until APC have 20% free spare memory.

A single Wordpress with some plugins can require more than 40M.


There may be a limit set on how large a shared memory segment you can request.

However, you can add a number of such segments for APC to use in the configuration: apc.shm_segments=2


  • That sadly doesn't seem to work, see my config from above, APC still reports 1 segment with 30 MB.... – schneida Feb 13 '12 at 10:41
  • Did you actually put 15 in there, because that would try to allocate 450 megabytes. Try with 2. Also, why do you want so much? I'm running a Wordpress install, and there is less than 20mb in APC for the PHP files to be cached. – Alister Bulman Feb 16 '12 at 21:14
  • Well I tried it with different values, also with those fifteen, out of anger as it was not working. I wanted more because I didn't get the expected performance boost with just 30mb, but as it turned out, more didn't help either. – schneida Feb 17 '12 at 21:39

Found the solution myself:

By default apc now uses mmap for shared memory. In theory, mmap should not be bound to the maximum shm size by the kernel, but it seems it is, at least in shared server environments like virtuozzo. Also mmap ignores apc.shm_segments because it won't create multiple anonymous files to map into memory without a mask, so unless you also set apc.mmap_file_mask this seems to be useless.

Another way is to recompile apc using --disable-apc-mmap and use IPC shared memory instead!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.