Drupal Website Performance

How to Optimize Drupal Website Performance

Do you know a well-optimized Drupal website is highly performant, and capable to handle several million visits each day? With Drupal, you can create cutting-edge digital experiences on the web while keeping your site even more secure. Conversely, a poorly optimized Drupal website purposely decreases the response time, make website highly vulnerable, and often result in database latency. However, there are several ways to overall the complex performance-related problems and improve Drupal website performance to load it faster. 

Usually, the quick Drupal website performance optimization tricks and techniques include implementation of a Content Delivery Network (CDN), optimizing MySQL, some architectural changes, and different modes of caching such as View Caching and Page Caching. Apart from these, Drupal offers a range of options to reduce or optimize bandwidth requirements.

How to increase Drupal website performance

Are you struggling with a slow and obsolete drupal-based website? This blog post provides a checklist of some useful performance optimizations to speed up your Drupal site. Let’s delve deeper: 

#1 Update core module, contribs module, and themes of Drupal site. You always want to keep the core, contribs module, and themes updated.

To run updates, navigate to “Reports” → “Available Updates”
Click on “Check manually” to scan for additional updates

#2 User Content Delivery Network. Implementing a Content Delivery Network (CDN) with Drupal is a fast and easy way to instantly reduce load times for your website and ensure you are serving your static content (product images, JavaScript, CSS) from CDN.

#3 Utilize Caching. Drupal provides caching options. This is probably the easiest way to speed up Drupal performance on your site. 

a.    Page Caching Check both module “Internal Dynamic Page Cache” and “Internal Page Cache” are installed and enabled by default.

drupal

In the internal page cache, the module caching takes place within the web pages for anonymous users whereas internal dynamic page cache is leveraged for  anonymous user and logged in user. To enable caching, navigate to Configuration → Development→ Performance

You can set a time for Browser and proxy cache maximum age 

drupal

b.  Twig Caching: Primarily utilized for Drupal 8 theming, twig caching relies on its own cache of compiled Twig templates. It works by quickly separating from other caches that are already cleared with the drush cache:rebuild command in Drupal 8. 

Twig Caching true/false in  development.services.yml
1.twig.config
2. debug: true
3 auto_reload: true
4. cache: true/false

c. BigPipe Caching:  

 For all Drupal 8 websites, the better performance can be achieved using BIGPIPE caching as it loads a page for quick user-interaction at 44 ms. It helps to load dynamic pages quickly by loading various web page sections in a parallel manner.

d. . Views Caching 

1. To enable views caching, navigate to Administration → Structure→ Views
2. Click “Edit” on the view where you want to enable caching 
3. Expand the “Advanced box” 
4. Select “Time-based” or Tag based and click on “Apply (all displays)” 

e. PHP Caching: 

•    OPCache can be explained as a caching engine built into PHP
•    Enable GZIP Compression, which is a simple method for compressing your files of a website to save bandwidth and speed up page load times.
•    Leverage browser caching for images, CSS, and JS
•    Enable FastCGI

f. Mem Cache: Web developers widely use this general-purpose distributed memory object caching system to cache database data, API calls, and page rendering chunks in RAM. It helps in significant optimization of the website performance. The potential benefit of using Mem Cache is that it stores data in the format as little as a number or as big as a finished HTML page.

g. File Cache: This caching helps web developers to overcome challenges associated with servers having file-read-intensive workloads. The file cache works as a data space where developers can control files seamlessly for the server by using the server kernel.

h. Redis Cache: Redis refers to Remote Dictionary Server, which works as an in-memory data structure store used by developers for database, cache, message broker, and streaming engine. Redis caching helps in improving the overall performance and scalability of a website architecture by keeping frequently accessed data in the server memory. 

#4Image Optimization is essential

 You can change the compression ratio of an image. By default in Drupal 8, it is set to 75%. It can be achieved using below Drupal website performance tips:
1. To change the ratio, navigate to Configuration → Image toolkit 
2. You can then change the % amount and click on “Save configuration"

drupal

