An Easy Way to Improve Your Website's Performance: Xcache

Blog

Estimated
3 min read

It’s always important to consider how you can optimize your website for maximum performance. Andrew King, author of “Website Optimization”:http://www.websiteoptimization.com, cites a study that shows “tests at Amazon revealed…every 100 ms increase in load time of Amazon.com decreased sales by 1%.” The study also links slowness with “lower perceived credibility and quality,” which is certainly important whether you’re selling goods or organizing a team of people.

While performance optimization is a multi-step process, one tool that can get you a lot of additional performance with little effort is a PHP opcode cache. Instead of parsing and compiling PHP code into bytecode on every page load, an opcode cache saves a copy of the bytecode so that the next time the same request is made and the code has not changed, it will not get re-parsed and recompiled but rather be read directly from the cache on the server.

There are several opcode caches available. You can read about several of them “here”:http://en.wikipedia.org/wiki/PHP_accelerator. Another great resource is Drupal.org, where a search turns up many posts on people’s experiences with particular opcode caches. We are using Xcache. To give you an idea of the effect this has on a Drupal site, we did a quick comparison of a Drupal site without Xcache, and then a Drupal site with Xcache enabled. While the tests run are certainly not extensive, the limited results are telling.

Testing parameters

  • Four calls to Apache AB were run, like: ~$ ab -c1 -n500 http://example.com (which is 500 requests with no concurrency)
  • A set of two calls (with and without Xcache) to AB was run from a separate server, over the internet but from same data center
  • A set of two calls to AB was run on a local development machine
  • There was no traffic on either server besides the tests themselves

Results

The average page load times and standard deviation were as follows:

| Location | Without Xcache | With Xcache | | On server | 585ms/page load, 109.6ms standard deviation | 333ms/page load, 75.1ms standard deviation | | On localhost | 746ms/page load, 176.2ms standard deviation | 427ms/page load, 76.2ms standard deviation |

As you can see, even while keeping the standard deviation in mind, the Drupal site running Xcache is considerably faster than the site not running Xcache. Such is the case for the test run on the two development servers, as well as the test run on localhost. The greatest difference is noticeable in the overall time it took to run the two tests. For example, this is the test run on the servers:

  • Without Xcache: 292.365 seconds
  • With Xcache: 166.533 seconds

Conclusion

Our small test set shows that the site using Xcache loads over much faster than the site without Xcache. This is an improvement that not only your servers will feel, but also your site users will notice. While there are many things you can do to increase the performance of your website, starting with the data center where your website is hosted all the way to how you design your website, this is one easy way to improve your site’s performance, either as part of a greater plan or as a one-off change. The “Xcache site”:http://xcache.lighttpd.net/ has helpful installation documentation to get you started.

What we're doing.

Latest