Drupal is one of the most loved opensource CMS/CMF. At the same time it is also famous for being huge. Whatever the case if you are running a site with Drupal you have to make sure that it performs well.
Criteria for a well performing site
There are many criteria which can be taken up as a consideration for a well performing site, which may include things like
- Fast Loading Speed
- Mobile Responsiveness
- Intuitive Navigation
- High-Quality Content
- Effective Visual Design
- SEO Optimization
- Secure
- Minimal Errors
- Analytics and Tracking
- Accessibility
- Social Media Integration
- Consistent Updates
And many more. Many points mentioned above are technical i.e. to do with optimization of Drupal and other are points relating to content and search engine optimization. We will be discussing the technical aspects which can be managed via Drupal to improve upon loading speed of Drupal based website.
Improving loading speed of website
Page or website loading speed is one important aspects which will attract people to you site. If pages load slow there are chances that your visitors will go away. this is also known as bounce. To improve page loading speed we can do the following:
Disable unwanted/unused modules
Drupal 10 comes with around 70 core modules many of these are enabled by default. Every enabled module means extra code to e be processed. You can study and disable the unwanted modules. e.g. say the Shortcuts module. I generally do not use this module, another is the Help module, in most cases people search on the net for documentation. Based on your discretion you can disable modules.
Disable and remove any unused contributed module
People tend to install a lot of contributed modules, many a time while just trying out multiple modules, only few are actually used and remaining are kept installed and enable. Any unused contributed modules should be disabled or removed.
Disable themes
Themes are integral part of Drupal and few come inbuilt. Generally you would install and finalize of an external theme. Just like it happens with modules people tend to install multiple themes and keep them installed. Its a good idea to keep only one theme enabled and set as default. Core themes not in use should be disabled and any other extra themes should be removed.
Caching
Drupal is comprised of many layers that all come together to manage the site content. To display content or a page to user Drupal dynamically runs complex SQL queries to retrieve the content and related items for the page which is being viewed. To reduce this overload for every page request Drupal has an inbuilt setting to improve performance via Caching. This setting is accessible at Administration > Configuration > Development > Performance.
Apart from this one can use external modules which can help in improving caching and performance.
Using OPcache
As Drupal is written in PHP we can use OPcache in PHP (need server access).
"OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request."
Using external caching solution like Varnish or Redis
If your Drupal based site is going to experience heavy traffic using caching solutions like Varnish or Redis can bring in a lot of improvements. Drupal has modules to integrated with Varnish module or the Redis module.
Optimize Bandwidth
Drupal allows to aggregate CSS and JavaScript code and compress the same. This will save bandwidth and server requests, resulting in faster load times for the users. This setting is accessible at Administration > Configuration > Development > Performance.
Minification
Minification (also minimisation or minimization) is the process of removing all unnecessary characters from the source code of interpreted programming languages or markup languages without changing its functionality. These unnecessary characters usually include white space characters, new line characters, comments, and sometimes block delimiters, which are used to add readability to the code but are not required for it to execute. Minification reduces the size of the source code, making its transmission over a network (e.g. the Internet) more efficient. -- Wikipedia
You can use external modules to do the same, this becomes more useful with aggregation and compression. e.g. Minify JS
Optimize Image and Styles
Drupal has inbuilt system for optimizing image while presenting them to the visitor of the site. This allows many things like using different size or resolution of images for different screen or display etc. You should learn how to use this function in Drupal to improve upon loading time of pages as usually images take most time to load.
This section is accessible under Administration > Configuration > Media > Image styles
Use the Right PHP Version
Make sure to choose or set the right version of PHP that is required by the Drupal version you are using. Not having the right version can cause decreased performance or may render you site useless. You can check this on the Drupal site at https://www.drupal.org/docs/getting-started/system-requirements/php-requirements
You can also check the install.txt available in the Drupal package.
Keep Drupal Core and Modules and Themes Updated
Drupal community continuously take efforts to make sure that the core, module and themes are in best state. Keeping up to date with latest releases not only keeps your Drupal based site secure but many a time it improves upon performance of site also.
Following the specified basic steps can improve a lot on the speed performance of your Drupal based site. There are many other aspects that you can look for are
Suitable hosting solutions or hosting solutions specific for Drupal
Optimizing Databases
Using Content Delivery Networks
and many more possibilities are there, which we will discuss in some other post.