What does mod_pagespeed do?
Asked Answered
P

2

11

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" ?

enter image description here

Percyperdido answered 3/2, 2011 at 6:46 Comment(3)
Something worth visiting for looking into mod_pagespeed : code.google.com/p/modpagespeedPercyperdido
Loop up round trips. That would answer your updated question.Anjanetteanjela
@Anjanetteanjela Thanks but can give an example about it ...Percyperdido
A
23

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.

Anjanetteanjela answered 3/2, 2011 at 7:4 Comment(4)
Pedantic note: Nothing that it does can't be done by hand for better results. It's not a magic "add this and all your sites will be faster" tool. It handles the commonly ignored/forgot things that we all should be doing.Waftage
@Waftage agreed completely. I guess it just makes things more automatic. Like URL fingerprinting would be more complicated to do manually. I mean changing the filename each and every time you change content would be a bit, well painful.Anjanetteanjela
@Waftage In a perfect world you'd have full control over the content that is loaded, but often times you don't. For example if you use Wordpress plugins they often load their own scripts which tend to be unminified and heavy. Other than that i agree, you can do most of this stuff by hand and preserve those CPU resources.Headmistress
Note: IISpeed is a port of mod_pagespeed that has been around for a few years now for Microsoft IIS: iispeed.comMatted
A
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.

Abstraction answered 23/3, 2015 at 21:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.