Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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.

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?

share|improve this question
Do you happen to have apc.optimization set to anything but 0? – nojak Aug 16 '12 at 18:32
it's set to "0". – Loki Aug 16 '12 at 18:48
Try lowering your apc.ttl to 5400 or 3600 and see if that helps. Your fragmentation isn't really bad, but a lower ttl should help. – nojak Aug 16 '12 at 18:58
Al right. I'll give it a try. What's your opinion on turning off database caching in W3TC? – Loki Aug 16 '12 at 19:11
Personally, I'd turn it off. – nojak Aug 16 '12 at 20:16

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.

share|improve this answer
Thank you, Michael, for your answer. After almost to 3 hours the fragmentation was closing in on 40% fragmentation. I turned of the Database caching in W3TC and I noticed the fragmentation went down. Do I need database caching? According to pingdom, my site did get a little slower (from 900 ms to approx. 1 second). Of course, pingdom is not an exact measurement tool, that's why I ask: what is the average experience? Does Database Caching with APC usually slow down or speed up your server? – Loki Aug 16 '12 at 18:41
After 8 hours the cache was 60% fragmented. I cleared the cache because my site was incredibly slow. Any suggestions? – Loki Aug 17 '12 at 6:09
Increase the TTL? Give APC more memory? Use memcached? – Michael Hampton Aug 17 '12 at 6:12
What do you mean with "Use Memcached", like instead of APC? – Loki Aug 17 '12 at 9:59
up vote 1 down vote accepted

What appeared to cause all the fragmentation was a Facebook Like Box that I had placed in the sidebar of my posts. This little widget alone 'cost' about 50 requests per pageload and consisted of 20-30 tiny javascripts (with a total 500KiB per pageload, according to Pingdom), which changed on each request - different faces, different script. I guess APC tries to cache them all only to throw them away again.

Anyway, I removed the widget, cleared my cache and now it has been running for 12 hours straight with only 8% fragmentation - with default settings and shm_size at 512MB.

Thanks anyway for all the help guys.

share|improve this answer
It's weird in my opinion your solution. APC caches php files, anything else. Having a facebook widget with js doesn't affect. Maybe I´m wrong and please correct me if there's something else that I´m not considering. – Beto Aveiga Mar 5 '13 at 4:48
@BetoAveiga APC provides opcode cache and user data store. WordPress with object cache plugin will send some types of cache data to APC (or other data store backend as configured). It's entirely possible for plugin to have been (ab)using certain cache APIs to cause this. – Rarst May 23 '13 at 17:45
Thanks Rarst... in that case is a bad implementation of the plugin. I had not considered that. – Beto Aveiga May 25 '13 at 3:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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