// Memcache settings
$settings['cache']['default'] = 'cache.backend.memcache';
$settings['memcache']['key_prefix'] = 'nfb_drupal_';
$settings['memcache']['memcached_servers'] = [
'127.0.0.1:11211' => '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.
IMPORTANT:
- Always enable module first, then add configuration. Otherwise site will crash.
- 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
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
get foo
VALUE foo 0 2
hi
END
stats
STAT pid 8861
(etc)
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.