Probably you already know Google Pagespeed, that is the name of three Google’s tools. This project has the target to make the web faster, a very important topic lately… Precisely the tools are:
- Pagespeed Insight, the most famous tool. It’s a page analyzer to bench page performance, and suggests what you should change in your website to speed up your website load time.
- Pagespeed Module, is the main subject of this post. This is a module, available for Nginx (ngx_pagespeed) and Apache (mod_pagespeed), automatically perform optimization to speed up your pages, without the need to change anything in your application code.
- Pagespeed Service, is a proxy managed by Google, powered by the Pagespeed Module. If you haven’t the possibility to install the module directly on your server, this is the best solution.
As I told in a previous post, this website server runs Pagespeed. Using this module I had many facilities. The module performs many optimizations, which are boring to implement, especially on a CMS…
The Pagespeed module has many internal filters, you cane enable or disable, according to your need.
There is a core set of filters, pre enabled, supposed to have low probability to break something in the website. That includes:
- The combining of stylesheets (css) and javascript included in the page or the inlining if they are really small;
- The css e javascript minification;
- The cache extension of css and js elements.
There are also many more advanced filters allowing to really optimize you website performance. These includes:
- Images recompression;
- Deferring javascript load untile the page load completed;
- Conversion of baseline jpeg to progressive or to WebP;
- Remove HTML comments;
A full filters list is available in the official website.
The advantages of using this module are incredible, you really speed up your website, without change a line of code, and you can concentrate only to develop.
Obviously everything has a price. In this case, there isn’t a money price, but there some disadvantages. Pagespeed could break your page code, you should deep test everything working well, especially if you use the extra core set filters.
In my experience, I had not particular issue on this blog (WordPress), also enabling extra core filters, as JavaScript deferring. I had some trouble running Pagespeed with SSL, but the documentation is your best friend, and following step by step the tutorial you shouldn’t have any problem.
One thing to remember is Pagespeed module runs optimization every time a page is requested, obviously it caches optimized images and combined css and javascript, but it must parse every time the Html. This cause a small increase of page latency (negligible compared the optimization gains) and CPU load. In a small site, that don’t cause particular problem, on this server the page latency increase is about 10-20 ms, but in more trafficked website the CPU load could be a problem.
In conclusion, Pagespeed is perfect to optimize small/medium website and the disadvantages are negligible, but for big websites, should be better integrate the optimization directly in the application code.