8 Tips for Optimizing Drupal

At times, Drupal can be quite a resource hog. Especially if you have hundreds or thousands of visitors on your website. That is why optimizing your Drupal site is an important task. Here's some basic optimizing tips for those who need it.


1. Disable unused modules

Go to http://yourdrupalsite.com/admin/modules and disable all the modules that you don't need. Uninstalling them can help too, but beware, this also removes the tables this module uses, so there's no way to recover database data that you have made earlier using this module.

2. Install DB Maintenance-module

This module can be found at http://drupal.org/project/db_maintenance. This module optimizes your databases during your cron-runs. Mostly the effect is small, but in the long run, it's good to have.

3. Remove content you don't need

This includes nodes, users etc which you don't need anymore. These types of content will fill your database with unnecessary data, which is good to remove once in a while.

4. Aggregate your JavaScript and CSS files

You can do this by going to http://yourdrupalsite.com/admin/config/development/performance. This page has a ton of optimization settings, so you should read through them all. Most important thing is under "Bandwidth Optimization". You should check as many of these as you can.

5. Use Memcached

Memcached is a bit of an advanced solution for optimizing your website, but for some people it is necessary. The Drupal module can be found at http://drupal.org/project/memcache. It has a ton of settings, so you should carefully read the documentation before using this module.

6. Tune your MySQL

If you are using MySQL as your database and you have access to your my.cnf, you should definitely download and run MySQL Tuning Primer Script. This script will analyze your database and recommend you in plain english which values in my.cnf you should change. This can lead to great performance boosts.

7. Avoid using PHP Code in your blocks and nodes

Using PHP Code in fields can have some performance drawbacks. The code is first fetched from the website, then it is executed by PHP. In this way, the code is never cached by accelerators or other caches. It can also be slower to execute than "normal" code.

8. Log your site with Devel-module

Using the Performance Logging in Devel-module, log some basic page actions. Analyze the data and look for what queries are taking the longest to process. Try to think of how to optimize these or if you can find another module which does the same job with better performance.


Jack's picture
Sun, 07/06/2014 - 15:28

I would also recommend running the Google PageSpeed tool to see what is the bottleneck on your site.

Add new comment