#5 Use Fast 404 module to reduce 404 error in Drupal

#6 Aggregate CSS/JS Aggregate CSS/JS. By aggregating your CSS and JavaScript files, you can improve the performance of your front-end and download times. This happens because the browser doesn’t have to fetch files, reducing the number of HTTP requests. 

 

1. To enable, navigate to Configuration → Development → Performance 
2. Now click on “Aggregate and compress CSS files” and “Aggregate JavaScript files”

3. Click on “Save configuration”


drupal

 

#7 Use minify js and css for page speed


#8 Use syslog instead of database logging for error log


#9 Use search engines like (Apache Solr, Elastic Search)
 

#10 Optimize your database Scale-up database server hardware, increase the number of CPU cores, and use RAM and disk storage array technology to maximize I/O on disk reads and minimize latency. Reduce the volume of queries by modifying your application or increasing their performance using standard database optimization techniques such as building appropriate indexes of the field. 
We can use master and slave database and configuration in settings.php
 

$databases['default']['default'] = array (
   'database'=>'drupaldb',
   'username'=>'masteruser',
   'host'=>'database-master.com'
   ...
);
$databases['default']['replica'][] = array (
   'database'=>'drupaldb',
   'username'=>'slaveuser',
   'host'=>'database-slave.com'
   ...
);

#11. Disable the PHP Filter module

#12. Disable theme registry rebuilding

#13. Disable unnecessary modules 

 You can disable modules—Administration Development tools, Devel, Devel node access, Module Filter, Blog, Forum, Taxonomy, Search, Help, Shortcut, Database Logging, Color, Toolbar, Tracker, Statistics (this module writes to your database on every page load. If you are using Google Analytics you probably don’t need this), Update Manager— if you don’t need their functionality for your site. 

#14. Use modules—blockcache_alter, elysia_cron, entitycache, pathcache, lazy loading images, Cache Warming— to speed-up the performance of your Drupal website

#15  Use reverse proxy cache Consider installing and configuring an HTTP accelerator such as Varnish. Varnish is a “reverse proxy cache” that handles a number of static files and anonymous page-views for your site much faster than Apache

#16 Increase the amount of RAM available to the server. If you are on a shared hosting environment, move Drupal to a virtual private server (VPS) where you have full control over the amount of RAM, CPU and disk, and network bandwidth. Change RAM size to 128MB or greater in PHP.ini file

#17 Tweak the max_execution_time setting in the PHP.ini from 60 to 120 seconds or greater, if necessary. This will prevent long-running processes such as the cron from timing out and hanging.

#18 Tune Apache for Apache max clients

#19 Choose a reliable host offering greater speed

#20 Manual removal of blankspaces and comments from.tpl to optimize the Drupal theme. There should be no indentation in .tpl

#21 Make significant improvements according to Google Pagespeed and yahoo YSlow suggestions 

#22 Make sure the Drupal site is build as per coding standard and there is proper use of already existing core API

#23 Use NGINX as your web server to improve Drupal 8 performance on the web. The minor changes to nginx.conf primarily at the update.php front controller, can result in maximized performance. Nginx is a forward looking solution that can be used to cache, load balance, reverse proxy, and much more.  

#24 Implement AMP standard to provide lightning-fast page loading on mobile devices.

#25 Use S3 File System to create an additional file system to your drupal site. It can be utilized to store files in Amazon's Simple Storage Service (S3) or any other S3-compatible storage service. It is ideal for Drupal site that are load-balanced across multiple servers.

#26 Load balancing is a vital step in the Drupal website performance optimization process. As a a solid performance improvement strategy, one must scale-up by setting up a web farm (multiple web servers) and put a load balancer in front of the web servers. Round robin the load balance by handling the web requests between the web servers. 

Best Drupal Development Services: Up to Speed

With changing requirements and a rising number of users having varying bandwidths and connectivity options, Drupal provides specific functions and modules to scale-up performance. This ensures that the Drupal website with dynamic features and rich content loads faster, responds quickly to database queries, and scales up overall performance.