Basic mod_pagespeed, shared memory, memcached question

388 views
Skip to first unread message

Brian Hagan

unread,
Sep 1, 2016, 6:22:09 PM9/1/16
to mod-pagespeed-discuss
Hi, I have mod_pagespeed running and I am setting up memcached cluster. There are four apache instances with the same MPS configuration.

I've been looking through the system integration documentation and I can't really find a description of how the memcached integration works. Does each apache create it's own cache on the cluster or do all of the instances share the metadata cache? Stated another way, are calculated results for one apache siloed or are they shared across the instances through memcache?

There is also the idea of having one memcached per apache (not clustered), but this seems to me to be no different than the shared memory cache. Is this correct?

I'd love a pointer to any other documentation on how MPS uses the different levels of caches and especially how it uses memcached.

Thanks in advance!

Egor Suvorov

unread,
Sep 6, 2016, 4:55:39 PM9/6/16
to mod-pagesp...@googlegroups.com, Jeff Kaufman
+jefftk for confirmation.

As far as I know, all Apache instances use memcached in exactly the same way if configured equally, i.e. they share metadata cache. Default configuration when both shared memory cache and memcached are enabled is as follows: all writes go to both shared memory and memcached, reads are first performed from shared memory and then from memcached (if the former yielded no results).

Yes, if you have separate memcached per each apache, then it's equivalent to having shared memory cache only (with extra latency on cache reads because mod_pagespeed will have to ask two caches to find out something is not in the cache).

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/ca1a74d2-b7ad-41ff-bd54-eea4135070c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Best regards,
Egor Suvorov.

Joshua Marantz

unread,
Sep 6, 2016, 8:25:15 PM9/6/16
to mod-pagespeed-discuss, Jeff Kaufman
FWIW I wrote a blog post about how caching works in MPS sometime ago.  It's not 100% accurate now but I think it can help with general understanding:


More comments inline:

On Tue, Sep 6, 2016 at 4:55 PM, 'Egor Suvorov' via mod-pagespeed-discuss <mod-pagesp...@googlegroups.com> wrote:
Yes, if you have separate memcached per each apache, then it's equivalent to having shared memory cache only (with extra latency on cache reads because mod_pagespeed will have to ask two caches to find out something is not in the cache).
 
Another important difference is that memcached helps implement the HTTP cache and Property cache, as well as the metadata cache.  You don't really have a fully functional system with shared-memory cache only, it would need a file-cache as an L2, or mod_pagespeed will refuse to start.

It's true that miss-latency will be include the latency of memcached in addition to the shared-memory cache, but so will the hit-rate, compared with a SHM-cache backed by a file-cache, so they'll be fewer misses.  This is because we (as a matter of policy) always write through to the memcached but whether we write-through to a file-cache is dependent on configuration.

On Thu, Sep 1, 2016 at 6:22 PM, Brian Hagan <bbh...@gmail.com> wrote:
Hi, I have mod_pagespeed running and I am setting up memcached cluster. There are four apache instances with the same MPS configuration.

I've been looking through the system integration documentation and I can't really find a description of how the memcached integration works. Does each apache create it's own cache on the cluster or do all of the instances share the metadata cache? Stated another way, are calculated results for one apache siloed or are they shared across the instances through memcache?

shared.

-Josh

Brian Hagan

unread,
Sep 7, 2016, 1:10:56 PM9/7/16
to mod-pagespeed-discuss, jef...@google.com
Great, thanks, that helps a lot. This link off of the blog

This link off of the blog also helps explain:

Otto van der Schaaf

unread,
Sep 9, 2016, 8:35:53 AM9/9/16
to mod-pagesp...@googlegroups.com

You can use memcached to share computed optimization results across multiple pagespeed-enabled webservers.

Otto


--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages