Tune APC to Improve PHP Performance
Adjust the parameters
Having installed APC for PHP does not automatically improve the performance. You have to adjust the parameters. At the very least, change these values:
apc.ttl=”7200″
apc.user_ttl=”7200″
apc.shm_segments=”3″
apc.shm_size=”90″
Setting apc.ttl and apc.user_ttl to none-zero can ensure that the cached php code gets refreshed at the given number of seconds without filling up the memory with stale entries.
The number assigned to apc.shm_size is the size of each shared memory segment in MB. To find the Linux kernel’s maximum shared memory size, do
# cat /proc/sys/kernel/shmmax
If you already set the apc.shm_size to the maximum allowed size, then raising the value ofapc.shm_segments would be the next thing to do.
Of course you can always raise the maximum size of a shared memory segment, using sysctl. Do this only when you know what you are doing. Run “man sysctl” for more information.
MMAP v.s. System V IPC
I did an experiment on APC version 3.0.14, on a system using mmap for shared memory. It seems that APC simply ignores the value in apc.shm_segments and go with the setting in apc.shm_size, and it accepts values larger than the maximum allowed size for each segment. In other words, it takes apc.shm_segments as 1, and accepts whatever value in apc.shm_size. This does conflict with the APC documentation. I saw others have filed similar bug for APC. I suggest you test this yourself and see if things have changed since.
apc.php
To see how your APC is doing, locate the apc.php that comes with the extension, copy it to the document root, and access it from a browser. Please remember to remove this file from public access for security.
Reference: http://www.php.net/apc
NOTE:
If you want the graphics to display using the apc.php, you MUST have GD2 libraries and php5-gd installed !!!