1. Home
  2. Knowledge Base
  3. Performance hosting with Drupal

Performance hosting with Drupal

This article is optimised for Drupal 7

Drupal is one of the most popular content management systems. It can handle small and large websites equally well, with a little optimization. This article will help you prepare your CMS to handle large traffic without losing on speed.

The first part of this article will show you standard optimization techniques, suitable for every hosting, even if you are not using the caching options.

Only when you have completed the general optimization, you can proceed to the second part of the article, which shows you how your CMS can benefit from the Performance hosting tools.

IN THIS ARTICLE:

Redis configuration

  1. Activate a Redis instance on the hosting package in question via your control panel.
  2. Install Redis via drush cli from the SSH jail. Navigate to the root (~/www/[drupal]/) directory and execute the following command:
    drush en -y redis
    

  3. Install Predis via git from the SSH jail:
    cd ~/www/[drupal]/sites/all/libraries/
    

    1. Open https://github.com/nrk/predis in a web browser.
    2. Copy the contents of the field HTTPS clone URL in your clipboard.
    3. Now enter the following command:
      git init
      
      git clone **paste from clipboard**
      

    4. There will be now a Predis directory in www/sites/all/libraries/
  4. Adjust settings.php by adding this code to the bottom of the file:
    nano ~/www/[drupal]/sites/default/settings.php
    
    $conf['redis_client_interface'] = 'Predis';
    $conf['redis_client_host'] = 'IP ADDRESS OF THE REDIS INSTANCE';
    $conf['redis_client_port'] = 'PORT OF THE REDIS INSTANCE';
    $conf['redis_client_password'] = 'PASSWORD OF THE REDIS INSTANCE';
    $conf['lock_inc'] = 'sites/all/modules/redis/redis.lock.inc';
    $conf['cache_backends'][] = 'sites/all/modules/redis/redis.autoload.inc';
    $conf['cache_default_class'] = 'Redis_Cache';
    


  5. Afterwards test the connection to the Redis server from the SSH jail.How you do this:
    1. The Redis-cli is now available on the shared SSH jails. It is necessary to reset the SSH to use them. Once this is done you can use the Redis-cli.
    2. In this example I use the IP 255.255.255.0; port 10000 and the password PASS

redis-cli -h THISISYOUREDISIPADDRESS -p THISISYOURREDISPORT
250.250.250.0:10000> AUTH THISISYOURREDISPASSWORD
OK

Execute

Now you can execute the Redis commands.

To see if keys are present on this Redis instance you give the following command:

 255.255.255.0:10000> keys *

To see how much MB are used for example you give the following command:

 255.255.255.0:10000> info

To see if the database grows when you click around the site give you the following command:

 255.255.255.0:10000> dbsize

You can leave the Redis-cli using CTRL + C


You’ll find a list of the commands on the Redis site

Updated on 15 June 2021

Was this article helpful?

Comments

Comments are closed.