APC PHP cache size does not exceed 32MB, even though settings allow for more
Posted
by
hardy101
on Server Fault
See other posts from Server Fault
or by hardy101
Published on 2011-10-12T04:27:51Z
Indexed on
2013/06/29
10:23 UTC
Read the original article
Hit count: 249
I am setting up APC (v 3.1.9) on a high-traffic WordPress installation on CentOS 6.0 64 bit.
I have figured out many of the quirks with APC, but something is still not quite right. No matter what settings I change, APC never actually caches more than 32MB. I'm trying to bump it up to 256 MB. 32MB is a default amount for apc.shm_size, so I am wondering if it's stuck there somehow.
I have run the following
echo '2147483648' > /proc/sys/kernel/shmmax
to increase my system's shared memory to 2G (half of my 4G box). Then ran
ipcs -lm
which returns
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 2097152
max total shared memory (kbytes) = 8388608
min seg size (bytes) = 1
Also made a change in
/etc/sysctl.conf
then ran
sysctl -p
to make the settings stick on the server. Rebooted, too, for good measure.
In my APC settings, I have mmap enabled (which happens by default in recent versions of APC). php.ini looks like:
apc.stat=0
apc.shm_size="256M"
apc.max_file_size="10M"
apc.mmap_file_mask="/tmp/apc.XXXXXX"
apc.ttl="7200"
I am aware that mmap mode will ignore references to apc.shm_segments, so I have left it out with default 1.
phpinfo() indicates the following about APC:
Version 3.1.9
APC Debugging Disabled
MMAP Support Enabled
MMAP File Mask /tmp/apc.bPS7rB
Locking type pthread mutex Locks
Serialization Support php
Revision $Revision: 308812 $
Build Date Oct 11 2011 22:55:02
Directive Local Value
apc.cache_by_default On
apc.canonicalize O
apc.coredump_unmap Off
apc.enable_cli Off
apc.enabled On On
apc.file_md5 Off
apc.file_update_protection 2
apc.filters no value
apc.gc_ttl 3600
apc.include_once_override Off
apc.lazy_classes Off
apc.lazy_functions Off
apc.max_file_size 10M
apc.mmap_file_mask /tmp/apc.bPS7rB
apc.num_files_hint 1000
apc.preload_path no value
apc.report_autofilter Off
apc.rfc1867 Off
apc.rfc1867_freq 0
apc.rfc1867_name APC_UPLOAD_PROGRESS
apc.rfc1867_prefix upload_
apc.rfc1867_ttl 3600
apc.serializer default
apc.shm_segments 1
apc.shm_size 256M
apc.slam_defense On
apc.stat Off
apc.stat_ctime Off
apc.ttl 7200
apc.use_request_time On
apc.user_entries_hint 4096
apc.user_ttl 0
apc.write_lock On
apc.php reveals the following graph, no matter how long the server runs (cache size fluctuates and hovers at just under 32MB.
See image http://i.stack.imgur.com/2bwMa.png
You can see that the cache is trying to allocate 256MB, but the brown piece of the pie keeps getting recycled at 32MB. This is confirmed as refreshing the apc.php page shows cached file counts that move up and down (implying that the cache is not holding onto all of its files).
Does anyone have an idea of how to get APC to use more than 32 MB for its cache size??
**Note that the identical behavior occurs for eaccelerator, xcache, and APC. I read here:
http://www.litespeedtech.com/support/forum/archive/index.php/t-5072.html
that suEXEC could cause this problem.
© Server Fault or respective owner