Memcache cluster with Cacherouter

Events happening in the community are now at Drupal community events on www.drupal.org.
james_agnew's picture

Hello

We have four load-balanced Apache servers (Ap1, Ap2, Ap3, Ap4) all pointing to a single MySQL server master server, which has a single Slave. We are running Pressflow 6.14.

What I'd really appreciate some advice on please is how best to configure Memcache and which module (cacherouter or memcache) I should use.

My thought was to create indentical bins on all 4 servers, something like this (Ap1,2,3,4 etc would be replaced by IP addresses):

<?php
$conf
['cache_inc'] = './sites/all/modules/contrib/cacherouter/cacherouter.inc';
$conf['cacherouter'] = array(
 
'default' => array(
   
'engine' => 'memcache',
   
'server' => array('Ap1:11211', 'Ap2:11211', 'Ap3:11211', 'Ap4:11211'),
   
'shared' => FALSE,
   
'prefix' => '',
   
'static' => FALSE,
   
'fast_cache' => TRUE,
  ),
 
'cache_block' => array(
   
'engine' => 'memcache',
   
'server' => array('Ap1:11212', 'Ap2:11212', 'Ap3:11212', 'Ap4:11212'),
   
'shared' => FALSE,
   
'prefix' => '',
   
'static' => FALSE,
  ),
 
'cache_content' => array(
   
'engine' => 'memcache',
   
'server' => array('Ap1:11213', 'Ap2:11213', 'Ap3:11213', 'Ap4:11213'),
   
'shared' => FALSE,
   
'prefix' => '',
   
'static' => FALSE,
  ),
 
'cache_filter' => array(
   
'engine' => 'memcache',
   
'server' => array('Ap1:11214', 'Ap2:11214', 'Ap3:11214', 'Ap4:11214'),
   
'shared' => FALSE,
   
'prefix' => '',
   
'static' => FALSE,
  ),
 
'cache_form' => array(
   
'engine' => 'memcache',
   
'server' => array('Ap1:11215', 'Ap2:11215', 'Ap3:11215', 'Ap4:11215'),
   
'shared' => FALSE,
   
'prefix' => '',
   
'static' => FALSE,
  ),
 
'cache_menu' => array(
   
'engine' => 'memcache',
   
'server' => array('Ap1:11216', 'Ap2:11216', 'Ap3:11216', 'Ap4:11216'),
   
'shared' => FALSE,
   
'prefix' => '',
   
'static' => FALSE,
  ),
 
'cache_page' => array(
   
'engine' => 'memcache',
   
'server' => array('Ap1:11217', 'Ap2:11217', 'Ap3:11217', 'Ap4:11217'),
   
'shared' => FALSE,
   
'prefix' => '',
   
'static' => FALSE,
   
'fast_cache' => TRUE,
  ),
);
?>

So, if someone updates the content of a page via Ap2, let's say, what are the actual chain of events that ensure that the memcache data for that page (pre-edit) is cleared and replaced by the new page content? is Cacheouter writing the same data to the cache_content bin on all 4 servers? or does it marshal requests for that page to go to the single server that hold the key for that specific data set?

I think the part I'm not clear on is whether the same bin (e.g. cache_content) on all servers would have the same keys (mirrored cache) allowing a web server to read from its own memcache bins (running on localhost) to benefit from the reduced network latency compared with having to shoot over to another server to get cached data from memcache.

Any help to clear this up for me would be much appreciated.

Thanks, James

Comments

OT but I just created an

Jamie Holly's picture

OT but I just created an issue for cacherouter-rc1 about the documentation. You need to change 'server' to 'servers' or else it will only connect to localhost:11211.


HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.

intoxination, I just spent a

nublaii's picture

intoxination, I just spent a whole day trying to figure out why the )(/%&/&$)(/& it wouldn't work when I found you comment about the 'servers' instead of 'server'... tnx ;)

Is this Cacherouter

emcee0's picture

Is this Cacherouter configuration working for you? May I ask why you have SHARED set to FALSE instead of TRUE? Would you also be able to copy me what your STATS output looks like?

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: