Getting APC Fragmentation to a Minimum

Loki asked:

After weeks of messing around in my setup I finally managed to get APC to work with Mod_Ruid2 enabled in WHM and setting DSO as PHP-handler. I own a XEN VPS with 2 GB RAM and 4 CPU-cores on which I run 4 WordPress sites – of which 2 are big, regularly updated (+/- 15000 posts total) sites with lots of traffic (8000 uniques a day total for both sites).

APC is running fine overall, but I was just wondering if I could get the fragmentation down a bit.

I have been observing APC now for a while and I see the fragmentation carefully going up. As you can see by the screenshot after little over an hour the fragmentation is above 10% and will keep rising, sometimes making a step down. In short, it never drops below 10%. What might be useful to note is that server load never goes above 1.5, no matter how high fragmentation is.

http://ScrnSht.com/pmculx

On various blogs it is said that it’s best to keep fragmentation at a minimum and below 10%. So I was wondering if any of you could take a look at my settings and see if you have any suggestions.

http://ScrnSht.com/hbypfy

Looking forward to your reactions!

—- Edit: 18-08-2012 10:26

APC has been running for 15 hours now after I set it back to its default settings (only raised shm_size to 512MB) and fragmentation is swinging around 15%. Yesterday I noticed it going up to 26%, but it managed to get it back to 15%, so I think that’s decent right?

My answer:


Your APC cache looks fine; it’s certainly not excessively fragmented, and if you aren’t having performance problems then there’s no real need to worry about it.

Let it run 24 hours, and then take a look at it to see if you still have good performance and enough free space in the cache.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.