Too busy to rewrite image + low cache hit rate: any advice ?

1,307 views
Skip to first unread message

Alterego D

unread,
Jan 10, 2017, 8:49:36 AM1/10/17
to mod-pagespeed-discuss
Dear mod_pagespeed community,

I've got a lot of "Too busy to rewrite image" messages in the admin console since we migrated on a new server some weeks ago with apache2.4 (previously 2.2) and mod_pagespeed 1.11.33.5-0 (previously 1.9.x.x);


Example: 


I also have low hit rates on file_cache and lru_cache compared to our previous setup (which had 70% hits on file_cache and 40% hits on lru_cache). 

Currently we have theses values:





Nothing changed in our web application (Magento CE 1.5) and our mod_pagespeed config is still the same also.

Here is our pagespeed config:

    ModPagespeed on
    ModPagespeedDomain *.alterego-design.com
    ModPagespeedDomain *.alterego-design.fr
    ModPagespeedDomain *.alterego-design.be
    ModPagespeedDomain *.alterego-design.nl

    ModPagespeedLoadFromFile "http://cloudfront.alterego-design.com/media/" \
                         "/var/www/html/prod/media/"
    ModPagespeedLoadFromFile "http://media.alterego-design.com/" \
                         "/var/www/html/prod/media/"
    ModPagespeedLoadFromFile "http://media.alterego-design.be/" \
                         "/var/www/html/prod/media/"
    ModPagespeedLoadFromFile "http://media.alterego-design.fr/" \
                         "/var/www/html/prod/media/"
    ModPagespeedLoadFromFile "http://media.alterego-design.nl/" \
                         "/var/www/html/prod/media/"
    ModPagespeedLoadFromFile "http://skin.alterego-design.com/" \
                         "/var/www/html/prod/skin/"
    ModPagespeedLoadFromFile "http://skin.alterego-design.be/" \
                         "/var/www/html/prod/skin/"
    ModPagespeedLoadFromFile "http://skin.alterego-design.fr/" \
                         "/var/www/html/prod/skin/"
    ModPagespeedLoadFromFile "http://skin.alterego-design.nl/" \
                         "/var/www/html/prod/skin/"
    ModPagespeedLoadFromFile "http://js.alterego-design.com/" \
                         "/var/www/html/prod/js/"
    ModPagespeedLoadFromFile "http://js.alterego-design.be/" \
                         "/var/www/html/prod/js/"
    ModPagespeedLoadFromFile "http://js.alterego-design.fr/" \
                         "/var/www/html/prod/js/"
    ModPagespeedLoadFromFile "http://js.alterego-design.nl/" \
                         "/var/www/html/prod/js/"

    ModPagespeedRewriteLevel  CoreFilters
    ModPagespeedEnableFilters insert_image_dimensions
    ModPagespeedEnableFilters insert_dns_prefetch
    ModPagespeedEnableFilters inline_images
    ModPagespeedDisableFilters convert_jpeg_to_webp,convert_to_webp_lossless,recompress_webp,recompress_webp

    ModPagespeedFileCachePath            "/var/www/cache/mod_pagespeed/"
    ModPagespeedCacheFragment alterego_cache_fragment_key
    ModPagespeedLogDir "/var/log/pagespeed"
    ModPagespeedCreateSharedMemoryMetadataCache "/var/www/cache/mod_pagespeed/" 1024000
  
    ModPagespeedFileCacheSizeKb          10192000
    ModPagespeedFileCacheCleanIntervalMs 36000000
    ModPagespeedLRUCacheKbPerProcess     10240
    ModPagespeedLRUCacheByteLimit        16384
    ModPagespeedFileCacheInodeLimit        5000000

    ModPagespeedEnableCachePurge on


Note: adding LoadFromFile didn't solve the "Too busy to rewrite" message. Also, the server load is never above 0.8 load average. So there is no real load on the server.

Extra questions:
  • Should I also enable memcached to store a part of the cache ? Or is Lru+sharedmemory+file_cache enough?
  • All my images have an .ic extension like this: xenzo_white_newsite_05.jpg.pagespeed.ic.XWdvxe76hb.jpg. Normally, shouldn't it be .ce (cache extended) ?
  • Are there any optimizations I can add to my config ?

Many thanks in advance for your answers.

Regards,

Timothy GERETS

Longinos

unread,
Jan 12, 2017, 3:50:54 AM1/12/17
to mod-pagespeed-discuss
Try this

Joshua Marantz

unread,
Jan 12, 2017, 8:30:35 AM1/12/17
to mod-pagespeed-discuss
Thanks for the detailed report with stats & config!  That really helps diagnose remotely.


ImageMaxRewritesAtOnce should indeed help with the" too busy" errors.

Your file cache hit rate might not be that bad for image resources. It might look bad because every URL visited on your site results in a property cache lookup to discover (e.g.) the set of above-the-fold images on example.com/?query=high_entropy_value .  This will naturally have a low cache hit rate, but that doesn't necessarily mean the system is behaving badly.

One thing that changed since your previous setup with higher cache hit rates was that in upgrading from 1.9 to 1.11 a few optimizations likely turned on by default.  I'd have to back to the release notes, but the above property-cache hit-rate impact might be caused by a change we made to use the property-cache to determine whether images were critical before we inline them.

