Grails UI Performance Plugin - beware of uiperformance.html.compress

Lee Butts's picture

We use the excellent UI Performance plugin (thanks Burt!) to help optimise ShareYourLove.com and on the whole it does a great job.

One option that I have found has an undesirable side effect is uiperformance.html.compress.

This option enables the PJL Compressing Filter to compress the html content of the responses. Unfortunately this adds a Vary: Accept-Encoding header to every response, including images, javascript etc.

This header causes browsers (we especially noticed it with IE) to re-request all resources even when the have far-future expires headers (as added by the ui-performance plugin). This was causing slow page loads for users, especially those on slower/high latency connections. Even though our server would return 302: Not Modified in response to all these requests, the connection overhead (the site has a lot of CSS images) was still a significant performance hit.

By disabling the html compression option, the site caches much better and only the main content of each page (and any new resources not in the cache) is requested each page view. You would need to access whether the smaller download gains of html compression, outweigh the extra server requests for resources when configuring this option on your application.

I tracked this down with the help of Fiddler2 which is a proxy that analyses your browser requests and provides guidance on best practices to improve performance. There is a good page from the Fiddler explaining the Vary header here.

Comments

Does it work with IE8?

Hi, I recently integrated the ui-performance plug in, it seems to work great with all browsers except IE. The main problem is that IE is not recognizing the gzip files, not supporting them, when I open one of the gzip files with the developers tools I just see one weird character. Checking on your site I see it works perfectly and that the gzip files are the ones being included, did you do something in particular to make it work with IE?

Any suggestions/thoughts?

Thanks!

Maricel