We're running Magento on top of PHP / Apache. Then we added mod_pagespeed. Finally, we cache and serve all that with Varnish.
Magento is helluva slow. We currently cache the pagespeed optimised output with Varnish. That's mostly because pagespeed is an Apache module, so that's where it fit in our stack.
I'm now wondering if we'd be better to add Varnish between Magento and pagespeed. We could cache the unoptimised Magento output in Varnish, then use a second Apache site to apply the pagespeed optimisations.
As I see the pros / cons:
+ Browser specific optimisations are all handled by pagespeed, simpler Varnish logic
+ No chance of partially optimised pages in Varnish cache
- Pagespeed would be repeatedly optimising the same pages, redundant work
- Two requests every time, client -> pagespeed -> Varnish
Another side effect is that Pagespeed would cache it's own optimised .pagespeed.hash urls. Not sure if this is a good thing or not. The advice on the downstream-caching docs[1] says let pagespeed cache these urls to avoid cache bloat. We have plenty of memory, and I wonder if Varnish is better at caching these assets than pagespeed.
My gut reaction is that we'd get a simpler setup with minimally slower performance. Any other opinions on the list? What have I missed / mistaken in the reasoning?
Cheers - Callum.