1

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:

/**************************************************
 * MEMCACHE
 **************************************************/
// the path to the core cache file
include_once('./includes/cache.inc');
// the path to the memcache cache file
include_once('./sites/all/modules/memcache/memcache.inc');

$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

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'
);

etc.

  • 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 '13 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 '13 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. – Alfred Armstrong Apr 2 '13 at 16:29
  • Hmm ok - thanks for the help. I'll keep measuring and tuning. Maybe my bottleneck is somewhere else. – Brad Apr 2 '13 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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