Top 10 Performance Mistakes in Drupal

| | 4 min read

There are a few common performance mistake that are commonly found in most Drupal sites. Here are the list of the Top 10 Performance Mistakes in Drupal that can easily be addressed by a simple change in settings or the addition of a module. The easiest way to solve performance problems in Drupal would be to prevent them in the first place. Contact us for a free consultation on how to build your Drupal website right.

Caching not configured
Failing to configure the cache properly or none at all is a major oversight found in most Drupal sites. Caching leaves a lot of room for improvement. Without a cache, Drupal has to be bootstrapped every time a request is made which means that its PHP logic should be executed and database queries have to be run which ultimately contributes to server load and decreasing page load times.

On a site with many thousands of visits per day, caching should be implemented at all costs. The simplest caching system in Drupal is one which anonymous users are given a static HTML page which had been generated the first time the page was requested. Drupal has a pluggable caching system which means you can use contributed modules to improve the cache. Boost is popular caching system used in Drupal.

Cache time incorrectly configured
Just as caching is important for speeding up of a Drupal site so is the timing of the cache or the cache lifetime, to be more specific. If your site has frequently changing data then caching time should be set to only a few minutes. If it is serving mostly static content to a majority of anonymous users then caching can set to be a many hours. Sometimes you might have to sacrifice recency of content for better performance. You would want to take a call on this based on the nature of your site.

JS Aggregation not enabled
A reasonable sized Drupal site will have a significant number of JS files contributed to the site through contributed and custom modules which naturally add to the page load times of the site. This can be solved by aggregating all JS files in the site. JS Aggregation is the process of combining the different JS files in your Drupal site into a single JS file. Drupal does provide basic Aggregation which should be activated and configured correctly.

CSS Aggregation not enabled
CSS Aggregation is the process of combining of the different CSS files in your Drupal site into a single file. The basic wisdom behind CSS Aggregation is same as JS aggregation. Although CSS files are not as heavy as a single JS script file, the number of CSS files are always usually higher than the JS files present in a site. CSS Aggregation can be done using the CSS Aggregation Module.

Views caching configuration not used
Views is an extremely useful module in Drupal and finds a lot of uses in most Drupal sites. Views are also resource intensive. Views provides a built in option for caching which should be enabled if you want to reduce performance overheads related to views.

Full size Images used with resizing via html attributes instead of Image cache based resizing
Drupal provides a good set of tools for handling all the images in a website via the ImageCache module. If your Drupal site is having an reasonably large image and you have to resize it via HTML to fit to a certain width, then the browser has to download the complete image and then fit it to the specified attributes. This process will automatically contribute to the page load time of the site. Using the ImageCache module, the very same image can be resized to the specified attributes before it is requested by the browser leading to a decrease in page load times.

Too many blocks
Blocks are an important component in the layout of a Drupal site. Having a lot of blocks degrades the performance of a Drupal site as a number of hooks have to be called. So it is a good practice to avoid the creation of unnecessary blocks.

PHP input format used in blocks and content
If the PHP input format is enabled on blocks and content, whenever these blocks and content are called, the hooks and callback mechanisms associated with executing PHP within these areas will also have to be called which leads to a decrease in performance. Therefore this would have to be disabled unless it really necessary.

Too many blocks enabled
Performance degradation will also occur on a Drupal website with a lot of unused blocks. Blocks will cause the associate hooks to be called each time they are called. Therefore it would be a good practice to have unnecessary blocks disabled on your Drupal site. Using a module like Contexts can ensure that block hooks are called only if a set of conditions has been satisfied.

Having a number of unused modules enabled on your Drupal site
Having a lot of unused, non-essential modules on your Drupal site can lead to a slight decrease in performance. It is very easy to overlook this factor but it is also the easiest to solve. Disable all non-essential unused modules. Just make sure that the modules you plan to disable are not required by any other module.