Tag1 Consulting

Performance and Scalability Experts

Page-cache-memcache Lock

Description:
This patch should be applied to memcache after the pagecache_lock patch has been applied to Drupal core, preventing cache stampedes when updating pages in the Drupal page cache. Refer to the README for that patch for full details on how this patch works.

To use, you will need to create a 'cache_lock' bin in memcache. It can be shared with other caches so long as the bin is not ever flushed with a wild card. (For example, it can be shared with the 'session' and 'users' caches.) Here is a sample $conf array from settings.php:

    $conf = array(
      'cache_inc'   => 'sites/default/modules/memcache/memcache.inc',
      'session_inc' => 'sites/default/modules/memcache/memcache-session.inc',
      'memcache_servers'  => array(
        'localhost:11211' => 'default',
        'localhost:11212' => 'cluster2',
        'localhost:11213' => 'cluster3',
      ),
      'memcache_bins' => array(
        'cache'      => 'default',
        'session'    => 'cluster2',
        'users'      => 'cluster2',
        'cache_lock' => 'cluster2',
        'cache_page' => 'cluster3',
      ),
    ); 

Patch:
http://tag1consulting.com/patches#lock-memcache

Status:
This patch has not been merged into any release of Drupal.

Patch source:
http://drupal.org/node/230290
http://drupal.org/files/issues/pagecache_lock3.patch