DCSIMG
Web Performance: AXD files compression. - Yevgeni Frolov

Yevgeni Frolov

Web Performance: AXD files compression.

In my previous post I’ve described how to enable data compression on IIS 6.0 server. The problem I’ve discovered while analyzing HTTP traffic with Fiddler and YSlow is that somehow IIS does not compresses WebResource.axd files. In ASP.NET websites with extensive use of Ajax this issue reduces site’s performance significantly, because of size and amount of axd files in use.

Screenshots below demonstrate results of enabling of IIS standard data compression during my tests(here can be found some explanations about YSlow usage):

Before enabling data compression on IIS:

 image

After enabling data compression on IIS:

image

Although data compression was enabled, axd file was not compressed without any obvious reason. To overcome this obstacle within ASP.NET applications HttpModule must be implemented. It will compress an axd files on http response. An implementation’s algorithm is pretty simple:

  1. Subscribe to BeginRequest and EndRequest events.
  2. On BeginRequest validate if any data compression can be applied on axd file. If not, bypass all module’s events.
  3. On EndRequest apply data compression to a axd file.  Standard .NET classes can be used to apply GZip or Deflate compression - DeflateStream and GZipStream. If browser supports deflate data compression – prefer it, because of performance reason, here are some explanations.
  4. Set response content type to “text\javascript” – caches file on client side.
  5. Set an expiration data to some reasonable time span – reduces number of server requests.

After applying suggested solution YSlow shows an ideal “A” grade:

image

By enabling this HttpModule, network utilization for ASP.NET application, using Ajax, reduced significantly because of a fact that axd files sizes are big without compression and there is no caching for those files by default.

If you have any questions about an implementation of HttpModule I’ll be glad to help. Any way  I’ve checked two examples that are ready for download :

  1. Link from Codeproject.
  2. An implementation by Miron Abramson

 

Hope this post will help to improve your applications…

Comments

DotNetShoutout said:

Thank you for submitting this cool story - Trackback from DotNetShoutout

# February 16, 2009 8:29 AM

Pini Dayan said:

ידידי הלינקים שסיפקת על AXD שבורים

# February 17, 2009 11:09 AM

Frolov Yevgeni said:

אתה צודק - טופל

לצערי האתר עליו הפנתי חדל מלהתקיים

# February 17, 2009 9:15 PM

Avi Pinto said:

אחלה פוסט,

תודה

# February 27, 2009 9:59 AM

Imran Zahid said:

Can someone tell me the difference between the gzip compression done at application level (Using gzipStream class of .NET) and gzip compression that we enable at IIS level?

Thanks

# March 25, 2009 7:00 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: