Image caching question/problem?

153 views
Skip to first unread message

Greg T

unread,
May 31, 2016, 3:36:00 AM5/31/16
to ngx-pagespeed-discuss
Hi There,

I'm somewhat new to pagespeed, and I'm having a small issue with the images and favicon not being written to cache with the following message
[Tue, 31 May 2016 07:23:40 GMT] [Info] [5762] Trying to serve rewritten resource in-place: http://www.xxx.com/favicon.ico
[Tue, 31 May 2016 07:23:40 GMT] [Info] [5762] Cache entry is expired: http://www.xxx.com/favicon.ico (fragment=xxx.com)
[Tue, 31 May 2016 07:23:40 GMT] [Info] [5762] Could not rewrite resource in-place because URL is not in cache: http://www.xxx.com/favicon.ico
[Tue, 31 May 2016 07:23:41 GMT] [Info] [5762] Trying to serve rewritten resource in-place: https://www.xxx.com/favicon.ico

I'm running Nginx 1.8.1 and PHP 7 with ngx_pagespeed 1.11.33

I've ran www.xxx.com/?PageSpeedFilters=+debug and this is the output
<!--
mod_pagespeed on
Filters:
ah	Add Head
cw	Collapse Whitespace
cc	Combine Css
jc	Combine Javascript
gp	Convert Gif to Png
jp	Convert Jpeg to Progressive
jw	Convert Jpeg To Webp
mc	Convert Meta Tags
pj	Convert Png to Jpeg
ws	When converting images to WebP, prefer lossless conversions
db	Debug
dj	Defer Javascript
ec	Cache Extend Css
ei	Cache Extend Images
es	Cache Extend Scripts
fc	Fallback Rewrite Css 
if	Flatten CSS Imports
hw	Flushes html
ci	Inline Css
ii	Inline Images
il	Inline @import to Link
ji	Inline Javascript
idp	Insert DNS Prefetch
id	Insert Image Dimensions
js	Jpeg Subsampling
ll	Lazyload Images
rj	Recompress Jpeg
rp	Recompress Png
rw	Recompress Webp
rc	Remove Comments
ri	Resize Images
cf	Rewrite Css
jm	Rewrite External Javascript
jj	Rewrite Inline Javascript
cu	Rewrite Style Attributes With Url
cp	Strip Image Color Profiles
md	Strip Image Meta Data

Options:
AvoidRenamingIntrospectiveJavascript (aris) True
EnableCachePurge (euci) True
FileCacheCleanIntervalMs (afcci) 3600000
FileCacheInodeLimit (afcl) 500000
FileCacheSizeKb (afc) 102400
RewriteLevel (l) Core Filters
Statistics (ase) True
StatisticsLogging (asle) True

#NumFlushes            0
#EndDocument after     7601us
#Total Parse duration  2546us
#Total Render duration 52722us
#Total Idle duration   5055us
No critical images detected.
The following filters were disabled for this request:
	Lazyload Images
-->

Here's part of the pagespeed config file.
pagespeed LogDir /var/log/pagespeed;

pagespeed FileCachePath              "/var/cache/pagespeed/";
pagespeed FileCacheSizeKb            102400;
pagespeed FileCacheCleanIntervalMs   3600000;
pagespeed FileCacheInodeLimit        500000;

# PageSpeed Admin
pagespeed StatisticsPath /ngx_pagespeed_statistics;
pagespeed MessagesPath /ngx_pagespeed_message;
pagespeed ConsolePath /pagespeed_console;
pagespeed AdminPath /pagespeed_admin;

    pagespeed Domain http*://www.xxx.com;
    pagespeed Domain www.google-analytics.com;
    pagespeed Domain fonts.googleapis.com;

    pagespeed Statistics on;
    pagespeed StatisticsLogging on;

    pagespeed EnableFilters convert_gif_to_png;
    pagespeed EnableFilters insert_image_dimensions;
    pagespeed EnableFilters lazyload_images;

pagespeed EnableFilters rewrite_images;
pagespeed EnableFilters convert_jpeg_to_progressive,convert_png_to_jpeg,convert_jpeg_to_webp,convert_to_webp_lossless;

    pagespeed EnableFilters collapse_whitespace;
    pagespeed EnableFilters remove_comments;
    pagespeed EnableFilters flatten_css_imports;

    pagespeed EnableFilters insert_dns_prefetch;
    pagespeed EnableFilters extend_cache;

    pagespeed EnableFilters defer_javascript;

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
       log_not_found off;
       access_log off;
       add_header ETag "";
       add_header Cache-Control "public, max-age=600";
    }
 

What am I doing wrong? I'm running magento and wordpress on the system. Let me know if you need more information.

Cheers,
Greg.

Otto van der Schaaf

unread,
May 31, 2016, 5:49:21 AM5/31/16
to ngx-pagespeed-discuss
The "Cache entry is expired: ..." message you posted are informational, and does not indicate a problem unless it occurs very frequently for the same resource.
How often are you getting it? Looking at the configuration you posted I guess that you will see the message for favicon.ico about every 10 minutes, because that is what the resource gets served with with regard to cache-control. If you are seeing it more often, it may be that your cache is too small.

Otto

Greg T

unread,
May 31, 2016, 10:26:56 AM5/31/16
to ngx-pagespeed-discuss
Hi Otto, Thanks for the quick response.

I'm getting the message, even after recent failure.
HTTPCache key=http://www.xxx.com/favicon.ico fragment=xxx.com: remembering recent failure for 222 seconds

Even when I purge the cache, and reload the pagespeed_admin, the favicon.ico still produces the error.

I've set the default shared pool to 500000 and still getting the error.
pagespeed DefaultSharedMemoryCacheKB 500000;

Do you think its a permission problem where pagespeed is trying to write to the file system?

Otto van der Schaaf

unread,
May 31, 2016, 10:35:37 AM5/31/16
to ngx-pagespeed-discuss
That specific message is also informational, and does not indicate a problem. 
Usually messages prefixed with [Info] are of no concern, and you can safely ignore them.

In this case, the message means that pagespeed has marked /favicon.ico as non-optimizeable in its cache and it should only retry after a little while (300 seconds usually).

Otto

Joshua Marantz

unread,
May 31, 2016, 10:48:13 AM5/31/16
to ngx-pagesp...@googlegroups.com
favicons are weird.  They get requested by browsers sometimes without any reference from your site, and you might not have one.  Then you get periodic messages about them from PageSpeed. No harm comes from this except periodic messages in your log.  But to have PageSpeed ignore them, add:
  pagespeed Disallow */favicon.*;

RE shared-memory cache: you have requested 500M.  That's probably OK, but I just want to make sure you are aware that this will be pre-allocated physical memory on your machine.  Make sure that your machine has plenty of memory beyond this to allow PageSpeed some room to do other transient operations, and for nginx to do all the other stuff it needs to do.

If your goal is to increase overall cache capacity, then you want to increase either the FileCache size or allocate a large memcached instance and configure that. Please see https://developers.google.com/speed/pagespeed/module/system for details.

-Josh

--
You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.
Visit this group at https://groups.google.com/group/ngx-pagespeed-discuss.
For more options, visit https://groups.google.com/d/optout.

Greg T

unread,
Jun 2, 2016, 8:50:43 AM6/2/16
to ngx-pagespeed-discuss
I think everything is working real sweet. Thanks Otto and Joshua for the help!
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-discuss+unsub...@googlegroups.com.

Joshua Marantz

unread,
Jun 2, 2016, 8:54:59 AM6/2/16
to ngx-pagesp...@googlegroups.com
You're welcome!  Let us know if there are more questions.

-Josh


To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.

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