Drupal Memcache Performance Statistics For Sessions And Data Caching: Taking The Full

Drupal memcache can have stunning improvements on server resources.

Assuming you are using memcache API module, there are certain not-so obvious steps you may need to perform to get your server behave nicely. In case, you need help installing memcache and memcache tools, check out the link.

One of our Drupal sites had immediate effects the moment memcache was installed and configured correctly as follows:

1) Using memcache.inc instead of memcache.db.inc in your $conf[‘cache_inc’]. If you are sure you need memcache, stop storing your tables completely on database.

‘./sites/all/modules/memcache/memcache.inc’, // or // ‘cache_inc’ => ‘./sites/all/modules/memcache/memcache.db.inc’, );
2) Configuring the necessary memcache instances and bins.

I typically run number of memcache instances 2 to 4 depending on my requirement.

‘./sites/all/modules/memcache/memcache.inc’, ‘memcache_servers’ => array(‘’ => ‘default’, ‘’ => ‘default’, ‘’ => ‘default’, ‘’ => ‘cluster2’, ‘’ => ‘cluster2’), ‘memcache_bins’ => array(‘cache’ => ‘default’, ‘users’ =>’cluster2, ‘cache_filter’ => ‘cluster2’), ); ?>
3) Storing Sessions with memcache.

This can be another important step for a high traffic site. Drupal stores sessions into database. Moving it to memcache is helpful. Following is how my settings.php would look like now.

$conf = array(
‘cache_inc’ => ‘modules/memcache/memcache.inc’,
‘session_inc’ => ‘modules/memcache/memcache-session.inc’,
‘memcache_servers’ => array(‘’ => ‘default’,
‘’ => ‘default’,
‘’ => ‘default’,
‘’ => ‘cluster2’,
‘’ => ‘cluster2’
‘session’ => ‘session’)


4) Now is the time to monitor your memcache if it is all working well. You should 100% hits.

Great. I did all of the above. Performance is great.

But, one last thing to be resolved, there is this error that pops up when we submit a form or upload an image:

“”An unrecoverable error occurred. This form was missing from the server cache. Try reloading the page and submitting again.” and the form dissapear.”
The solution seems to be to take out cache_form out from memcache (http://drupal.org/node/500646). Memcache module does not allow this. We had to do this using cache router module. More on this on another blog post.

Improvements we had with memcache are spectular with the changes above.

Given the same traffic on each day:

Picture 10

The results were as follows:


Picture 15

Memory Usage (typically the same):

Picture 11

CPU Usage:

Picture 14

Picture 13

Blog Uncategorized
Previous reading
Quick Tip: Drupal Sessions For Anonymous And Authenticated Users Using $_session
Next reading
Improving Mysql Performance For A High Traffic Drupal Site