Saturday, December 6, 2008

Tips: How to compress JSON response using GZIP

The main objective for this short article is to write out the method to compress JSON response(using Web Service) and Ajax response(using normal aspx page) using IIS6 Metabase Explorer.

I have been involving in a ASP.NET web project that makes heavy use of JSON technique and Ajax concepts. The web pools for new data from a Windows 2003 web server every 30 seconds. The size of the data can vary from 100KB to 1MB. This poses performance issue for customers that have slow Internet connection.

IIS6 provides the capability to Gzip the web content before sending to the clients. Figure 1 and Figure 2 show the typical setting that i uses in order to compress JSON and Ajax response.

Figure 1: Deflate settings

Figure 2: Gzip settings.

As you can see, the main setting that is related to the JSON and Ajax response GZIP is the HcScriptFileExtensions. I have included the "aspx" and "asmx" extensions in the "Data" column. 

No comments: