Performance Optimisation In Drupal

If your server has good configuration but your Drupal website is loading slow, you need to figure this out.

we need to care about speeding up Drupal application because, the speed of your website greatly affects your traffic, conversions, revenue, and even SEO rankings!

  • Shopzilla saw a 12% revenue increase after improving average page load times from 6 seconds to 1.2 seconds.
  • Google says they lose 20% of their traffic for each additional 100 milliseconds it takes a page to load. Speed matters. Google also incorporates your page-load time into your site’s search rankings.

Steps to speedup your Drupal website:

1. Always use latest version:

It is very important you are always running latest version of of drupal and it’s contributed modules, because drupal is an opensource CMS. Contributes always tries to optimise the things with latest security update. You can check the available update for drupal in reports menu on below path:

Home » Administration » Reports

It is showing that drupal core is not updated. We should not have such situation. We should always update drupal core as well as contributed modules.

2. Use caching mechanism :

Like other CMS drupal comes with some basic page caching and block cacking. You can use this caching by enabling this and set cache expiration time. you can find this under performance option.

Home » Administration » Configuration » Development

There are various cache modules available in drupal you can use those module Drupal modules for caching View caching modules is widely using. You can cache the views using this module. If you are using panels then you can also cache the panel itself.

Apart from above caching there are multiple cache available. You can configure all below caching mechanism and get speedup your website drastically

3. Content Delivery Network (CDN):

A content delivery network or content distribution network (CDN) is a globally distributed network of proxy servers deployed in multiple data centers. The goal of a CDN is to serve content to end-users with high availability and high performance. You can put you assets like js,css, image, video file on CDN.

Configure CDN is a easy task. I am explaining this little bit here and assuming that you are using CDN from Amazon.

  • Login to Amazon console.
  • Create a bucket.
  • create a cloud front for the same.

Download and configure CDN module

4. Gzip Compression:

Gzip is a method of compressing files (making them smaller) for faster network transfers. It is also a file format. Compression allows your web server to provide smaller file sizes which load faster for your website users. Enabling gzip compression is a standard practice. If you are running on Apache you can enable compression by adding the following to your .htaccess file.

  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent

If you are running on Nginx You can enable compression by adding the following to your nginx.conf file.

gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_vary on;

Set Header Expiration time Expire headers tell the browser whether they should request a file from the server or grab it from the browser’s cache.

     ExpiresActive On
     ## Add default Expires header
     ExpiresDefault "access plus 1 year"

5. Use Lazy loading :

Lazy loading images dramatically increase your page load times by ensuring the image will only load when it is visible to the browser window. There is contributed modules available for Lazy loading

6. Compress js and css and use aggregation both:

You should compress and aggregate your JS and css it helps to increase the performance and reduce the page load time.

7. Uninstalled unused module :

You should uninstalled all those module that is not being use for the website.

8. view module vs custom Query :

If you application is very larger and you need to hit multiple view the it’s better to use custom query rather then using a view.

Leave a Comment.