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

AWS EC2 Small instance, Apache 2 running WordPress and W3TC. Within an hour, my APC fragmentation hits 100%.

My APC settings are:

apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 100M
apc.optimization = 0
apc.num_files_hint = 512
apc.user_entries_hint = 1024
apc.ttl = 7200
apc.user_ttl = 7200
apc.gc_ttl = 3600
apc.cache_by_default = 1
apc.use_request_time = 1
apc.filters = "apc\.php$"
apc.mmap_file_mask = "/tmp/apc.XXXXXX"
apc.slam_defense = 0
apc.file_update_protection = 2
apc.enable_cli = 0
apc.max_file_size = 2M
apc.stat = 1
apc.write_lock = 1
apc.report_autofilter = 0
apc.include_once_override = 0
apc.rfc1867 = 0
apc.rfc1867_prefix = "upload_"
apc.rfc1867_name = "APC_UPLOAD_PROGRESS"
apc.rfc1867_freq = 0
apc.localcache = 0
apc.localcache.size = 256M
apc.coredump_unmap = 0
apc.stat_ctime = 0
apc.canonicalize = 1
apc.lazy_functions = 0
apc.lazy_classes = 0

More poop can be seen here.

Mostly cribed settings from here. The shm was meant to be whittled down from such a high value after some observation, but apparently such a large value isn't even high enough....

I found an similar question/answer here. I do have some virtual hosts setup, but they aren't being touched much at all. Having users logged into the admin panel of WP does make things worse, but that's certainly not the main culprit. The question asker seems to suggest that it turns out W3TC is probably causing the problem, which the plugin author seems to agree with, but there aren't any helpful details beyond that. Why is it causing the problem?

Do I just take it for now and turn off object caching with APC? Is there nothing I can do? Does having it turned on without being used for object caching actually help anything? Would memcache be an ok substitute just for object caching here? Finally, maybe I just shouldn't worry so much about the fragmentation?

share|improve this question
up vote 4 down vote accepted

Cached variables: 3562 ( 14.3 MBytes)

This is what's causing your fragmentation. GC is cleaning them up and chances are they're getting placed in a new 'slice' when they're regenerated.

You could try to up the GC TTL on user variables - but if the code for your APC usage is manually handling the TTL's that may be a part of the problem.

3500+ vars is quite a bit for what I'm seeing (only 500 files cached, 100MB SHM); APC may not be leveraged correctly.


Hits 19195 Misses 13830

Insert Rate 1312.99 cache requests/second <-- This leads me to think something isn't configured correctly. Technically, this is telling me that your caching is largely ineffective as 33% of your cached variables are generated every second.

share|improve this answer
when you say that APC isn't leveraged correctly, that'd be the caching program (W3TC) issue, right? Any idea if it makes sense to use memcache for object caching here? – two7s_clash Apr 1 '12 at 18:17
I'm not familiar with W3TC specifically, but I elaborated a bit more on what I see that makes me think it's not being leveraged. – thinice Apr 1 '12 at 23:56

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.