This is a little weird, but could you put varnish between the java app
and mod_pagespeed? While mod_pagespeed won't cache html you could set
varnish to if you know its safe. This should dramatically reduce the
number of requests to your java app while still keeping
mod_pagespeed's optimizations.
On Tuesday, December 11, 2012 2:26:19 AM UTC+1, Ilya Grigorik wrote:This is a little weird, but could you put varnish between the java app
and mod_pagespeed? While mod_pagespeed won't cache html you could set
varnish to if you know its safe. This should dramatically reduce the
number of requests to your java app while still keeping
mod_pagespeed's optimizations.That would work, but I'm guessing, not nearly as well as with Varnish at the front...
yes, this solution is my last resort.[...]
BUT.. all of the above is still a bit of a problem with MPS, since as Shawn pointed out, knowing upfront whether this header should be set, or not, creates some problems for MPS...ig
well, i'm overwriting ttl of html here, so I decide when html should be updated. You have to understand, that from my point of view images are most important thing to optimize. done/not_done - fine with me as long as this will work and i'll get info that MPS finished.btw. is there a way to extend this 5min window of MPS?
Varnish don't have access to request body - it'd be an overkill to check source for a string.I've seen this flush window in docs regarding css and js concatenation/minification. Can I modify flush window size? I haven't found anything on this topic in docs. I'm not sure if its apache variable, MPS variable, or defined somewhere else.By "5min window" i mean i.e. this part of docs:If the site owner changes the logo, then mod_pagepseed will notice within 5 minutes and begin serving a different URL to users. But if the content does not change, then the hash will not change, and the copy in each user's browser will still be valid and reachable.(theres a typo in docs - "mod_pagepseed")looks like i've missed this part:mod_pagespeed uses the origin cache time-to-live (TTL), in this case 300 seconds, to periodically re-examine the content to see if it's changed. If it changes, then the hash of the content will also change. Thus it's safe to serve the hashed URL with a long timeout -- mod_pagespeed uses one year.As long as it respects origin ttl, it's fine.
On Tuesday, December 11, 2012 3:43:41 PM UTC+1, jmarantz wrote:
I have another idea about how to deliver completed pages to Varnish. Starting with 1.1.23.1 there is a pagespeed.conf option to force mod_pagespeed to fully optimize each page no matter how long it takes.ModPagespeedBlockingRewriteKey YOUR_KEYIf you set this option, and send request-header "X-PSA-Blocking-Rewrite: YOUR_KEY" to mod_pagespeed, then mod_pagespeed will always deliver fully optimized pages. The downside is that on an image rich page and a cold server cache, this may take multiple seconds, so you would wind up punishing users occasionally if this was used to service an end-user request after the Varnish cache expired.
MPS version:X-Mod-Pagespeed:1.1.23.2-2191pagespeed.conf:ModPagespeedBlockingRewriteKey lurykeyone1Varnish vcl change:sub vcl_recv { unset req.http.Cookie; set req.http.X-PSA-Blocking-Rewrite = "lurykeyone1";varnishlog -i23 TxHeader b X-PSA-Blocking-Rewrite: lurykeyone115 TxHeader b X-PSA-Blocking-Rewrite: lurykeyone115 TxHeader b X-PSA-Blocking-Rewrite: lurykeyone114 TxHeader b X-PSA-Blocking-Rewrite: lurykeyone114 TxHeader b X-PSA-Blocking-Rewrite: lurykeyone1services restarted.and still, on first req/resp i get unoptimized images on first hit.Maybe theres an issue with file name? There is no file extension here, but MPS creates jpg file out of this after 2'nd/3rd hard refresh.
Also when i check /mod_pagespeed_message i dont see any info for image_gallery or any of the parameters until pagespeed tries to fetch optimized version - should it be like this? I'd rather expect to see first fetch of an unoptimized image, info that it's being optimized and then fetch for optimized version.
--Lukas
ok, it works, thank youThere were two problems:
- i forgot that i switched the setup to apache->varnish->backend so my header added in varnish went to backend without MPS
- image i was checking was some gallery image loaded by javascript so parser doesn't know its url.
tested on pages with 20+ images - works great.
Why this option is not documented? It could save us this whole discussion since i've read every documentation page before i've posted my question.I've found this header only in your github messages and in source here: http://modpagespeed.googlecode.com/svn/trunk/src/net/instaweb/http/meta_data.ccyou could at least copy this commit message to docs: http://code.google.com/p/modpagespeed/source/detail?r=1639looks like all "PSA" headers are not documented. What PSA stands for? Advanced? :)also X-Psa-Load-Shed has Psa instead of PSA.Once again thank you for your help!--Regards,Lukas
ok, it works, thank youThere were two problems:
- i forgot that i switched the setup to apache->varnish->backend so my header added in varnish went to backend without MPS
- image i was checking was some gallery image loaded by javascript so parser doesn't know its url.
tested on pages with 20+ images - works great.Why this option is not documented? It could save us this whole discussion since i've read every documentation page before i've posted my question.I've found this header only in your github messages and in source here: http://modpagespeed.googlecode.com/svn/trunk/src/net/instaweb/http/meta_data.ccyou could at least copy this commit message to docs: http://code.google.com/p/modpagespeed/source/detail?r=1639looks like all "PSA" headers are not documented. What PSA stands for? Advanced? :)also X-Psa-Load-Shed has Psa instead of PSA.Once again thank you for your help!--Regards,Lukas