UPDATE: I implemented a new cache plugin for Joomla! 3 and Zend Server 6, you can check it out here.
Zend Server CE is the Community Edition of the PHP application server by Zend Technologies. It's a free environment that can be used to run PHP applications using additional features compared to the PHP.net version. Some of these features are:
- Zend Optimizer+, a PHP byte code accelerator;
- Zend Data Cache, a data caching system for PHP.
Using the Zend Optimizer+ we can speed up the execution of a PHP application without any change on the code. Basically the Optimizer+ is a caching system for the bytecode generated from the PHP interpreter. The Zend Data Cache is a caching system for PHP and can be used to cache variables, objects, etc. This means that you have to modify your code to use this cache. However, the change of the PHP code is very simple and limited. For more info about the Zend Data Cache we suggest to read the White Paper "A pratical guide to data caching with Zend Server" by Shahar Evron, Product Manager of Zend Technologies.
Basically using Zend Server CE we can speed up the execution of a PHP application but the question is how much faster? The answer depends on the PHP application and compared with what?
In this post I run a benchmark of Joomla!, the famous CMS written in PHP, using Zend Server CE vs. APC and Memcached. To run this benchmark I worked together with Renato Salvatori of Cost, an IT company specialized in Joomla!.
In details, we run the benchmark into two phases:
- using the Zend Optimizer+ of Zend Server CE vs. APC;
- using the caching mechanism of Joomla! on the following backends: File, Memcached, APC and Zend Server CE (using File and Shared Memory).
In order to use the Joomla! caching with Zend Server we used a plugin written by me and Renato Salvatori, you can download it below in the post.
Benchmark methodology
We used the default installation of Joomla! 1.5.17 using the example data for the content of the site. We tested the home page of Joomla! using Apache Benchmark (ab) with 100 requestes and 10 concurrency users (-n 100 -c 10). We run each experiment 6 times and we took the average of the results. We measured the time per request (mean across all the concurrent requests in ms) and the transfer rate (Kbyte/sec).
All the experiments reported in this post have been executed using a CPU Intel Core 2 at 2.10 Ghz with 2 GB of RAM running Gnu/Linux OS with kernel 2.6.28 . We used the following software configuration: Zend Server 5 CE, Apache 2.2.11, PHP 5.3.2, Joomla! 1.5.17, Memcached 1.4.5, APC 3.1.3p1, MySQL 5.0.45.
APC vs Zend Optimizer+
In the first step of the experiment we run the benchmark with the caching of Joomla! disabled. We tested the response time of the home page with and without the bytecode accelerator of Zend Optimizer+ and APC. We reported the results in Table 1.
time per request, mean across all concurrent requests (ms) | transfer rate (Kbyte/sec) | |
No Cache, No Optimizer+, No APC | 114,017 | 286,87 |
No Cache, APC | 80,135 | 408,27 |
No Cache, Optimizer+ | 71,019 | 460,70 |
Table 1: Response times of Joomla! using PHP accelerators
The results show that Zend Optimizer+ is the faster one. Using Zend Server 5 CE Joomla! runs 60% faster of the PHP.net (with no accelerator) and 13% faster of APC. We reported the transfer rate of the results in Figure 1 (high value means better performance).
Figure 1: Transfer rate (Kbyte/sec)
Data cache experiment
In the second step of the experiment we run the benchmark using the caching plugins of Joomla! on the following caching systems: File, APC, Memcached, Zend Server CE (file), Zend Server CE (shared memory). We split the experiment into two steps: the first using the APC byte code accelerator, and the second using the Zend Optimizer+ code accelerator. Below we reported the results of this experiment (Table 2 and 3).
time per request, mean across all concurrent requests (ms) | transfer rate (Kbyte/sec) | |
Cache: File | 53,383 | 612,91 |
Cache: APC | 49,275 | 664,23 |
Cache: Memcached | 50,507 | 647,73 |
Cache: ZendServer file | 51,541 | 634,51 |
Cache: ZendServer shm | 46,527 | 703,50 |
Table 2: Results with APC enabled, and Zend Optimizer+ disabled
As you can see the best result, in term of performance, comes with the usage of Zend Server CE (with shared memory caching system, shm). Zend Server CE is 14% faster than File, 9% faster than Memcached, and 6% faster than APC.
time per request, mean across all concurrent requests (ms) | transfer rate (Kbyte/sec) | |
Cache: File | 40,716 | 803,54 |
Cache: APC | 38,898 | 841,13 |
Cache: Memcached | 39,058 | 837,90 |
Cache: ZendServer file | 39,102 | 836,95 |
Cache: ZendServer shm | 36,531 | 895,79 |
Table 3: Results with APC disabled, Zend Optimizer+ enabled
The same results comes with Zend Optimizer+ enabled and APC disabled. The faster caching system is Zend Server CE with shared memory. Zend Server CE is 11% faster than File, 7% faster than Memcached, and 6% faster than APC. If we compare the data cache results using APC or Zend Optimizer+ we discover that the best results comes with Zend Optimizer+, the data caching system of Joomla! runs faster of 35% compared with APC (Figure 2, high value means better performance).
Figure 2: Transfer rate (Kbyte/sec)
Summarizing, using the Zend Optimizer+ and the Data Cache of Zend Server CE you can speed up the execution of Joomla! from 60% to 300% compared with PHP.net (with no accelerator) and from 13% to 35% compared with APC.
The Joomla! caching plugin for Zend Server CE
In order to use the data caching of Zend Server CE with Joomla! you have to install the plugin joomla_zendserver.zip. You can download it here. The installation of this new plugin is easy, you have only to unpack the zendserver.tar.gz file and copy the files zendserver_disk.php and zendserver_shm.php in the folder libraries/joomla/cache/storage/ of Joomla!. After that you can choose the cache handler Zendserver_disk and Zendserver_shm from the System tab of the Global Configuration menu of the Administration interface of Joomla!.
Conclusion
In this post we showed that Zend Server CE is the faster PHP stack to run Joomla! applications. The benefits, in term of performance, are great: up to 35% faster of APC and up to 300% of PHP.net (with no accelerators). If you are interested in other benchmarks of Zend Server CE you can read the White Paper "Optimizing Drupal Performance" by Acquia and Zend Technologies. In the future, I would like to run more benchmarks on Zend Server CE using other PHP open source softwares. If you have any proposals please add a comment, thanks.