Question

I am trying to understand what the role of Memcache is. A few of my friends who have been working with Drupal for more than a year tell me that Memcache would only work for logged in users, and I would have to look to Varnish or Boost for caching the content shown to anonymous users.

While I understand that varnish acts as a reverse proxy, and caches a copy of the page, I wanted to know if anonymous users make a request, and if varnish does not have a cached copy of it, would the webserver route the request to Memcache, or would the request directly go to the database?

Architecture example: Varnish/Boost, web server, Memcache, database.

Was it helpful?

Solution

In short, yes memcached will benefit both anonymous and authenticated visitors (even if you also use Varnish).

Memcached and Varnish operate at different layers. Varnish caches entire HTTP requests (and sometimes edge-side includes, but this is less common in the Drupal ecosystem). Memcached stores frequently used data within the application, and it is a replacement for the cache_* family of database tables.

Memcached will speed up anonymous requests when the Varnish cache misses or is bypassed.

OTHER TIPS

What memcache adds to the mix is in it's name. "Memory caching". That is, instead of writing certain cachebins to database and disc, it keeps a volatile cache in RAM. This makes both reading and writing much faster, but you also loose the cache in cache of, say a server reboot.

This certainly can help either, or both, or anonymous and authenticated users, but whether or not it does comes down to what you cache, which users use what data, and what cache bins you move to memcache.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top