Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,148,825 members, 7,802,631 topics. Date: Friday, 19 April 2024 at 05:50 PM

How To Optimize Your Drupal Website - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / How To Optimize Your Drupal Website (347 Views)

5 Powerful Steps To Optimize Your Website On Google Search / Drupal Website Developer Needed / How To Integrate Bulk SMS To Work In Drupal Website? (2) (3) (4)

(1) (Reply)

How To Optimize Your Drupal Website by todhost(m): 5:00am On Oct 25, 2018
Read full article at:: https://www.todhost.com/knowledgebase/845/How-to-optimize-your-Drupal-website.html

In this tutorial, we examine the fundamental optimization steps required to enhance the performance of your Drupal website.

Drupal is a powerful content management system designed for rugged performance. A Drupal website that is well-optimized for performance can handle several million visits each day. That had been one of the advantages going for Drupal.

There are several ways to configure Drupal for optimal performance. These include optimizing MySQL, implementation of a Content Delivery Network (CDN), 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.


This post is more of checklist of performance optimization good for a Drupal website. Here are the recommended steps:

1. Update core module, contribs module, and themes of Drupal site

You always want to keep the core, contribs module, and themes updated.
a. To run updates, navigate to “Reports” → “Available Updates”
b. Click on “Check manually” to scan for additional updates

2. Use 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

Caching is fundamental to improving the speed performance in Drupal. Drupal provides caching options. This is probably the easiest way to speed up Drupal performance on your site.

a. Page Caching

To enable caching, navigate to Configuration → Development→ Performance
Enable “Cache pages for anonymous users” and also “Cache blocks.” You can then choose a time for minimum cache lifetime and expiration of cached pages.

b. 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” and click on “Apply (all displays)”

c. PHP Caching

PHP Cache (APC) is well-known to increase the speed of Drupal installs. Add the below code .htaccess to enable PHP caching

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
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
</IfModule>
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 30 seconds"
ExpiresByType text/html "access plus 15 days"
ExpiresByType image/gif "access plus 1 months"
ExpiresByType image/jpg "access plus 1 months"
ExpiresByType image/jpeg "access plus 1 months"
ExpiresByType image/png "access plus 1 months"
ExpiresByType text/js "access plus 1 months"
ExpiresByType text/javascript "access plus 1 months"
</IfModule>

Here are some other caching options that can be used to improve the performance of the Drupal website.

d. Memcache
e. File Cache
f. Redis
g. Boost (turns all Drupal pages into flat HTML files)

4. Optimize Your Images

You can change the compression ratio of an image. By default in Drupal 7, it is set to 75%.
1. To change the ratio, navigate to Configuration → Image toolkit
2. You can then change the % amount and click on “Save configuration"

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

6. 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”

You can also use advagg module to simplify advanced aggregation of CSS/JS

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

a. 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
b. 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.
c. Use AutoSlave module for master and slave database

$databases['default']['default'] = array (
'driver' => 'autoslave',
);

$databases['default']['master'] = array (
'database' => 'mydb',
'username' => 'username',
'password' => 'password',
'host' => 'master.example.com',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
);

$databases['default']['autoslave'] = array (
'database' => 'mydb',
'username' => 'username',
'password' => 'password',
'host' => 'slave.example.com',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
);

// Use locking that supports force master

$conf['lock_inc'] = 'sites/all/modules/autoslave/memcache-lock.inc';

// Use AutoSlave transactional safe cache wrapper with a memcache backend

$conf['cache_backends'][] = 'sites/all/modules/autoslave/autoslave.cache.inc';
$conf['cache_default_class'] = 'AutoslaveCache';
$conf['autoslave_cache_default_class'] = 'MemCacheDrupal';

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.

Read full article at:: https://www.todhost.com/knowledgebase/845/How-to-optimize-your-Drupal-website.html

(1) (Reply)

I Need Verified Or Unverified Adsense Account(urgent) / Web Based Tyre Mgt Software For Logistics Companies / HY9JA - SHARE EVERYTHING (social Media)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 24
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.