In the last article I discussed mainly JavaScript minification & packing, but I felt this should be split into two parts as I discuss a little more in regards to HTTP comperssion and GZipping.
HTTP compression ([1],[2]) comes into play when a client requests content from a web server, such as an image or a document. In a typical scenario where HTTP compression is not utilised, the file will be downloaded in it’s uncompressed state, resulting in an inefficient way to deliver this content. When HTTP compression is enabled and the content is requested, the content is first compressed, then sent to the client, then decrompressed by the client at the client’s browser’s processing expense. This results in benefits for both the server and the client, typically the major benefit is in page load times with web browser content and lower bandwidth usage for both. I have paraphrased a better explanation from Mozilla here:
[HTTP compression] aims to improve real and perceived web browsing performance by having the server send compressed HTML files to the browser, and having the browser uncompress before displaying. Assuming fast enough processors on most machines these days, the user should end up seeing the document sooner this way than sending uncompressed HTML. Also, since a majority of network traffic these days is HTTP traffic, compressing all HTML sent via HTTP should recover a significant amount of wasted network bandwidth.
I will only discuss in terms of IIS 7.0, but I believe http compression is enabled by default (at least on my Vista machine with IIS defaults) so you are in luck already, your web server will be ready to start serving static content, such as JavaScript files in a compressed fashion. However for individual files and for dynamic content, with a little http header tweaking as documented at Yahoo’s Best Practices for Compression and enabling IIS to acknowledge this if required (IIS 7 – I think starts with the other checkbox “Enable dynamic content compression” in the “Compression” tab), and your JS files would serve with compression. Or here appears to be a great little article targeted on compressing ASP.NET pages.
A few other page optimisation or particularly interesting tips I found in my travels:
http://stackoverflow.com/questions/11500/speeding-up-an-asp-net-web-site-or-application
http://stackoverflow.com/questions/244222/how-can-i-get-asp-net-ajax-to-send-its-json-response-with-gzip-compression
http://stackoverflow.com/questions/360818/which-javascript-minification-library-produces-better-results
http://stackoverflow.com/questions/294976/how-do-i-gzip-my-web-files
http://stackoverflow.com/questions/114860/what-is-the-best-way-to-pack-javascript-without-getting-perfomance-flaws
http://stackoverflow.com/questions/282650/whats-the-optimal-gzip-compression-setting-for-iis
PS: If you are wondering whether or not your scripts/files are being sent compressed, I suggest you check out the HTTP Debugger, Fiddler for that.
- G, over and out
One Trackback/Pingback
[...] Compression Part 2: HTTP Compression (Gzip/Deflate) & Dynamic … [...]
Post a Comment