问题
This is with reference to:
http://googlecode.blogspot.com/2011/01/go-daddy-makes-web-faster-by-enabling.html
But I still don't know how it works the in background to dynamically optimize pages.
One more thing I could NOT understand why "Cached subsequent requests are slow" ?
回答1:
PageSpeed mod_pagespeed is a module for Apache server which is just like a plug in, and since Apache is different from IIS, it cannot be installed on IIS servers.
As for what it does, it does multiple things:
- Minifies (removes whitespace, comments, etc) or in other words compresses external CSS and JavaScript
- In addition to minifying JS, it combines multiple external JS files into one JS file which causes less http requests or round trips so the page loads faster
- Optimizes the cache for the files. Every http header has a cache information, or in other words, for how long should the browser keep the resource, mod_pagespeed optimizes this number
- Uses the idea of URL fingerprinting for the new JS files. Basically when the mod_pagespeed optimizes and combines multiple JS files into one file, this temporary file is stored somewhere on the server, however, its filename is generated from the content of the JS files using checksum algorithms such as MD5. What this allows to do is that mod_pagespeed tells the browser to store the JS file for a long time (sets a long cache time), however as soon, as the developer will change the content even in one of the JS files, since the checksum of all the files will change, mod_pagespeed will generate a new temp JS file which will have a different URL compared to the old one. So, when the user who has saved the old combined JS file will try to reload the page, since the URL of the new JS file will be new, it will force the browser to download it again. So essentially this is one way to do cache control.
- Minifies HTML
So this module is pretty cool. It can really speed up the performance of the sites. One downside however is that it uses much more CPU resources on the servers.
Hope this helps.
回答2:
According to your graph, left picture does not represent loading times of cached requests. It's the number of requests! And, as it's supposed to be, the number of requests to the server goes down and number of cached requests go down.
However I don't see the loading times change. According to this recent research "What is PageSpeed Module?", loading times can be decreased by up to 90%!
Additionally, their numbers on numbers I get from Your pictures match pretty exact: - around 50% cut in number of requests ; - around 80% cut in payload size.
The idea of how it works is described by the gentleman in the answer above, for more info you can check Google Documentation or the link to Boost Business Friday guys.
来源:https://stackoverflow.com/questions/4883162/what-does-mod-pagespeed-do