PageSpeed - combine & rewrite css/js on First View not working. Repeat View works however.

425 views
Skip to first unread message

Matt Peacock

unread,
Mar 2, 2016, 6:42:46 AM3/2/16
to mod-pagespeed-discuss
Hi - was wondering if someone could help us understand a few things around Google PageSpeed Mod. 

We're currently in the midst of the implementation the PageSpeed mod (On a commerce platform, running WAS and apache). We're initially focusing on getting the following filters to work:
  • combine_css,combine_javascript,rewrite_css,rewrite_javascript
What we're seeing is that on FirstView (therefor nothing cached locally) there is no record of pagespeed doing any js/css combining or rewriting. With debug, we can see the output of pagespeed towards the bottom of the HTML document (and pagespeed response header is set), but no css/js rewrites & combines. 

On repeat view however (i.e. refreshing), we see the desired results - multiple css/js have been rewritten & combined. 

Quickly checking other filters - for example collapse_whitespace - this does work on firstview. So seems to be related the specified filters. 

Is there any possible explanation for this? Something related to the way the pagespeed updated js/css is written to cache?

It's worth mentioning, we're doing manual testing - so passing the filters and PageSpeed=on as headers (we can't just turn it on at all times at the moment). 

-------------------------------------------------------------

Another question I have is related to caching. I'm trying to understand what exactly is cached by pagespeed. As we have multiple different caching taking place (CDN for example) we'd ideally not have our web servers do the caching (preferably do all work on the fly). Is there a particular way of understanding what exactly is being cached by pagespeed? If the indibidual css/js files are cached, that would be fine - but if the entire content of a request is cached (html, etc) - then that may create issues. 

Many thanks for your help.

Matt.




Otto van der Schaaf

unread,
Mar 2, 2016, 10:06:46 AM3/2/16
to mod-pagespeed-discuss
mod_pagespeed works with deadlines and may send unoptimized or partially optimized content on the first page views.
The amount of time allowed for optimizing can be tuned via these options:


You could also configure mod_pagespeed to loadstatic files directly from disk if possible, as that may help mod_pagespeed in completing background optimizations faster:

There are also filters (prioritize_critical_css, lazyload_images) that need to receive sample data back from browers to determine which content is above the fold, and may require a few full browser page loads before full optimization kicks in.

Collapsing whitespace is something that does not have to wait on background optimization to complete, and is not affected by this. So the first page requests will have whitespace collapsed when you turn that filter on.

As for you second question about caching, mod_pagespeed caches both the original inputs and optimized outputs for images, js, and css. It doesn't cache html. An in-depth explanation is written here:

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/231942eb-e250-4754-a26d-f9cfd28b6312%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages