Skip to main content

Essentials for Drupal Performance

Here we'll detail various common Drupal configurations and modules that developers can consider when optimising a production site for performance.

Let’s start with the real basics and a brief description, these concepts are widely covered elsewhere so we’ll keep the details brief and move on to some more advanced stuff.

Drupal Page Cache

Drupal offers Page Caching as a core feature, simply enable it under your sites Admin -> Performance settings.

 

JS and CSS Aggregation

Enabling these settings will reduce HTTP requests on each page request as your JS and CSS files are aggregated (bundled up) into just a few files, even if you have dozens of custom JS and CSS files in your theme and modules.

 

JS and CSS Gzipping

Drupals .htaccess file has support for Gzipping (compressing) your sites JS and CSS files. Because we use Apache as the core webserver those rules along with other Apache directives such as rewrite rules are interpreted and honored.

Once the Gzipped files have been created, they are served directly from the Edge cache resulting in far fewer Apache requests and instead lightning fast reverse proxy responses.

Our Edge Cache goes one further by also Gzipping Drupals rendered HTML and other files to serve from cache.

 

APC configuration with our stack

We use APC as a backend object cache. The easiest way to fully benefit from this is to download the Drupal APC module and use the below configuration in your settings.php file.

(NOTE: You’ll need to calculate the total size of the database tables you wish to cache and ensure they are less than the available DB cache of your account otherwise fragmentation will occur and negatively effect performance.)

 

Disable Unused Modules

The Drupal typical install ships with some modules enabled that frankly, probably shouldn’t be on a production site. The more modules enable, the greater the memory footprint of the site and potentially more unnecessary DB queries. Here’s a list of core and popular contrib modules that we disable in 90% of cases when launching a site in a production environment:

Overview – Deprecated in Drupal 8, the Overview module attempts to improve admin workflow.

Syslog, Watchdog – Logging events to the database causes DB writes. Any DB actively requires disk inputs and outputs which is likely any sites greatest bottleneck, particularly SQL writes.

Views UI (or any other UI modules) – Since you’re in  production, best practice would not be to change views directly on the live site. So any UI modules can normally be safely disabled.

 

Performance Modules

The below modules aren’t required for your site to perform well on our servers, however we recommend reviewing each module for use in your Drupal install. Each site is different and simply installing all these modules may not work for you.

 

APC

As mentioned above, this modules stores your cache tables (and any objects you choose) in cache improving the response time of authenticated users requests in particular.

 

LabJS

The Drual LabJS module integrates the JS LabJS Library enabling parallel downloading of JS assets. This negates page render blocking caused by web browsers preventing page rendering till all JS files have been downloaded.

 

Performance JS

Performance JS is a very sweet module that allows JS callbacks to only bootstrap Drupal to the level required to return a response. Why load the whole of Drupal if you only need to perform a simple database select query? Performance JS integrates with some popular conrib modules that provide AJAX functionality and provides and API to use with your custom modules.