How to easily increase a Drupal Site Performance

Optimizing and increasing performance on a Drupal Site

Many of more than 2.900+ of our customers(at the moment of this post), as we provide Drupal services, are interested in knowing how to increase the performance of their production Drupal sites. This is a common question we receive frequently, so just decided to write a small post, explaining how to do it, at least in the Drupal way, as there are many general performance tips you can apply to any site, not only Drupal.

First Step: A web page Performance and Optimization Test

WEBPageTest is a very popular tool to work with when it comes to performance tests. Just write down your page URL and run the test.

It includes a lot of important details such as your images optimization needs, a waterfall with all requests made by the browser, a preview, a set of suggestions, the ammount of requests... They include a great way to score your site, separated in 7 parameters:

  • First Byte Time
  • Keep-alive Enabled
  • Compress Transfer
  • Compress Images
  • Progressive JPEGs
  • Cache static content
  • Effective use of CDN

How to easily increase a Drupal Site Performance
Sample results on a test made to http://doublemthemes.com

Additionally, the test also shows the loading time's table, where you can inspect the ammount of requests for first view visitors and the response time on local cached content each time they access your site for a second time.

Document Complete Fully Loaded
Load Time First Byte Start Render DOM Elements Time Requests Bytes In Time Requests Bytes In
First View 2.041s 0.298s 1.833s 350 2.041s 31 575 KB 3.161s 53 716 KB
Repeat View 1.078s 0.467s 1.121s 350 1.078s 3 1 KB 2.185s 13 40 KB

Sample results on a test made to http://doublemthemes.com

Second Step: Enable Drupal Performance

As Drupal is a database based CMS, all its content is stored in a wide set of tables and rows that your site needs to query each time a visitor requests for its content. For example, if you are requesting for a page which includes a set of blocks with Views, each one of these blocks needs to run all the internal queries in order to display the results on your HTML code.

Drupal Cache

Chaching blocks and pages for anonymous users is the best way to increase the performance of your site. If each block knows what “to say” (in HTML, of course) without needing to run dozens of internal queries, that is just great. You can access Drupal Performance in Admin -> Config -> Performance.

Now, it will always depend on how frequently is your site updated with new content. This is known as “Minimum cache lifetime”. If you or your customers use to create content 3 or 4 times a day, you can set this cache to be generated every hour. It will allow, all visitors in an hour after the first one, to receive the same result as the first one received. When this hour came out, then the next one will (without knowing it, of course) do the same for all those after him.

You can define from “1 minute” to “1 day”, in different scales.

How to easily increase a Drupal Site Performance
Site Performance and Optimization Panel in Drupal 7.x

Bandwith Optimization

Drupal allows you to Aggregate and compress CSS files and Aggregate JavaScript files included on your theme to increase page load time and reducing the amount of requests your browser needs to make when downloading the site for the first time. Also, if you enable cached pages, you can also “Compress cached pages”.

JPG Compression

The size of your images also is taken into account on page loads. It is a good practice to always use Drupal Image Styles to display content images. It will allow you to control the JPEG quality of all your content. A 75% values is a good balance between quality and file size. You can the Image Toolkit panel at Admin -> Config -> Image Toolkit

How to easily increase a Drupal Site Performance
Images Toolkit Panel in Drupal 7.x

Third Step: Re-run the test

Once you enable the backend performance features, then just run your test again. Not bad huh?? WEBPageTest stores all test results in an URL, so you can check them to compare current tests with previous ones.

How to easily increase a Drupal Site Performance