Re: Cheat-sheet for pagespeed/varnish (and some questions)

454 views
Skip to first unread message

Joshua Marantz

unread,
May 19, 2013, 3:05:43 PM5/19/13
to mod-pagespeed-discuss
mod_pagespeed in general works really well with upstream caches for resources.  You can use relatively short (say 5 minute) TTLs on your CSS/images/JS and mod_pagespeed will check back for updates based on that TTL.  However it will serve 1-year TTL-resources to the upstream cache & clients, renaming the file based on its content signature if it actually changes.   See https://developers.google.com/speed/docs/mod_pagespeed/filter-cache-extend for more details.

This works perfectly with webp conversion because we rename jpegs to have a .webp extension and rewrite the HTML to point to the correct version based on the user-agent.

We are also working on support for caching HTML in front of the Apache server while supporting webp conversion.  We have to get Varnish to be smart about user-agents, which is possible with VCL. Stay tuned as we work out the details on this.

On Fri, May 17, 2013 at 5:27 PM, Richard Hulse <richard...@gmail.com> wrote:
1. I know that pagespeed caches the images it generates, but my pages are updated frequently can only be cached for 10s of seconds (a news site). Will pagespeed recalculate the cached image names and use what is already on disc, or rebuild them each time?

I have a question for you: do you frequently change image files without changing names?  Usually we see the image URLs associated with particular image (say a news photo) and only rarely does an image change without changing the URL (e.g. a logo update).

mod_pagespeed works really well under those scenarios.  What's the scenario where you allow an image URL to be cached for only 10s of seconds?

In any case, mod_pagespeed will cache optimized images on disk and will only need to re-optimize if the image actually changes, and will not need to recalculate if the TTL expires but the image didn't actually change.

I am trying to decide if the extra server side time might outweigh savings in over-the-wire times. Bandwidth is not so much of a concern for us, as the pages are relatively small and we have no ad servers to worry about.

Outgoing bandwidth might not matter to you, but incoming bandwidth might matter to your mobile users.

2. Does pagespeed keep all images cached, or expire less used ones

It expires less used ones.  There are multiple cache implementations and they each have their own eviction policy.  Usually LRU, LFU, or similar.

I am trying to estimate how much on-disc cache I'll need.

If you can cache your entire site that is best.  Once you deploy you can check cache hit rate and see if increasing the file-cache sizes makes it better.

-Josh
 

Anupama Dutta

unread,
Jul 16, 2013, 8:03:44 AM7/16/13
to mod-pagesp...@googlegroups.com
Hi Richard,

We now have an experimental Varnish-cache-integration feature as part of the 1.6.29.3-beta release. Please see http://developers.google.com/speed/pagespeed/module/downstream-caching for details. Please try this out with your setup, and let us know if you face any issues or have any queries.

Thanks,
Anupama.

On Monday, May 20, 2013 3:11:00 PM UTC-4, Richard Hulse wrote:

On Monday, 20 May 2013 07:05:43 UTC+12, jmarantz wrote:
We are also working on support for caching HTML in front of the Apache server while supporting webp conversion.  We have to get Varnish to be smart about user-agents, which is possible with VCL. Stay tuned as we work out the details on this.

I will watch developments on this with interest, as getting varnish/apache to work seamlessly and as reliably as Apache does on its own will obviously be critical.

Thanks for your answers.

Reply all
Reply to author
Forward
0 new messages