How to check your APC / Memcache performance statistics ...
By sriram on Apr 08, 2009
PHP runtime within OpenSolaris includes performance booster extensions like APC (PHP extension to cache the compiled PHP script) and Memcache (PHP extension to integrate with Memcached server) to deliver the best performance, out of the box, for production environment. Now, with upcoming release of OpenSolaris 2009.06 (more specifically with Indiana build 111 or above), we have also have made it easy to check out the performance statistics of these extensions which should further help you in getting the maximum juice from your system.Installing OpenSolaris 2009.06 (preview build)
If you haven't tried OpenSolaris distribution yet, you can pick up the latest OpenSolaris 2009.06 (preview build) ISO image from here. and steps to install AMP (Apache, PHP and MySQL) stack within OpenSolaris is covered in my earlier blog .
Assuming, you have got a working AMP stack on your system and an application like Joomla, Drupal, or MediaWiki working fine , then here is what you need to do to display the performance statistics of these extensions to your browser :
For displaying PHP APC statistics to the browser:
sriramn@sriramn:~> pfexec cp /etc/apache2/2.2/samples-conf.d/php-apc-stats.conf /etc/apache2/2.2/conf.d/
sriramn@sriramn:~> pfexec cp /etc/apache2/2.2/samples-conf.d/php-memcache-stats.conf /etc/apache2/2.2/conf.d/
sriramn@sriramn:~> svcadm restart http:apache22
Now, you should be able to access these statistics of APC and Memcache extensions by going to the http://localhost/stats/apc/ or http://localhost/stats/memcache/ respectively.
Tuning PHP APC
Once configured, APC statistics page , for example, would show this below page.
This page should provide you with information as to how many PHP pages are cached and if the cache is getting missed etc. If you see frequent APC cache misses etc then you will need to appropriately increase APC shared memory size. You could do this and other APC configuration tuning by visiting PHP APC configuration page .