How to increase the lifetime of the image cache in mod_pagespeed?

124 views
Skip to first unread message

Artem Kovalchuk

unread,
Apr 18, 2018, 2:07:57 PM4/18/18
to mod-pagespeed-discuss
According to pagespeed insign, there is a wish for optimization, the image cache as seen on the attached screenshot (5minets).

Below are the settings that I use for the domain (https://borjia-palazzo.ru/club):

ModPagespeed On

ModPagespeedForceCaching on




ModPagespeedFileCachePath "/var/cache/mod_pagespeed/"
ModPagespeedFileCacheInodeLimit      500000


ModPagespeedRewriteLevel CoreFilters
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters remove_comments
ModPagespeedEnableFilters move_css_to_head
ModPagespeedEnableFilters combine_css
ModPagespeedEnableFilters convert_meta_tags
ModPagespeedEnableFilters extend_cache
ModPagespeedEnableFilters inline_css
ModPagespeedEnableFilters inline_import_to_link
ModPagespeedEnableFilters inline_javascript
ModPagespeedEnableFilters rewrite_css
ModPagespeedEnableFilters rewrite_images
ModPagespeedEnableFilters rewrite_javascript
ModPagespeedEnableFilters rewrite_style_attributes_with_url
ModPagespeedEnableFilters lazyload_images
ModPagespeedEnableFilters add_head


# Additionnal filters
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters remove_comments
   
ModPagespeedFetchWithGzip on
SetOutputFilter DEFLATE


ModPagespeedInPlaceSMaxAgeSec 10
ModPagespeedHttpCacheCompressionLevel 9


ModPagespeedMessageBufferSize 100000
# Direct Apache to send all HTML output to the mod_pagespeed
# output handler.
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html

The actual question is how to increase the cache lifetime for images to increase the rating?



Joshua Marantz

unread,
Apr 18, 2018, 3:25:29 PM4/18/18
to mod-pagespeed-discuss
As Otto mentioned, this should probably be in the faq.  Cut & paste from a recent thread:

TL;DR: don't use PSI to determine whether MPS is working.  Use Chrome Dev Tools or webpagetest, because (a) too much caching (b) no user-agent control.

mod_pagespeed's webp transcoding only happens when there is an Accept:image/webp request header, which Pagespeed Insights unfortunately does not send.  So when mod_pagespeed sees the request from PSI it will optimize jpegs to progressive jpegs if there isn't already a fresh version in the server-side cache.  So if you are interactively using Chrome, you can visit your site and see the webp version, but those can't be sent to PSI. So mod_pagespeed will deliver the unoptimized view, while it re-optimizes the images in the background.  During this optimization process, mod_pagespeed sends short cache lifetimes so that proxy caches won't deliver the unoptimized view forever.

WIth PSI, the usability is confounded by a server-side results-cache in PSI, which may capture the unoptimized view from mod_pagespeed.  So you have to hit PSI a few times to let its results-cache expire, while hopefully mod_pagespeed's cache doesn't.

Artem Kovalchuk

unread,
Apr 18, 2018, 8:35:34 PM4/18/18
to mod-pagespeed-discuss
thanks jmarantz, i guessed that PSI does not see the webp...

среда, 18 апреля 2018 г., 22:25:29 UTC+3 пользователь jmarantz написал:

Joshua Marantz

unread,
Apr 18, 2018, 8:41:47 PM4/18/18
to mod-pagespeed-discuss
It's not just that...it's also that PSI sees an unoptimized result from mod_pagespeed, and then it caches it.

So you have to refresh a few times in PSI over a few minutes, in order to see the result optimized for PSI.


--
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/9ea33a38-96c9-42d9-b7c7-0514aaa3c273%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages