3

After successfully enabling it, how do you know it's working? And how do you know how much better performance is increased?

In homepage of https://www.drupal.org/project/memcache it says:

  • A module that provides a comprehensive administrative overview of Drupal's interaction with Memcached and stats.
  • A set of tests that can be run to test your memcache setup.

But there is nothing for Drupal 8.

If you read docu http://cgit.drupalcode.org/memcache/tree/README.txt?h=8.x-2.x there is no information how to test/confirm memcache is doing its job.

It shows in Status report it's enabled. Memcached version 3.0.0 But how do you know it's not just hanging around or idling?

Anyway, I read the 7.x docu and it had this:

## CACHE HEADER ##

Drupal core indicates whether or not a page was served out of the cache by
setting the 'X-Drupal-Cache' response header with a value of HIT or MISS. If
you'd like to confirm whether pages are actually being retreived from Memcache
and not another backend, you can enable the following option:

  $conf['memcache_pagecache_header'] = TRUE;

So I put in $settings['memcache_pagecache_header'] = TRUE;, but I don't see anything in my Network tab of Firefox's dev tools. All I see is X-Drupal-Cache UNCACHABLE with or without the setting.

  • 1
    Sounds like you have page cache turned off. If you do, memcache will make no difference - at least as far as page caching is concerned. – Alfred Armstrong Feb 13 '17 at 14:17
  • You mean in admin/config/development/performance? I set it to 1 minute and no result. – user3108268 Feb 13 '17 at 14:45
  • Are you testing while logged in? – Alfred Armstrong Feb 13 '17 at 15:09
  • as Anonymous cache shows 'MISS' – user3108268 Feb 13 '17 at 15:30
1

You can enable the memcache_admin module and this will provide a stats page at /admin/reports/memcache, where you can see the number of sets and gets, hits and misses percentages and how much of the allocated memory is in use.

On the server, you can run this from the command line (assuming port 11211):

echo stats | nc 127.0.0.1 11211
4

The easiest things is:

  • Take a backup of your site.
  • Take another backup. :)
  • TRUNCATE your cache tables in the database.
  • Restart memcache.
  • Clear caches, so dome page requests.
  • Make sure caches that should be in memcache aren't in the database.
  • Make sure caches that should be in memcache are actually there (use the CLI), check keys, and check stats

As for performance, that is beyond the scope of this site. You need to properly profile your site. And to do that properly, means optimizing everything else so you can properly gauge the impact of memcache.

  • PHP Warning: Memcached::getMulti() expects at most 2 parameters, 3 given in htdocs/modules/memcache/src/DrupalMemcached.php on line 80 – user3108268 Feb 13 '17 at 16:11
  • 1
    Should be the accepted answer – Renrhaf Jan 24 '18 at 22:19
  • I thought if I stop mysql server then reloading a page available in memcache should work. But when I stopped it, it actually did not work. So not sure if it's working properly. – user5858 Feb 5 '18 at 2:35
  • memcache does not replace the db altogether, it just provides a (sometimes) faster alternative for the cache tables. – Alfred Armstrong Sep 2 '18 at 17:13

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.