How to speed up my Drupal website with Memcached

I noticed the Memcached button in cPanel. How can I speed up my Drupal website with Memcached?

Todd Lewis Asked on October 21, 2015 in Drupal.
Add Comment
1 Answer(s)
Best answer

In this guide, we are going to go over how you can configure your Drupal application to work with Memcached by using our proprietary Memcached tool which is available in your CPanel.

The first thing that you would need to do is to access your CPanel with us, as the tools that we are going to use are located within, you can do so from your client area with us, by using the buttons which are shown in the following screenshots :

RE: How to speed up my Drupal website with Memcached RE: How to speed up my Drupal website with Memcached

If for some reason you are unable to access your CPanel, you can submit a ticket to our Genious Support Team, which is available 24/7.

After you have accessed your CPanel, you need to make sure that the “Memcached” PHP extension has been enabled for your hosting account, you can do so from the “Select PHP version” tool which is located in your CPanel, once in there just make sure that the box next to the aforementioned PHP extension has been ticked.

RE: How to speed up my Drupal website with Memcached RE: How to speed up my Drupal website with Memcached

After this has been sorted out you would have to create a Memcache instance by using the “Memcached” tool, once in there you can select the name of your instance its size and whether it uses a socket or TCP/IP connection, for Drupal you would need to select the TCP/IP option, once you have created it please take note of the IP and Port that you will be provided with since we would need them later on.

RE: How to speed up my Drupal website with Memcached RE: How to speed up my Drupal website with Memcached RE: How to speed up my Drupal website with Memcached

Once you have completed the above-provided steps, you would need to download and install the “Memcache Storage” and “Memcache API and Integration” modules, you can download them from the following links:

https://www.drupal.org/project/memcache
https://www.drupal.org/project/memcache_storage

RE: How to speed up my Drupal website with Memcached

When the aforementioned modules have been installed you would need to add the following lines of code to the settings.php file of your Drupal installation:

$conf[‘cache_backends’][] = ‘sites/all/modules/memcache/memcache.inc’;
$conf[‘lock_inc’] = ‘sites/all/modules/memcache/memcache-lock.inc’;
$conf[‘memcache_stampede_protection’] = TRUE;
$conf[‘cache_default_class’] = ‘MemCacheDrupal’;
$conf[‘cache_class_cache_form’] = ‘DrupalDatabaseCache’;
$conf[‘page_cache_without_database’] = TRUE;
$conf[‘page_cache_invoke_hooks’] = FALSE;
$conf[‘memcache_servers’] = array(‘Server:Port’ => ‘default’);

Please keep in mind that you would need to replace the “IP:Port” part with the IP and port which have been provided in the second step of this tutorial, after you have made the changes, the added code should look like this:

$conf[‘cache_backends’][] = ‘sites/all/modules/memcache/memcache.inc’;
$conf[‘lock_inc’] = ‘sites/all/modules/memcache/memcache-lock.inc’; $conf[‘memcache_stampede_protection’] = TRUE;
$conf[‘cache_default_class’] = ‘MemCacheDrupal’;
$conf[‘cache_class_cache_form’] = ‘DrupalDatabaseCache’;
$conf[‘page_cache_without_database’] = TRUE;
$conf[‘page_cache_invoke_hooks’] = FALSE;
$conf[‘memcache_servers’] = array(‘127.0.0.1:27009’ => ‘default’);

You can edit the settings.php file either by downloading the file over FTP and changing it and then re-uploading it, or you can carry out the changes through the “Edit” option which is available in your “File Manager” tool, you can use this by right-clicking on the selected file and choosing the “Edit” option.

Once all of the above-mentioned actions have been taken, your website would be enjoying the benefits of Memcached.

James Flynn Answered on October 21, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.