memcached and on disk cache ... How do they play together?

211 views
Skip to first unread message

Nigel Aves

unread,
Sep 1, 2020, 12:17:40 AM9/1/20
to mod-pagespeed-discuss
I was looking into using memcached, but apart from the below comment, I can not find any information on how the disk cache and memcached play together. 

"memcached or redis may be used as a scalable network-accessible cache in addition to the file cache. The file cache is always required, since PageSpeed has a few things it needs to store locally."

I'm also a bit confused as to what happens after a reboot. With the LRUcache you can get a memory dump automatically (by time) and that will be reloaded on a system reboot. But I cannot find a setting that allows you to do something similar with memcached.

As a note. My file cache is in its own partition on a M.2 NVMe SSD. 

Any pointers would be gratefully received. 

Longinos

unread,
Sep 1, 2020, 3:20:13 AM9/1/20
to mod-pagespeed-discuss
Hi
For example:
Memcached has a max size for stored objects (default to 1Mb) and objects (mostly images) that are bigger than that max size are stored in disk cache.
Pagespeed don´t care on how the underliying database works, if memcached can or can´t have a way to persist between restart, that is a DB work. Memcache, as far I can see have a way to do persistence between restart in version 1.5.18 or newer but I don´t know how it works. Redis has a way to save data to disk and it load these data at restart, and have no max size limit for the stored objects.
In the same way, pagespeed don´t care on how the objects where evicted from the database, is a DB work, you must configure it to do some LRU or other algo to evict objects.

Joshua Marantz

unread,
Sep 1, 2020, 10:26:17 AM9/1/20
to mod-pagespeed-discuss
When you use memcached with PageSpeed, the cached optimized files need to be recomputed on reboot. Everything that it stores is recomputable, so there is no loss of data functionally, but the server will have to re-optimize all the images after reboot, which it will do on-demand, in the background, based on traffic.

Files that are too large for memcached (mostly large images) are stored on disk, as is some meta-data needed for PageSpeed to handle resources accsssed via LoadFromFile.

If you use redis there are options you can configure in redis to use the disk as a backing-store for the in-memory cache. This means that on a reboot, less re-optimization will be needed. The cost is that redis must do more work than memcached during operation, but I haven't measured how impactful that is.

-Josh
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/e98057a0-aad0-41ad-85a6-8a234290c888n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages