Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Expo on Google News

SYS-CON.TV
Cloud Expo & Virtualization 2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Cloud Computing & Enterprise IT: Cost & Operational Benefits
How and Why is a Flexible IT Infrastructure the Key To the Future?
Click For 2008 West
Event Webcasts
Poor Man's HTTP Compression with ColdFusion
Speed up your Website and lower bandwidth utilization

There are a couple of things to note before we begin.

First, HTTP Compression is a great way to speed up your Website and lower bandwidth utilization all at the same time. In this example, your ColdFusion server (6.1 and above) will encode CFML output using GZIP and have the browser decompress this data on the fly. In a corporate environment, Webmasters may choose to go with third-party software such as Port80 Software's httpZip, which can compress other files as well, including .js, .css, and your HTML files. In this example, we are only compressing the generated HTML output from a .cfm template execution.

Doing a Google search will reveal many different Java servlet filters that can do the job for you for free. Many of them have issues with memory leaks, don't scale well, or have other issues related to them, so make sure you are picking one that has been well tested, and make sure to always test any server changes in a development environment before deploying to production. Another thing to note is that not all browsers support GZIP encoding, so make sure your user group is using Microsoft Internet Explorer 6+ and Firefox 1.0+.

As a side note, if you are using ColdFusion to consume data from another ColdFusion server that is using HTTP Compression, be sure to read Steven Erat's blog post on potential issues and workarounds at www.talkingtree.com/blog/index.cfm/2004/7/28/20040729. A couple of CFHTTPParam tags allow you to tell the server to send an uncompressed response. In this example, we will be using Coldbeans Software's Compress Filter, which is available at www.servletsuite.com/servlets/gzipflt.htm.

  • Step 1
    Shut down ColdFusion.

  • Step 2
    In cfroot\wwwroot\WEB-INF\lib, download the gzipflt.jar file.

    In cfroot\wwwroot\WEB-INF, edit the web.xml file and place the following XML markup near the end of the file just before the closing </web-app> element:

    <!-- start GZipFilter settings -->
    <filter>
    <filter-name>GzipFilter</filter-name>
    <filter-class>com.cj.gzipflt.GzipFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>GzipFilter</filter-name>
    <url-pattern>*.cfm</url-pattern>
    </filter-mapping>

  • Step 3
    Restart ColdFusion.

    That's it!

    The effects of the changes can be measured quite easily in Firefox using the Web Developers Extension version 1.1.3. This extension is available at http://chrispederick.com/work/webdeveloper/.

    Load the ColdFusion Administrator Login page. On the Web Developer Extension, if you click Information -> View Response Headers, you should see something similar to this:

    Server: Microsoft-IIS/6.0
    Content-Type: text/html; charset=UTF-8
    Content-Encoding: gzip
    Content-Length: 2261

    200 OK

    Note, Content-Encoding and Content-Length, both of which indicate that the GZIP filter is running successfully. Go back to the ColdFusion Administrator Login page and, on the Web Developer Extension, if you click Information -> View Document Size, you should see something similar to Figure 1.

    In the "Documents" line, note that it compressed the ColdFusion Administrator Login page to one-fourth its original size, giving you a total savings of 6 kb. This may not seem like a lot, but try the same thing after logging in. You should see something similar to Figure 2.

    This page shows a savings of almost 40 kb! Now that's huge. Bring up other Websites on this server and watch the savings add up!

    I'd like to thank Steven Erat for reviewing this article prior to publication.

  • About Sami Hoda
    Sami Hoda is an 11-year IT and Web development veteran with degrees in Computer Information Systems and Management & Human Resources. You'll find him reading profusely and passionate about best practices.

    In order to post a comment you need to be registered and logged in.

    Register | Sign-in

    Reader Feedback: Page 1 of 1

    Like several other comments here I am getting the "500 There is no web application configured to service your request error". I dug into the server logs and found that it is because of a "Unsupported major.minor version" error. Can you update Java safely (using ColdFusion 6.1) or is it not worth it?

    I integrated the same in my application. I downloaded the gzipflt.jar, saved it at the required position and modified In cfroot\wwwroot\WEB-INF\web.xml. But when i restarted cf application server.I got "500 There is no web application configured to service your request" when tried to access my site. When reverted all the the thing, started working. I am using cf7.
    any ideas?

    I am getting the same error as subhankar. Any ideas?

    I ran across an odd problem and wanted to see if anyone had any experience with it.
    I use the filter above and it works great, cuts down page sizes as expected.

    I am doing a zip download using cfcontent and it won't work in IE for some reason the file always said it was corrupt, works fine in FireFox, Opera, etc.
    After some investigation the IE version of the download wasn't getting the gzip decoded by the browser. I can use a cflocation to get to the zip after it's created, but this means I can't secure the files which isn't good for me. Is there a way to not apply the gzip filter on a script level basis? Or perhaps trick it into thinking the browser does not accept gzip encoding?

    Any thoughts would be appreciated.

    I integrated the same in my application. I downloaded the gzipflt.jar, kept it at the required position and modified In cfroot\wwwroot\WEB-INF\web.xml. But when i restarted cf application server.I got "500 There is no web application configured to service your request" when tried to access my site. When reverted all the the thing, started working. I am using cf7.
    Can you suggest where i am going wrong?

    Hi,

    I tested my website with and without GZIP but speed is pretty much the same. I just followed the instructions here. I'm using CF7 and IE7.

    Thanks,
    Cita

    nice

    Hi,

    First of all, I would like to thank you for such a great article. The gzipftl.jar worked wonder for us. The only
    problem I had is when this is paired with trimflt.jar(to trim whitespace).

    Do you know if there's a workaround?

    Thank you.
    Ismael

    Be nice to have listed the tradeoffs and provided some benchmarks. Yes, the resulting file size is smaller, but since the per-page processing overhead is higher, what's the net effect? Is the site faster, slower, or pretty much the same? Or is the sole reason for doing this simply to cut down on your bandwidth bill?

    Hi Sami,

    Thanks for the article. Do u have any suggestions on how I could do exactly the same for Flex remote object calls against cfcs using amf?

    Cheers,

    Amnon

    Hi,
    it seems that Gzip scrambles special characters. E.g. a single quote becomes a question mark, just like ë.
    How can that be solved? Is that because the code really has an ë instead of &eacut;?

    Is there some reason to use this over built in web server compression? IIS and Apache can both be configured to compress both static files and dynamically generated pages. With this method, only dynamic content is compressed....


    Your Feedback
    Nick B wrote: Like several other comments here I am getting the "500 There is no web application configured to service your request error". I dug into the server logs and found that it is because of a "Unsupported major.minor version" error. Can you update Java safely (using ColdFusion 6.1) or is it not worth it?
    robmac wrote: I integrated the same in my application. I downloaded the gzipflt.jar, saved it at the required position and modified In cfroot\wwwroot\WEB-INF\web.xml. But when i restarted cf application server.I got "500 There is no web application configured to service your request" when tried to access my site. When reverted all the the thing, started working. I am using cf7. any ideas?
    robmac wrote: I am getting the same error as subhankar. Any ideas?
    justin.dunham wrote: I ran across an odd problem and wanted to see if anyone had any experience with it. I use the filter above and it works great, cuts down page sizes as expected. I am doing a zip download using cfcontent and it won't work in IE for some reason the file always said it was corrupt, works fine in FireFox, Opera, etc. After some investigation the IE version of the download wasn't getting the gzip decoded by the browser. I can use a cflocation to get to the zip after it's created, but this means I can't secure the files which isn't good for me. Is there a way to not apply the gzip filter on a script level basis? Or perhaps trick it into thinking the browser does not accept gzip encoding? Any thoughts would be appreciated.
    subhankar wrote: I integrated the same in my application. I downloaded the gzipflt.jar, kept it at the required position and modified In cfroot\wwwroot\WEB-INF\web.xml. But when i restarted cf application server.I got "500 There is no web application configured to service your request" when tried to access my site. When reverted all the the thing, started working. I am using cf7. Can you suggest where i am going wrong?
    Cita wrote: Hi, I tested my website with and without GZIP but speed is pretty much the same. I just followed the instructions here. I'm using CF7 and IE7. Thanks, Cita
    ??????? wrote: nice
    Ismael wrote: Hi, First of all, I would like to thank you for such a great article. The gzipftl.jar worked wonder for us. The only problem I had is when this is paired with trimflt.jar(to trim whitespace). Do you know if there's a workaround? Thank you. Ismael
    Michael Long wrote: Be nice to have listed the tradeoffs and provided some benchmarks. Yes, the resulting file size is smaller, but since the per-page processing overhead is higher, what's the net effect? Is the site faster, slower, or pretty much the same? Or is the sole reason for doing this simply to cut down on your bandwidth bill?
    Amnon wrote: Hi Sami, Thanks for the article. Do u have any suggestions on how I could do exactly the same for Flex remote object calls against cfcs using amf? Cheers, Amnon
    Joost van der Drift wrote: Hi, it seems that Gzip scrambles special characters. E.g. a single quote becomes a question mark, just like ë. How can that be solved? Is that because the code really has an ë instead of &eacut;?
    Sam Curren wrote: Is there some reason to use this over built in web server compression? IIS and Apache can both be configured to compress both static files and dynamically generated pages. With this method, only dynamic content is compressed....
    Latest Cloud Developer Stories
    Swisscom, the Swiss telecom, is going into the cloud business. Its subsidiary Swisscom IT Services AG has signed up with Red Hat as a Certified Cloud Provider and launched a public cloud Infrastructure-as-a-Service (IaaS) cloud targeting enterprise-class customers primarily in ...
    Apache Deltacloud, the Red Hat-contributed ReSTful API that abstracts differences between clouds so services on any cloud can be managed – provided of course there’s a driver – has graduated from the Apache Foundation’s incubator and is now a full-fledged Top-Level Project (TLP)....
    In a surprise move on Tuesday, January 10, Oracle wheeled out its Big Data Appliance. That’s the one it said in October would be ready sometime in the first half. Only nobody believed it meant early in the first half. Heck, it’s not even clear anybody thought Oracle could make ...
    Rackspace Hosting, the service leader in cloud computing, on Thursday announced its acquisition of SharePoint911, an industry leader in SharePoint consulting, training, and "JumpStart" services within SharePoint. The unification of both companies provides capabilities to deliver ...
    CloudLinux, Inc., on Thursday released CafeFS 3, a virtualized file system for shared hosters that cages each customer within its own virtualized file system. CageFS becomes part of CloudLinux OS at no additional charge. CloudLinux OS, the only commercially-supported Linux OS m...
    Subscribe to the World's Most Powerful Newsletters
    Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
    Click to Add our RSS Feeds to the Service of Your Choice:
    Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
    myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
    Publish Your Article! Please send it to editorial(at)sys-con.com!

    Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

    SYS-CON Featured Whitepapers
    ADS BY GOOGLE

    Breaking Cloud Computing News

    The Khronos™ Group, an industry consortium creating open standards for the accelera...