Running seige (load tester) without memcache enabled I see stats similar to this:

Transactions:                    560 hits
Availability:                 100.00 %
Elapsed time:                  59.42 secs
Data transferred:               6.25 MB
Response time:                  1.56 secs
Transaction rate:               9.42 trans/sec
Throughput:                     0.11 MB/sec
Concurrency:                   14.71
Successful transactions:         543
Failed transactions:               0
Longest transaction:           10.57
Shortest transaction:           0.00

Notice that I'm getting about 560 transactions in 60 seconds, 9.42 trans/sec.

When I enable memcache (using the PECL memcache module) and re-run siege I see much worse performance:

Transactions:                    133 hits
Availability:                 100.00 %
Elapsed time:                  59.94 secs
Data transferred:               1.34 MB
Response time:                  6.43 secs
Transaction rate:               2.22 trans/sec
Throughput:                     0.02 MB/sec
Concurrency:                   14.27
Successful transactions:         129
Failed transactions:               0
Longest transaction:           12.22
Shortest transaction:           0.00

Notice that I've decreased my performance significantly. I was only able to process 133 hits in 60 seconds and the throughput is 2.22 transactions per second.

I have memcache setup on its own dedicated system with 4GB of RAM and here are the parameters: memcached -d -p 11211 -u memcached -m 2560 -c 2048 -P /var/run/memcached/memcached.pid

I noticed that if I go to /admin/reports/memcache I get the following PHP errors:

Notice: Undefined variable: stats in dmemcache_stats() (line 244 of /www/sites/all/modules/memcache/dmemcache.inc).
Warning: Invalid argument supplied for foreach() in dmemcache_stats() (line 244 of /www/sites/all/modules/memcache/dmemcache.inc).
Notice: Undefined variable: stats in dmemcache_stats() (line 263 of /www/sites/all/modules/memcache/dmemcache.inc).
There are no statistics being reported for this bin.

I'm not sure if that's related to the issue or not?

This is what I have in settings.php:

// the path to the core cache file
// the path to the memcache cache file

