mod_pagespeed reoptimizing previously optimized images

60 views
Skip to first unread message

Nate W

unread,
Jan 24, 2017, 12:35:04 PM1/24/17
to mod-pagespeed-discuss
I have a CodeIgniter backed site where the same content is served with trivial variations from the one apache 2.2 instance. Let's say (www.)example.com and (www.)example2.co.uk. The server is configured to only serve via https (http requests return 301 to the https counterpart). The TLDs have their own vhost that are largely the same except for logging. The server sits behind an Apache reverse proxy. 

In each vhost I've set:
ModPagespeedCacheFragment same_fragment
ModPagespeedLoadFromFile "https://example.com/static/" "/var/www/static/"
ModPagespeedLoadFromFile "https://www.example.com/static/" "/var/www/static/"

While monitoring PageSpeed messages I see the same images periodically re-optimized, each time generating the exact same optimized url meaning that it should have been a cache hit and the image optimizer should have been skipped. The server is fairly resource constrained, so re-optimizing the images is relatively painful. I also see a very high number of file cache misses. 

Stats from the server after running 24 hours are here: http://pastebin.com/eLq8Xa9R

Also, is there anything other than the ModPagespeedCacheFragment directive that I need to specify so pagespeed knows to alias www.example.com with example.com since they are the exact same content? Any way to stop the image optimizer from running the same unchanged local file multiple times? 

Thanks!

Otto van der Schaaf

unread,
Jan 25, 2017, 3:51:54 AM1/25/17
to mod-pagespeed-discuss
Could your cache be configured too small? Maybe the images that are being re-optimized have been evicted earlier from the cache to make space for others. 

file_cache_hits 7328    1
file_cache_inserts  6198    1
file_cache_misses   28454   1

Could you increase the configured cache sizes?:

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/82529b4e-4d0e-4f3c-9651-604101938392%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nate W

unread,
Jan 25, 2017, 9:12:26 AM1/25/17
to mod-pagespeed-discuss
Otto,

My cache size is set to 256MB, and I note:
file_cache_evictions 0 0

Does that not point to the cache being sufficiently sized?

Joshua Marantz

unread,
Jan 25, 2017, 9:32:23 AM1/25/17
to mod-pagespeed-discuss
Yes, it does.  But you also have this:

cache_expirations   1692    1

Those might be the images.  What's the cache max-age of your origin images?

-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-discuss+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/65f1c693-f87e-4eaf-9c4d-07a876c51049%40googlegroups.com.

Nate W

unread,
Jan 25, 2017, 10:15:12 AM1/25/17
to mod-pagespeed-discuss
Josh,

I was under the impression that the ModPagespeedLoadFromFile directive meant that header-related cache behavior went out the window and PageSpeed monitored the filesystem metadata to determine when the cache should be invalidated. 

Nonetheless I do not explicitly specify a max-age on images fetched via https. I have ModPagespeedImplicitCacheTtlMs set to 7 days and ModPagespeedLoadFromFileCacheTtlMs set to one month. 

Otto van der Schaaf

unread,
Jan 25, 2017, 10:54:12 AM1/25/17
to mod-pagespeed-discuss
Do you have statistics logging enabled? If so, can you email the file(s) to us?
 Maybe having a look at what happens with the stats over time clarifies things.

Otto

On Wed, Jan 25, 2017 at 4:15 PM Nate W <nwei...@gmail.com> wrote:
Josh,

I was under the impression that the ModPagespeedLoadFromFile directive meant that header-related cache behavior went out the window and PageSpeed monitored the filesystem metadata to determine when the cache should be invalidated. 

Nonetheless I do not explicitly specify a max-age on images fetched via https. I have ModPagespeedImplicitCacheTtlMs set to 7 days and ModPagespeedLoadFromFileCacheTtlMs set to one month. 


On Wednesday, January 25, 2017 at 9:32:23 AM UTC-5, jmarantz wrote:
Yes, it does.  But you also have this:

cache_expirations   1692    1

Those might be the images.  What's the cache max-age of your origin images?

-Josh
On Wed, Jan 25, 2017 at 9:12 AM, Nate W <nwei...@gmail.com> wrote:
Otto,

My cache size is set to 256MB, and I note:
file_cache_evictions    0   0

Does that not point to the cache being sufficiently sized?

--
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.

--
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/c1e5c5fe-2627-4bad-8a72-1ac6aa90c8ee%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages