Tim Hilliard

Website Development, Optimisation and Analytics

Flower

PHP accelerators

PHP acceleration is a method of boosting your server performance by around 2-10 times without the need to make any changes to your code. When we write PHP code, it is written in what can commonly by described as pseudo-code, a way of representing what we want our program to do in english. Of course there lays a problem in this, a computer doesn’t know english. This is where a compiler comes in. In our case this is the PHP compiler which translates our english pseudo-code into machine readable byte-code. Now compiling PHP is not a lengthy process at all but none the less it does take up time and resources from our server. When we add hundreds of simultaneous page requests into the mix the load really starts to build up. Luckily we have a way to fix this problem through PHP acceleration. What this does is cache the compiled byte-code from a PHP script. Once a script is cached, the next time someone goes to access the same script they get to skip the compiling stage as this has already been performed by a previous access to the script and stored in memory. Voila we are able to increase our server performance by up to 10 times.

Ok time for a case study. You may remember back to the project where I first go my hands dirty with Drupal. Well on this project I was also put in charge of finding suitable hosting. When it came time to switch the server to live things started out well. Unfortunately over the next fews hours the load kept gradually building until around 4 hours passed at which time the server crashed. I immediately jumped on the case of hosting support who promptly suggested adding APC (Alternate PHP Cache) onto the server. This was swiftly done and less than half an hour later the server was live again. Over the next 72 hours we closely monitored the server load. The load from now on has only ever reached around an eighth of that shown when the server crashed.

So there are several options when it comes to choosing a PHP accelerator. Some of these include APC, Zend and XCache. For more information I recommend starting with the wiki entries for php accelerators. Looking to the future it has been announced that PHP version 6 will include APC php acceleration by default.

So if you are looking for an easy way to boost performance I would definitely recommend looking into php acceleration.

http://www.timhilliard.com/wp-content/plugins/sociofluid/images/digg_48.png http://www.timhilliard.com/wp-content/plugins/sociofluid/images/reddit_48.png http://www.timhilliard.com/wp-content/plugins/sociofluid/images/dzone_48.png http://www.timhilliard.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://www.timhilliard.com/wp-content/plugins/sociofluid/images/delicious_48.png http://www.timhilliard.com/wp-content/plugins/sociofluid/images/blinklist_48.png http://www.timhilliard.com/wp-content/plugins/sociofluid/images/blogmarks_48.png http://www.timhilliard.com/wp-content/plugins/sociofluid/images/furl_48.png http://www.timhilliard.com/wp-content/plugins/sociofluid/images/technorati_48.png http://www.timhilliard.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://www.timhilliard.com/wp-content/plugins/sociofluid/images/mixx_48.png http://www.timhilliard.com/wp-content/plugins/sociofluid/images/twitter_48.png http://www.timhilliard.com/wp-content/plugins/sociofluid/images/jamespot_48.png

Leave a Reply

You must be logged in to post a comment.