$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['memcache_servers'] = array(
        'memcache.domain.local:11211' => 'cluster'

$conf['memcache_bins'] = array(
        'bin1' => 'cluster'

$conf['memcache_key_prefix'] = 's-drupal';

Why is memcache slowing down my site instead of speeding it up? Would switching to PECL memcached help?

2 Answers 2


The errors on the stats page are due to an unrelated issue with memcache reporting. I think the problem you have is with the conf setup. I believe it should be like this for a default set up where all tables are mapped to the same bin:

$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['memcache_servers'] = array(
    'memcache.domain.local:11211' => 'default'

$conf['memcache_key_prefix'] = 's-drupal';

If that doesn't do the trick you can explicitly code the mappings for each table:

$conf['memcache_bins'] = array(
  'cache' => 'default',
  'cache_filter' => 'default',
  'cache_menu' => 'default'


  • That helped - sorta. The /admin/reports/memcache now loads without errors. And my seige stats look better. I'll post them separately. However Drupal + Memcache stats are almost exactly the same as Drupal - Memcache. So it doesn't seem like memcache is hurting or helping performance? Is there something else I need to do to?
    – Brad
    Apr 2, 2013 at 16:21
  • Transactions: 575 hits Availability: 100.00 % Elapsed time: 59.42 secs Data transferred: 7.74 MB Response time: 1.52 secs Transaction rate: 9.68 trans/sec Throughput: 0.13 MB/sec Concurrency: 14.70 Successful transactions: 560 Failed transactions: 0 Longest transaction: 11.02 Shortest transaction: 0.00
    – Brad
    Apr 2, 2013 at 16:21
  • 1
    A well-tuned database may perform as well as Memcache. It's not guaranteed to provide better performance under all circumstances. It'll depend on how your pages are built and what modules are loaded, network conditions and whatnot. There may well be other bottlenecks in your setup which mean no specific cache technology will make much difference. Apr 2, 2013 at 16:29
  • Hmm ok - thanks for the help. I'll keep measuring and tuning. Maybe my bottleneck is somewhere else.
    – Brad
    Apr 2, 2013 at 16:31
// Memcache settings
$settings['cache']['default'] = 'cache.backend.memcache';

$settings['memcache']['key_prefix'] = 'nfb_drupal_';
$settings['memcache']['memcached_servers'] =  [
        '' => 'default',
$settings['memcache']['bins'] = [
        'default' => 'default', // You can omit this config, because the "default" cluster will be used automatically for all cache bins which have no memcached cluster specified.

are the only settings I added to settings.local.php related to cache and our site is blazin'. We have sub-second full page render and download times on 100% drupal site. There are no static pages here. Clearing your browser cache doesn't seem to slow things down noticably.


  1. Always enable module first, then add configuration. Otherwise site will crash.
  2. Always remove configuration first, then disable module Otherwise site will crash.

Use firefox and go to www.nfb.org to see memcached in action.

For best results use firefox (best) or internet exploder. Chrome is slow.

An important note is that once you log in to Drupal, you're not using caching. Because of the nature of the drupal back end, by design, it doesn't get cached no matter what you do.

This is using the standard memcached module, not memcached_storage, which requires different configuration parameters.

Make sure you use a key prefix if you use memcached for other things besides drupal. For multiple drupal sites use a different key prefix for each site.

This has the effect of partitioning the cache entries and can improve things if you use memcached for multiple applications and/or drupal sites.

This should be obvious, but needs to be said because I don't believe in taking things for granted: Make sure you install memcached on your web server, enable the drupal module, and make sure you can connect to the port you specify in your configuration.

Go to memcached.org for documentation on how to do this.

I don't want to get replies like "This didn't work!" or "Now it's even slower!!!" because you didn't install memcached on your web server and configure it, turn the drupal module on, configure your firewall etc...

If you can't do this(make sure the telnet client is installed):

$ telnet localhost 11211
Connected to localhost.
Escape character is '^]'.
get foo
VALUE foo 0 2
STAT pid 8861

Your memcached setup is non-existent or somehow FUBAR.

Once installed, and site is browsed to build up the cache, if you telnet to memcached and type something like:

stats cachedump 3 0

You'll get something like:

stats cachedump 3 0
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-entity [14 b; 1579275863 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-config [14 b; 1579275863 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-default [14 b; 1579275863 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-bootstrap [14 b; 1579275863 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-menu [14 b; 1579275863 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-data [14 b; 1579275863 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-discovery [14 b; 1579275863 s]
ITEM nfb_civicrm_/56477c85410897a96440113a448cc752/ [13 b; 1579275863 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-page [14 b; 1579275863 s]
ITEM nfb_civicrm_/default/5e21d65b4e694/_562bb77fd2fe36b6298b8fbaf64e96d0 [6 b; 1579284982 s]
ITEM nfb_civicrm_/default/5e21d65b4e694/_874badf76040ef2c6208412eaade4b47 [6 b; 1579284982 s]
ITEM nfb_civicrm_/default/5e21d65b4e694/_aa342d4db4e895a354916ddc04f9f729 [6 b; 1579285468 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-advagg [14 b; 1579275863 s]
ITEM nfb_civicrm_/default/5e21d65b4e694/civicrm_event_2d2_2c3_2c4_2c5_2c6_2c7_2c8 [6 b; 1579285849 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-ultimate_cron_logger [14 b; 1579275863 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-signal [14 b; 1579275863 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-toolbar [14 b; 1579275863 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-discovery_migration [14 b; 1579275863 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-migrate [14 b; 1579275863 s]
ITEM nfb_drupal_%3Amemcache_bin_timestamps%3A-file_mdm [14 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-entity [14 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-config [14 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-discovery [14 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-bootstrap [14 b; 1579275863 s]
ITEM nfb_civicrm_/e3ecf972619e5cbbb8bf1575d46fae1a/ [13 b; 1579275863 s]
ITEM nfb_civicrm_/default/5e21d65b4e694/_711c488064b6de06070ddaddf44ee52b [6 b; 1579285613 s]
ITEM nfb_civicrm_/settings/5e21d65b50b71/defaults_contact [6 b; 1579283816 s]
ITEM nfb_civicrm_/default/5e21d65b4e694/_f1e6cd34c98d835e6603900708b8c94f [6 b; 1579284487 s]
ITEM nfb_civicrm_/default/5e21d65b4e694/_0903da7f623c9a608a28bb3e3b05012e [6 b; 1579284487 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-toolbar [12 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-page [12 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-migrate [14 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-dynamic_page_cache [14 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-content [14 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-render [14 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-menu [14 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-discovery_migration [14 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-data [14 b; 1579275863 s]
ITEM actionfund_drupal_%3Amemcache_bin_timestamps%3A-default [14 b; 1579275863 s]

That's how you know it's working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.