Continuing an existing discussion on client footprint optimization especially when a lot of features in WebGrid are enabled, I’ve decided to do a little research on the best way to compress these client resources with a balanced server load yet acceptable compression result.
In this research, I’m running on Windows 7 Professional, IIS 7.5, Visual Studio 2008 SP1, and HttpWatch Professional installed with WebGrid Enterprise’s samples.
Without compression, the client resources size is around 1.2 mb.
SmartWebResources’ Compression Technology
SmartWebResources™ technology not only introduces unique architecture for hassle-free deployment, it also comes with built-in compression feature with a reasonable result. Simply put the key below in your web.config to enable the compression:
<add key="ISNet.WebUI.ISRes_Compressed" value="true" />
The result will look like the screenshot below.
The SmartWebResources’ squeezes client resources to 680 kb, saves roughly 60%.
IIS 7 Dynamic Compression
The latest IIS now offers easy customizability in more user friendly format. Unlike its previous version, compression can be enabled without having to edit a certain .config file. You can enable/disable the compression directly in the IIS Manager.
If you wish to learn more about IIS 7’s compression, please click here.
The default compression level is 7. The compression level in IIS is, fortunately, customizable although you won’t find this setting anywhere else in the documentation.
To change the compression level in IIS 7, run the following syntax from command line:
[WinDir]\System32\inetsrv\appcmd set config /section:httpCompression
The acceptable value for compression level is 1 – 10. Setting the compression level to 10 will instruct the IIS to use the best compression quality which produces the smallest output. While it’s great to be able to compact the client resources and deliver very small output to client, it requires a more powerful server for heavier processing and overhead.
In my opinion, the default level is the best option for web applications that run on moderate servers. It doesn’t compress as much as level 9 or 10, but offer less overhead on the server.
IIS 7 Compression (level 7)
If you have the direct access to the deployment server which used IIS 7, IIS compression is definitely the best solution to keep your applications speedy with low client resources footprint. However, if you’re hosting your web applications in a shared server, or if you don’t use IIS 7 yet, then SmartWebResources compression is your best choice. It may not compress as much as IIS, but it still offers reasonable compression result with much lower server overhead.