Blogs | Srijan

Advanced Level Tips To Boost Your Site Performance

Written by Ankush Gautam | Apr 15, 2020 7:00:00 AM

 

A good-looking Drupal-based website is essential to engage the audience but what if the website is slow?

The visitor will lose interest and may not return ever! 

Unfortunate, but true!

Drupal is an incredible website content management system especially when you need your website up and running before the end of the day. 

Even though the platform caters to all our online website needs, there are always options to speed up your website.

Since we have already covered basic and intermediate level tips for optimizing the website, this blog would cover 8 advanced level tips to help you up your game in this fast-paced digital environment.

  1. Cache Tags & Varnish :
    Varnish Cache, also known as caching HTTP reverse proxy is a web application accelerator that is used to boost the page load performance by a factor of 10-1000x depending on your architecture of Drupal-powered websites.

Besides, it can also be used with cache tags to ensure easy cache invalidation.

Follow these 3 steps for basic cache tag integration. Also, ensure that Varnish works well the cache tags generated by Drupal

  1. Update your Varnish VCL to ease it at handling BAN requests
  2. Send a cache tags header (e.g. X-Cache-Tags) header with every request, containing a space-separated list of all the page’s cache tags.
  3. Send a BAN request with appropriate cache tags whenever content or configuration is updated so as to mark pages expired with the associated cache tags.

2.   Advanced Page Expiration

With the Advanced Page Expiration module, you can manage those pages which you want to be expired faster than other pages. For instance, this module would cache all the site pages for 24 hours except for the homepage which could be cached for five minutes.

It also allows improved control on the cache-control header during the use of external caching servers, like Varnish. Sites with an external caching server that uses the cache-control header to set TTL for cached pages such as Varnish and Nginx should opt for this module.

This header further indicates caching servers about how long the URL should be kept in the cache-

Here are some options that you can use to manage cache-control header

  • Increased cache lengths - The maximum amount of time for a cached item is 1 Day. This module allows up to 1 Year.
  • Exclude pages from caching - A list of pages that should not be excluded from caching can be defined. It sets the cache-control header to no-cache.
  • Rules Integration - Use Rules for more complex conditions beyond just creating a route/path to set the cache-control header. This is currently only supported for Drupal 7.x.
  • hook_ape_cache_expiration_alter() - This hook will allow complex custom logic to manage the cache expiration length. 

3.  Minification

Source: Drupal.org

Minification process reduces code/markup in web pages and script files. It is one of the most significant methods to reduce load times and bandwidth usage on websites.

There are two Drupal modules that help in the same-

  1. Html Minify
    Minify Source HTML was developed to replace the Minify module, which would only minify the HTML in the content area of the page instead of the HTML of the entire page.
    The module is placed at the bottom of the page render process and minifies everything.
    The companion module Minify JS module minifies JS.
  2. Minify JS
    Minify JS module was developed to get rid of problems caused due to the implementation of the Minify module.

Those problems were-

  1. It does not store the minified version of its files in the public file system, thereby disabling other modules such as the S3 File System module to work with it.
  2. Uses remote call to Closure Compiler which itself has few limitations like the cap on the number of files it can minify in an hour and another one is preventing from minifying JS to a single line.
  3. It only detects javascript files that were already loaded on a page, indicating that all pages would need to be visited again to obtain a complete list of javascript files.

Look how Minify JS provided the solutions to the above problems respectively-

  1. The module uses the public file system and if any module that uses its own stream Wrapper for the public file system will surely work with this module out of the box.
  2. This module uses the JSqueeze PHP class for its minification, which does not have any such kind of limitations.
  3. This module scans the file directory for .js files (excluding .min.js files).


4.  Third-party performance tool for performance and slow query logs- NewRelic

New Relic’s software analytics product enables easy application performance monitoring (APM) to deliver real-time and trending data about clients’ web applications’ performance and the kind of delightful experiences your customers are getting through it.

This cloud-based platform facilitates developers, operations, and management teams a clear view of what is happening around in today’s complex software environments. 

Hence, you can find and fix problems faster to avoid any hindrances while delivering great digital experiences to users. 

5.  Akamai / Amazon CloudFront CDN / Acquia

Akamai is a prominent content delivery network with one of the largest distributed computing platforms in the world that serves between 15% to 30% of all web traffic.

Amazon CloudFront is also a content delivery network released by Amazon Web Services.

And the third one is the Acquia Cloud Platform CDN. It is a distributed network of servers that caches web site content to improve page load speed by saving copies of your pages to its servers, hence reducing bandwidth and CPU usage on the server.

With it, you can deliver exceptional digital experiences to users across the globe by caching pages and static assets at more than 65 points of presence (POPs) around the world.
Visitors will be able to access your website easily by loading static assets from the POP closest to their location, thereby decreasing the turnaround time and helping in increased conversions.

6.  Server Cache

It identifies anonymous user pages cached. You can check this URL CURL here-


Eg: curl -I https://www.google.com/ (Replace https://www.google.com with your site URL) 
 
 
HTTP/2 200 

date: Thu, 02 Jan 2020 06:17:48 GMT

expires: -1

cache-control: private, max-age=0

content-type: text/html; charset=ISO-8859-1

p3p: CP="This is not a P3P policy! See g.co/p3phelp for more info."

server: gws

x-xss-protection: 0

x-frame-options: SAMEORIGIN

set-cookie: cookie values display here

set-cookie: cookie values display here

accept-ranges: none

vary: Accept-Encoding

Make sure the URL header should not have no-cache in Cache-Control.

7.   Managed Dedicated Server(s)

A managed dedicated server provides you with the hardware and a team of experts to ensure the smooth and efficient running of the software. Besides updating it, it also alerts you if there are any problems, generally after fixing them.

You can implement multiple servers in several configurations. For example, a firewall caching server, database server or multiple HTTP servers could all be part of a larger solution.

8.  BigPipe 

BigPipe module in Drupal 8 reduces load time by dispatching unchanged components of a page to the browser and also the dynamic components as soon as they're prepared.

You can enable the BigPipe module for Drupal 8 and see the distinction for yourself.

 

 

 

Performance results are like this-

1. When the BigPipe is disabled

Here, the load time is 789ms.

2.  When the BigPipe is enabled

 

Now the load time has reduced to 195ms.

Conclusion

Optimizing your Drupal-powered website can be a difficult task on its own. Consultants and IT firms can spend days or weeks even evaluating the performance-related issues and fixing them.

But the tips and tricks mentioned in the blog can be implemented right away hassle-free. 

Besides, you don’t need to implement absolutely everything on this list- implement some and analyze the difference it brings in enhancing your site speed.

Drop us a line for such assistance and our team will get back to you.