Make your website faster with RequestReduce

My co-worker Matt Wrock released an open source project on GitHub and Nuget called RequestReduce.  It is a very quick and easy way to dramatically improve the performance of an ASP.NET website. We use this library for our sites at work and after adding it we saw around an 18% improvement in global page load time.

RequestReduce works by examining the resources in an HTTP request and optimizes them before sending to the user. It will optimize them in the following ways (Matt Wrock’s own words):

  • Look for background images that it can sprite. This is the process of combining multiple images into a single image and using some CSS syntax to pull in specific images from that single file into a CSS class’s background.
  • Merge these images into a single PNG that is quantized down to 256 colors and then run through optipng for lossless compression. Unsatisfied with the quality I was getting from the popular opensource quantizers, I created a quantizer based on the Wu quantization algorithm and have released that separately as nQuant on codeplex. This often reduces the image size up to 3x smaller than the original.
  • Merges all CSS in the head and minifies it.
  • Manages the downloads of these CSS and image requests using ETag and expires headers to ensure optimal caching on the browser.

One of the nicest aspects of RequestReduce is how simple it is to start using. Just download the binaries to your website bin folder and add the following to your web.config:

<system.webServer>
 <modules runAllManagedModulesForAllRequests="true">
  <add name="RequestReduce" type="RequestReduce.Module.RequestReduceModule, RequestReduce, Version=1.0.0.0, 
  Culture=neutral" />
 </modules>
</system.webServer>

If you are interested I would definitely head over to the RequestReduce website to read the detailed documentation (including advanced configuration options) and the source code (yay for open source Smile ).

  • http://www.redtaz.com Rob Dolman

    I’ve just discovered this fantastic project, it really is as simple as it looks. The only little bit of documentation digging I had to do was for animated gifs. It was including these in the automatic sprite processing. The best way I could find to stop this was to add “?RRFilter=disabled” to my gif URLs.