Benefits of Server Side Caching
Thursday, September 18th, 2008We have been running load test after load test in the Sugar Labs to determine the performance of Sugar 5.1 and where to focus on improving performance in the future. You will see performance benefits in 5.1 with the new logger utility, SugarLogger, that greatly reduces the CPU load and the revamped internal handling of custom fields that both reduces the amount of code as well as database queries. We already have a list of improvements we’ll be making to 5.2 and 6.0 as well.
We just finished analyzing one of our load tests that we felt the community would find interesting. This test was geared towards showing the benefits of operation code (op-code) caching as well as external data caching with SugarCRM. We ran a load test geared towards the sales automation functionality with a PHP accelerator, and then we ran it again the with the accelerator disabled.
The database was run on a separate server to ensure that it had no impact on the Web server CPU utilization.
What is Operation Code Caching?
When a user requests a PHP page, most PHP Accelerators will compile the PHP code for the requested page into bytecode. It will then save that bytecode in a cache either on the file system or in shared memory that allows the PHP Accelerator to skip the compile step the next time that PHP page is requested. This greatly reduces CPU utilization since a PHP script no longer needs to be compiled on every round trip.
What is External Data Cache?
An External Data Cache is either shared memory or file based storage that many PHP accelerators have that allow for storing data across round trips and sharing data between multiple users. SugarCRM has an API that takes advantage of these and can currently support APC, Zend Platform, and Memcache. This reduces file I/O as well as round trips to the database.
The Results:
We saw that with caching enabled, our test server completed more requests per second and the requests completed faster. Once we disabled caching we saw the average server response time shift from sub .5 second response times to around .75 second response times. You will also note in the graph below how much longer the tail of the chart is without cache. This indicates that there was a noticeable increase in the number of responses that took greater than 1 second response time without the cache enabled.

The biggest factor is the improvement in CPU utilization when you utilize a PHP accelerator. We saw a drop in CPU utilization from around 75% down to around 40% when utilizing both the op-code caching and the external data cache.

Conclusion:
If you are not running SugarCRM with a PHP accelerator, you really should be. You will see dramatic improvements in performance as well as scalability leading to better user productivity and reduced hardware needs. You can check out our wiki page on PHP Accelerators for more information.