From my previous post i wrote about how to install APC and XCache for caching system for PHP 5. Now i would like to review which one is have best performance between APC, eAccelerator and XCache.
Since i don’t have enough machine to do the test, i’m using the bechmark test result from 2bits.com which have done it great and details.
Benchmark testing environment:
AMD Athlon 64 X2 Dual Core Processor 4400+ @ 2.2GHz, 1MB cache and 2GB RAM. 160GB SATA 7200RPM hard disk.
GNU/Linux Ubuntu server Gutsy 7.10, Apache 2.2.4, MySQL 5.0.45 and PHP 5.2.3
Benchmarking methodology is using apache benchmark (ab), with a concurrency of 5, and 3,000 requests:
ab -c5 -n3000 http://localhost/
Pure PHP: Page execution time was 209.58 ms. Executed 101 queries in 9.6 milliseconds.
eAccelerator: Page execution time was 57.88 ms. Executed 101 queries in 9.01 milliseconds.
XCache: Page execution time was 59.37 ms. Executed 101 queries in 9.27 milliseconds.
APC: Page execution time was 59.8 ms. Executed 101 queries in 9.1 milliseconds.
Source from 2bits.com
From the test results, using PHP cache system will greatly increase your whole system performance, as you can with Pure PHP ned 209.58ms and using PHP cache system only need around 60ms. So it will boost your server response up to 4 times faster. And between XCache, APC and eAccelerator there are no significant different only 1ms-2ms different between them. So which one you choose is up to you, but if you use Zend Optimizer don’t use APC as they are not working together, see my previous post here.