Wednesday, May 01, 2013

Optimize the static resources of your webapps or webpages

Well first off it appears I am a bit behind on the news, but last October Google released the final version of mod_pagespeed, which is an apache module that automatically optimizes the static resources of your applications or webpages. This sounds great and I will definitely play with it today on my mac which is what I do most of my development on and how I've gotten better at running apache.

Now how about IIS? Well, I do host my production sites/apps on IIS 7.5 and for most of my projects I normally include Microsoft's Web Optimization which can be easily installed thru NuGet on your VS projects but if you don't use that, ask a friend to hand you over the DLL's to place in your bin folder and with some simple rules in your Global.asax you can bundle and minify your CSS and JavaScript files. I do normally develop using ColdFusion and this ends up being a learning curve for some people I've worked with as I introduce them into using .NET in this manner. Now, I feel that it is ok to mix up technology, because it helps you learn new things and make you better as well as get the job done right (but that is my opinion). Well, I learned about Google's release because today I learned about IISpeed, which is a port of the original Apache module  which has been adapted to work with IIS, so we now have all its features available and free of charge :-)

Both mod_pagespeed and IISpeed gives you the following:
  • Minimization, rewriting and combination of JavaScript and CSS files.
  • Image optimization-images are resized before they are sent if the HTML displays them with a smaller size; their format is changed to send the most appropriate one without quality loss; and unnecessary headers (which can take up a lot of space) are eliminated.
  • Conversion of image sets to Sprites to reduce the number of requests.
  • Elimination of comments in HTML files.
  • Cache optimization.
  • Optimization testing via A/B tests.
These truly sounds great and I will try to find some time to play with both and deploy and I recommend you do the same.

Apache users can learn more about mod_pagespeed at:
https://developers.google.com/speed/docs/mod_pagespeed/filters

IIS users can learn more about iisspeed and Web Optimization in the following urls:
http://aspnetoptimization.codeplex.com/
http://www.iispeed.com/