Has anyone used mod_pagespeed in a magento store?
Does it break anything (like custom optimizations etc?)
Very Interested of using it, but suffering from luck of resources...
Your post interested me so I have played around with mod_pagespeed, I didn't do any detailed testing nor measurements. My general impression was indifference, benefits were negligible to undetectable. The greatest hinderence to Magento has always been and continues to be it's mass of PHP classes that take ages to load and instantiate. Magento isn't really guilty of bad practices like inline CSS so there is little room for this mod to do. With those caveats aside here is my experience.
First off Google have packaged mod_pagespeed very well, they provide source as well as binaries, but the binaries installer registers repositories so it'll stay updated. Something I wish more producers would do as a matter of course. The most sensible settings are the default so it works right away without any tweaking.
Configuration is broken into a moderate list of filters which you should read through to see exactly what improvements are made. I only chose to enable two - "remove_comments" and "collapse_whitespace" - which made a marked difference in HTML size and didn't break anything.
extend_cache
- On by default. I like it's concept and think it's an excellent way of maintaining file versions. Useful.
outline_css
& outline_javascript
- On by default. Not really relevant. Harmless.
combine_css
& rewrite_css
- Essentially the same as Magento's built in function and several extensions too, including the always welcome Fooman Speedster. You may think this makes it redundant but I like it as it is offloading PHP execution to native code, thanks to block caching the difference may be minuscule but it's enough for me. Useful.
inline_css
& inline_javascript
- Complement to outline_css
& outline_javascript
and on by default. Does increase page size which I wasn't expecting. Supposedly to reduce the number of requests but what if css/js files are being combined? I expect this is just removing content from a cacheable source. Not wanted.
collapse_whitespace
& remove_comments
- Off by default but is worth having on. Makes a measurable difference to bytes being transferred even after compression. Useful.
combine_heads
- Fixes a problem that will probably never come up in this context. Harmless.
elide_atttributes
- I didn't find any problems with this but only time will tell, for the moment I'll assume it's harmless. Useful.
rewrite_javascript
- This is basically "jsmin" and Google's own comments warn it as risky. Since the js minifier that comes with Magento is both in beta and has caused me problems in the past I considered this sage advice and left it well alone. Not wanted.
rewrite_images
- I'll keep this one short. USEFUL.
insert_img_dimensions
- Something else Magento doesn't really have a problem with so doesn't really need fixing. But it's harmless and might help pages render more smoothly. Useful.
ModPagespeedImgInlineMaxBytes
- Turns small images into data:uri content. I don't trust this as there is a tricky UA version check and you cannot be sure proxies outside your control won't serve to the wrong browsers. Google seem to think it is "low to moderate" risk but I'll not give it that chance. Not wanted.
remove_quotes
- Breaks w3c validation for the gain of a few bytes. In theory it should be harmless but I don't trust it. Not wanted.
move_css_to_head
& add_head
- Can upset some javascript but Magento is hardier than that, then again Magento generally doesn't make school boy errors like this which need correcting. Harmless.
The various rewrites, reorderings and fixes get in the way of developing. A line number reported by the browser won't necessarily be the same in your source code. For this reason I would never use it for anything but a production server.
The benefit is so small for a PHP-driven application like Magento. How many of us are going to be administering servers with millions of daily visitors in order to notice the cost savings? I know I can get much greater savings by old fashioned programming. Block and full page caching have the best effect of all.
Still, any improvement is welcome which is why I will be considering it in future. Any other sites hosted on the same server will benefit in their own ways.
The exact configuration will be judged on a case-by-case basis but generally I think I will be doing the following:
In mods-available/pagespeed.conf:
ModPagespeedDisableFilters inline_css,inline_javascript,rewrite_javascript,remove_quotes ModPagespeedEnableFilters collapse_whitespace,remove_comments
Install Fooman Speedster to combine the javascript properly.
Warn client/bill-payer of the beta nature of the mod.