tel: +44 (0)1865 741 762 email: hello@webcurl.co.uk
tel: +44 (0)1865 741 762 email: hello@webcurl.co.uk
During peak times your site may slow down due to the sheer volume of visitors. This post describes some of the best practices to boost performance on these high traffic sites through the use of caching.
Like all other database driven content management systems, when a page make a request for content, Drupal builds it together on the spot. The page then gets created and passed to the web browser for rendering.
There's a lot of processing required by servers on each and every page view. It's easy to see why they start to struggle when traffic rises.
Instead of making another database query, Drupal can remember the page content and send this data instead. The downside of this is that if new content has been created there may be a tiime lag before it is displayed. Finding the right balance in caching is very important for production sites with regular content.
Out of the box caching in Drupal can be accessed by navigating to 'Admin'=> 'Site Configuration'=> 'Performance'.
You can enable site wide caching, choosing how aggressively you want to cache. You can set a minimum lifetime for the cache and how long it will be before it is repopulated. Using this, you can find a good balance between performance and flexibility.
This method of caching uses database tables to store the consolidate data pre rendered.
There are other techniques avaliable for caching, some in the form of software that interacts with Drupal through a contributed module.
Boost is a page caching and compression module that shrinks the page output, saves it as a file and serves it to browsers that support this format. The great advantage of Boost is it takes server side processing out of the equation entirely, drastically reducing cpu load on the server.
Boost is a serious option for the majority of sites running Drupal, it is easy to install and configure to find your caching sweet spot.
Memcached is a system that organises the combined memory of your servers for speeding up web applications like Drupal. Unlike Boost, memcache places its data into virtual memory, creating faster access for regular content and a significant performance gain.
Varnish is a 'HTTP accelerator' that compresses files visitors ask for which cuts down bandwidth and boosts performance. Like Memcached, it makes use of virtual memory, making it very quick in serving pages.
Varnish acts as another layer between the user and the server, hence the name. If a user is not logged in and is requesting content that is not updated regular, varnish will service this request itself remving the need for processing by the web server.
For a small, DIY Drupal site, the default caching options coupled with Boost will provide a nice performance gain that's easy to interface with.
For high production sites, the benefits of Memcache and Varnish become very apparent, outweighing the initial set up cost, that requires some technical knowledge of server set up.
John Leon House,
138-140 London Road,
Headington,
Oxford,
OX3 9ED
+44 (0) 1865 741762
hello@webcurl.co.uk
Registered Office Charterford House, 75 London Road, Headington, Oxford, OX3 9BB Company No: 06680957 Registered in England & Wales