APC fragmention woes on Apache AWS EC2 Small instance with WordPress and W3TC [closed]

Generally speaking your apc.shm_size should be double your highest seen used amount. You want to try and prevent your cache full count from being higher than 0. You might want to also lower some of your ttls. I’m working with someone on AWS EC2 with 5 vhosts and we had to raise apc.shm_size to 512M to prevent 100% fragmentation. I also have better results setting apc.mmap_file_mask to /dev/zero with WordPress from some reason.

enter image description here

; configuration for php apc module
extension = apc.so
apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 512M
apc.optimization = 0
apc.num_files_hint = 512
apc.user_entries_hint = 1024
apc.ttl = 0
apc.user_ttl = 0
apc.gc_ttl = 600
apc.cache_by_default = 1
apc.filters = "apc\.php$"
apc.slam_defense = 0
apc.use_request_time = 1
apc.mmap_file_mask = /dev/zero
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 = 1
apc.localcache.size = 512
apc.coredump_unmap = 0
apc.stat_ctime = 0

Another problem is your pages are running around 170 database queries per load. Some code optimization will lesson the load on apc.

You can try memcached but I’ve done side by side comparisons and apc is always faster. Another option is to disable db caching in w3TC and tune MySql query cache. And make sure you are using query cache (It’s off by default when you install MySql).

Edit:

Your using a really outdated version of apc. Upgrading to 3.1.9 or 3.1.10 will also help.