DotNetNuke Tips & Tricks

Tuesday, April 6, 2010 by Ian Robinson

Improve DotNetNuke Performance with GZIP Compression in IIS

Filed under: Tips & Tricks

Recently I’ve been reviewing and cleaning up various little things around here at dnnGallery. In doing so, I’ve been relying heavily on the IIS SEO Toolkit and the YSlow plugin for FireFox. The SEO Toolkit is invaluable for finding things like broken links, bad markup, etc, while the YSlow plugin analyzes things from a pure performance perspective. I recommend both highly for fine tuning your DotNetNuke websites.

One of the things that YSlow recommends is to compress the files that are sent from the server to the user’s web browser. DotNetNuke provides the option to use GZip compression on the Host Settings page. Turning this feature on is one of the first things I do when I set up a new DotNetNuke installation.

YSlow has the following to say about compression:

Compression reduces response times by reducing the size of the HTTP response. Gzip is the most popular and effective compression method currently available and generally reduces the response size by about 70%. Approximately 90% of today's Internet traffic travels through browsers that claim to support gzip.

That’s great! Unfortunately, not every file on your DotNetNuke site is compressed when you enable that setting at the host level. In fact, in a test against a recent version of DotNetNuke in my local environment, YSlow reports 18 components that should be compressed. When you enable GZip compression in the DotNetNuke Host Settings, that number drops to…..17. This is due to the actual page itself being compressed (which is wonderful, don’t get me wrong). But what are the other 17 components? Static files. Namely JavaScript files (.js) and Cascading Style Sheets (.css).

Now, the fact that there so many external files its an altogether different issue that I will side-step for the purpose of this blog post. Of course I would love it if DNN had 1 dynamically created minified JS file and 1 dynamically created CSS file, period. However, that is currently not the case, and even if it was – wouldn’t you want to gzip those files as well?

Here is the compression report from a recent version of DotNetNuke that has GZip enabled:

 yslow_gzip_grade_f

You can see that DotNetNuke does pretty darn well with respect to the YSlow configuration, except where it comes to dealing with external files (this report was run with the “Small Site or Blog” ruleset, for those that are curious). So, how can I improve this section of the YSlow report? By letting IIS gzip the static files, of course!

The report above is from a local environment, but this is exactly how dnnGallery.net behaved prior to implementing some Gzip compression in IIS.

The steps that I used to get IIS to perform GZip compression on all of the static files in my website were as follows:

  1. Enable static file compression in IIS
  2. Install IIS Resources
  3. Add the appropriate file extensions using the IIS Metabase Explorer
  4. Restart IIS

Enabling static file compression in IIS

So, first I enabled IIS compression of static files. Here is the MSDN documentation on performing this step: Configure Compression (IIS 6.0). Note that this is a server-wide solution, and will apply to each of your web sites hosted in IIS. Here are the relevant steps from the MSDN documentation:

To enable server-wide HTTP compression

1. In IIS Manager, expand the local computer, right-click the Web Sites folder, and then click Properties.

2. Click the Service tab, and in the HTTP compression section, select the Compress application files check box to enable dynamic compression.

3. Select the Compress static files check box to compress static files.

4. In the Temporary directory box, type the path to a local directory or click Browse to locate a directory. Once a static file is compressed, it is cached in this temporary directory until it expires, or the content changes. The temporary directory must be on a local drive on an NTFS-formatted partition. The directory cannot be compressed, and should not be shared.

5. Under Maximum temporary directory size, click a folder size option. If you click the Limited to (in megabytes) option and enter a number in the text box next to it, IIS automatically cleans up the temporary directory according to a least recently used rule when the set limit is reached.

6. Click Apply, and then click OK.

After I performed this step, only one random .txt file was compressed, how useful! You can check which files are compressed by looking in the temporary folder that was specified in the above steps.

IIS 6.0 Resource Kit Tools

The next step is to install the IIS 6.0 Resource Kit Tools, which provides the IIS Metabase explorer tool. This is a graphical interface that allows for, among other things, management of the exact file extensions that IIS will compress. I just performed the "complete" install.

Add file extensions using the Metabase Explorer

After I installed the resource kit tools, I opened the new Metabase Explorer application from my start menu and performed the following steps:

  1. Expanded [Machine Name] –> W3SVC –> Filters –> Compression and selected gzip
  2. For the row named “HcFileExtensions” I added “js” and “css” to the “Data” list
  3. For the row named “HcScriptFileExtensions” I added “axd” to the “Data” list

metabase_explorer_gzip_settings

After I performed this step, I restarted IIS and re-ran YSlow and the Compression section reported a grade of A. Sweet!

Comments

Andy
Tuesday, April 6, 2010 3:55 PM
You should also change the HcDynamicCompressionLevel from 0 to 9 for both Gzip and deflate. Do not change it to 10 as this will cause a huge memory spike for the w3wp.exe process as recommended by Chris Adams from Microsoft.

IIS MetaBase Explorer from Ripcord Software is a better (and FREE) metabse editor.
http://www.ripcordsoftware.com/IISMetabaseExplorer/

Also, if you've got the money then try Aptimize.
Aptimize comes configured with compression and optimization settings for DotNetNuke. It turns any size DotNetNuke installation into a lighting fast website.

Aptimize combines css and images, creates sprites on the fly and alters the appropiate css elements to reflect this, combines and caches scripts dynamically and I must say intelligently.

For example, I use it on one newspaper site and it reduced 17 script files down to two, 7 css files down to 1, 26 cssimages to 3 and 24 images to 3 sprites. Any changes made to the page are automatically updated in the Aptimize process and the cache recreated. Its the mother of all Website Optimisation tools. You have to use it to see the difference it makes to a large DotNetNuke site (DNN Corp take note !!!)

http://www.aptimize.com

Hopes this helps.
Ian Robinson
Tuesday, April 6, 2010 4:19 PM
Hey Andy,

Thanks for the tips about HcDynamicCompressionLevel and the alternate IIS Metabase explorer. I'll look into both of them.

Aptimize looks like a pretty nifty product as well. My only concern with this sort of solution for a DotNetNuke website is that it is addressing the symptoms rather than the root cause of the issue.

I suppose in the world of Sharepoint there may not be any going back, but I have a strong feeling that the DNN community & DNN corp can and will move forward with addressing the core issues of having too many external resources.

Until then, however, it does look like it would be a reasonable solution for speeding up the performance of your site, depending on how deep your pockets are, that is. :)
Andy
Wednesday, April 7, 2010 4:00 AM
I forgot to mention another Ripcord product, IISxpress.

It's free to download and works on IIS versions 5-7.

Its a simipler version of a compression and caching application but none the less effective in speeding up a DotNetNuke or any website. We used it until we tried Aptimize.

I agree, Aptimize for us is solving the symptom rather than the solution. We did try and alter the core DNN code but having to recode every release of DNN that we wanted to upgrade to became a cost burden. Hence Aptimize was the cheaper option.
Jon
Monday, April 12, 2010 2:05 PM
What about PageBlaster from Snapsis? I've used that in the past and have had very good results.
Ian Robinson
Monday, April 12, 2010 2:43 PM
Hey Jon,

I haven't used PageBlaster before, but I have heard good things in general. Can you share any specifics about how it has helped you?

Thanks,

Ian
by Mansbooks
Thursday, October 21, 2010 8:08 AM
by Mansbooks
Thursday, October 21, 2010 8:37 AM
blog comments powered by Disqus