Semantic web development and publishing

Drupal Performance Out of the Box (part 5)

Drupal has a number of features which allow for performance to be improved without the addition of external modules or for complicated configuration by administrators. A slow system can easily be turned into one which performs well under heavy loads.

Firstly, Drupal shortcuts the execution of unneeded code by using an internal caching system which stores results of expensive routines. Secondly, Drupal improves page rendering time by allowing for the aggregation static JS and CSS files. Thirdly, page output can be compressed saving download time. Fourthly, Drupal allows for manual configuration of the caching of Blocks and Pages which can improve performance significantly.

Drupal Core caching system

Drupal comes with a number of in-built caches which store the results of expensive calculations (strings) in the database so that they can be retrieved quickly later on. There are six caches enabled by default: cache, cache_block, cache_menu, cache_filter, cache_form and cache_page. Contributed modules are able to create their own caches for storing data which is handy for module designers. This default cache system provides improved performance across the whole app.

The caching system is pluggable and allows for custom storage engines to be substituted in for the default database implementation. Later in this guide you will see how the Cache Router module is able to swap in memory based storage in place of the database, making the retrieval of cached content that much faster.

All sites: Improved performance across the app. No config.

Aggregate and compress JS and CSS

Drupal’s modular system means that pages can have a large number of CSS and JS includes which results in a lot of client server communication – slowing the page draw time down. The problem can be alleviated by merging the files and then compressing them. This results in less includes and faster downloads. Up to 90% of download time can be attributed to downloading CSS, JS and images so it makes sense to aggregate and compress if possible.

During development it is advisable to keep this option turned off so that CSS and JS errors can be troubleshooted.

All users: Lower render times. One click config.

Minimize HTTP Requests
Yahoo place this at the top of their list for ways to reduce download time. 40%-6-% of users are first time users so client side caching is no help to them. Fewer HTTP requests are.

Page Cache for anonymous users

Pages for anonymous users can be cached, meaning that a full build of the page isn’t necessary for each new request which comes in, providing you with savings in CPU and DB load as well as giving the user much faster response times. This is a massive win for your website, especially if the majority of your page requests are from anonymous users. Basically it can help you survive a Slashdotting. Drupal offers “aggressive” and “normal” options – normal page caching is recommended for most websites. Other options for Page Caching are discussed below.

During development it is advisable to keep this option turned off so that any changes to logic or design can be troubleshooted.

Anonymous users: Big wins in speed and CPU. One click config.

Drupal vs Joomla: performance
An older article comparing Joomla and Drupal. Joomla faster on non-cached pages but caching makes Drupal win.

Block Cache

Enabling the block cache allows finer grained control over cached content. Caching blocks which don’t change frequently will enable speedups for logged in users who need a dynamic page built for them each request.

Logged in users: Moderate wins. Easy to implement.

Drupal guide to caching
Covers the various database tables which store data for Drupal’s caching system.

Page Compression

It is also possible to enable page compression for the pages sent. This will reduce the page size by 50% or more depending on the page. Users requesting big pages on slower connections will love this.

Slow connections: Massive win. Easy to implement.

How to make Drupal run 8.5x faster in 5 minutes…
Page cache provides a 3x speedup.
How I Survived a 2300% Traffic Increase With Drupal
Demonstrates that these out of the box techniques can be very effective even for sites on shared hosting.

This article forms part of a series on Drupal performance and scalability. The first article in the series is Squeezing the last drop from Drupal: Performance and Scalability.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>