I would recommend turning off the LRU cache, since you are enabling the shared-memory metadata cache.

It looks like your file-cache size is sufficiently large because you are not getting any evictions on your chart, though I'd check

Your specific questions:
  • Q: Should I also enable memcached to store a part of the cache ? Or is Lru+sharedmemory+file_cache enough?
  • A: If you have multiple servers then I think that'd be great. If you just have one server I think it won't make much difference to you.

  • Q: All my images have an .ic extension like this: xenzo_white_newsite_05.jpg.pagespeed.ic.XWdvxe76hb.jpg. Normally, shouldn't it be .ce (cache extended) ?
  • A: ".ce." means cache extended, which means we didn't change the resource contents; we just signed the URL to allow it to be cache-extended.
  • ".ic." means we actually optimized your image in addition to cache-extending it.

  • Q: Are there any optimizations I can add to my config ?
  • A: I think I'd start with checking out what webpagetest and PageSpeed Insights have to say about your site.
  • But the first thought that comes to me is to enable webp conversion. Is there a specific reason you turned it off?
  • Next I would check out prioritize_critical_css and lazyload_images.
Hope this helps!
-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+unsubscri...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/5a14b7b8-0e36-4307-8bff-bb0a86299d82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alterego D

unread,
Jan 12, 2017, 10:26:05 AM1/12/17
to mod-pagespeed-discuss
Hi Josh,

Many thanks for your answer. Really appreciate the time you took to write your recommandations.

I changed ImageMaxRewriteAtOnce to "-1". Problem fixed! I've no "Too busy to rewrite" messages anymore. I also disabled LRU cache as you recommanded.

Concerning webp, prioritize_critical_css and lazyload_images, unfortunately, I can't enable them because I use Varnish in front of Apache. Otherwise, I'll cache HTML optimizations that are browser specific ( and webp will break in firefox for example).

Other question:

I added an "0" at these values 2 weeks ago:
    ModPagespeedFileCacheSizeKb          10192000
    ModPagespeedFileCacheCleanIntervalMs 36000000

I did this in the hope to raise the file_cache hit rate but it didn't changed it. Should I stay with these values or put these back to original values?

Thank you,

Regards,

Timothy GERETS.


Le jeudi 12 janvier 2017 14:30:35 UTC+1, jmarantz a écrit :
Thanks for the detailed report with stats & config!  That really helps diagnose remotely.


ImageMaxRewritesAtOnce should indeed help with the" too busy" errors.

Your file cache hit rate might not be that bad for image resources. It might look bad because every URL visited on your site results in a property cache lookup to discover (e.g.) the set of above-the-fold images on example.com/?query=high_entropy_value .  This will naturally have a low cache hit rate, but that doesn't necessarily mean the system is behaving badly.

One thing that changed since your previous setup with higher cache hit rates was that in upgrading from 1.9 to 1.11 a few optimizations likely turned on by default.  I'd have to back to the release notes, but the above property-cache hit-rate impact might be caused by a change we made to use the property-cache to determine whether images were critical before we inline them.

I would recommend turning off the LRU cache, since you are enabling the shared-memory metadata cache.

It looks like your file-cache size is sufficiently large because you are not getting any evictions on your chart, though I'd check

Your specific questions:
  • Q: Should I also enable memcached to store a part of the cache ? Or is Lru+sharedmemory+file_cache enough?
  • A: If you have multiple servers then I think that'd be great. If you just have one server I think it won't make much difference to you.

  • Q: All my images have an .ic extension like this: xenzo_white_newsite_05.jpg.pagespeed.ic.XWdvxe76hb.jpg. Normally, shouldn't it be .ce (cache extended) ?
  • A: ".ce." means cache extended, which means we didn't change the resource contents; we just signed the URL to allow it to be cache-extended.
  • ".ic." means we actually optimized your image in addition to cache-extending it.

  • Q: Are there any optimizations I can add to my config ?
  • A: I think I'd start with checking out what webpagetest and PageSpeed Insights have to say about your site.
  • But the first thought that comes to me is to enable webp conversion. Is there a specific reason you turned it off?
  • Next I would check out prioritize_critical_css and lazyload_images.
Hope this helps!
-Josh
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Joshua Marantz

unread,
Jan 12, 2017, 11:12:00 AM1/12/17
to mod-pagespeed-discuss
RE the extra '0' in your file-cache sizes: you are not getting evictions, so file-cache size won't affect hit rate.  However, if I'm right that your file-cache is being filled with property-cache entries for high-entropy HTML urls, a larger cache means that more time will be required to complete a mark/sweep during file-cache cleaning.  So you probably should remove the '0'.

RE Varnish in front of PageSpeed -- that makes sense.  You also have the option of using ImagePreserveUrls so we can transcode the image,s but then we can't cache-extend them.

I think it'd be better to use a small positive integer for ImageMaxRewritesAtOnce, say 1 or 2.  You might not be observing "too busy" errors now because all your images have been cached.  But if your cache gets flushed or you get a new corpus of images, you'll need to optimize them all, and it's probably better to do them 1 or 2 at a time to avoid overloading your server.

-Josh

To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsubscri...@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-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages