Save Bandwidth and Compress Your CommunityServer Feeds

Now that my vacation and the PDC are over, I can continue with all the stuff which I left unfinished on my desk. One of these is a mod for CommunityServer which compresses all the exposed feeds. I've written it some weeks ago already and deployed it on my web server. Since it seems to work properly, I now want to announce it publicly. Though my bandwidth at WebHost4Life isn't limited, for some of you it may save real money.

The HTTP standard defines the compression of any content in RFC 2616, section 3.5. IIS supports compression, however, admin permissions on the server are required. So if your CS blog is hosted in a shared environment, you do not have access to the server. Therefore, you have to look for another solution.

Due to the nature of blogs, the most accessed part of a blog is its feed, or better, the feeds, as most blogs offer RSS as well as ATOM, and may even explose feeds for categories and comments. Therefore it makes sense to at least compress the feeds.

Some time ago Jeff Julian has written an add-on for dotText which compressed the RSS feed. I used to use this add-on on my blog as well, which reduced the size of my feed by about 80%.

Currently CommunityServer does not compress its feeds, and till now there is no add-on available which would add this functionality. Therefore I took Jeff's solution as a starting point and wrote a module myself. Now I'm happy to announce Thoemmi.CommunityServer.Compression 😃

The installation is pretty easy: Download the ZIP file and extract the DLL's to your bin folder. Then replace the handlers in the httpHandlers section in web.config to point to my classes. Here's a lineup of the corresponding items:

Original blog RSS handler
CommunityServer.Blogs.Components.WeblogRssHandler, CommunityServer.Blogs

Replacement
Thoemmi.CommunityServer.Compression.CompressedWeblogRssHandler, Thoemmi.CommunityServer.Compression

Original blog ATOM handler
CommunityServer.Blogs.Components.WeblogAtomHandler, CommunityServer.Blogs

Replacement
Thoemmi.CommunityServer.Compression.CompressedWeblogAtomHandler, Thoemmi.CommunityServer.Compression

Original blog comment RSS handler
CommunityServer.Blogs.Components.WeblogCommentRssHandler, CommunityServer.Blogs

Replacement
Thoemmi.CommunityServer.Compression.CompressedWeblogCommentRssHandler, Thoemmi.CommunityServer.Compression

Original gallery RSS handler
CommunityServer.Galleries.Components.GalleryRssHandler, CommunityServer.Galleries

Replacement
Thoemmi.CommunityServer.Compression.CompressedGalleryRssHandler, Thoemmi.CommunityServer.Compression

Original forum RSS handler
CommunityServer.Discussions.Components.ForumRssHandler, CommunityServer.Discussions

Replacement
Thoemmi.CommunityServer.Compression.CompressedForumRssHandler, Thoemmi.CommunityServer.Compression

If you have had a default installation before, the httpHandlers section should now contain following lines:

<add verb="GET" path="blogs/rss.aspx"
    type="Thoemmi.CommunityServer.Compression.CompressedWeblogRssHandler, Thoemmi.CommunityServer.Compression" />

<add verb="GET" path="blogs/atom.aspx"
    type="Thoemmi.CommunityServer.Compression.CompressedWeblogAtomHandler, Thoemmi.CommunityServer.Compression" />

<add verb="GET" path="blogs/commentrss.aspx"
    type="Thoemmi.CommunityServer.Compression.CompressedWeblogCommentRssHandler, Thoemmi.CommunityServer.Compression" />

<add verb="GET" path="photos/rss.aspx"
    type="Thoemmi.CommunityServer.Compression.CompressedGalleryRssHandler, Thoemmi.CommunityServer.Compression" />

<add verb="GET" path="forums/rss.aspx"
    type="Thoemmi.CommunityServer.Compression.CompressedForumRssHandler, Thoemmi.CommunityServer.Compression" />

That's it. By default, the feeds are compressed with deflate with normal compression. If you want to change the compression level or switch to gzip compression, have a look at web.config.merge in the ZIP file. My add-on uses Ben Lowery's HttpCompressionModule, which in turn uses SharpZipLib. Both assemblies are included in the ZIP file as well.

BTW, if you want to check the compression of your feeds, PipeBoost generates Web Compression Reports.

[Update 10/14/2005: Fixed broken link]

Comments