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:
- Activate a Redis instance on the hosting package in question via your control panel.
- 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
- Install Predis via git from the SSH jail:
- Open https://github.com/nrk/predis in a web browser.
- Copy the contents of the field HTTPS clone URL in your clipboard.
- Now enter the following command:
git init git clone **paste from clipboard**
- There will be now a Predis directory in www/sites/all/libraries/
- 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';
- Afterwards test the connection to the Redis server from the SSH jail.How you do this:
- 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.
- 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
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:
To see if the database grows when you click around the site give you the following command:
You can leave the Redis-cli using CTRL + C
You’ll find a list of the commands on the Redis site