Rather than succumb to the many premature rumors of its impending demise, ColdFusion continues to thrive, even more so under the auspices of its new owner, Adobe. With the release of ColdFusion 8, Adobe has reaffirmed its commitment to ColdFusion by releasing the most feature-rich version in years.
Whether you’ve never used ColdFusion before, you’re considering coming back to the fold, or you’re looking for a good reason to upgrade, ColdFusion 8 definitely deserves your consideration. Indeed, ColdFusion 8 represents a major release, with more new features than I could possibly cover in a single article. In short, now is a very good time to be a ColdFusion developer, and in this article we’ll look at my favorite reasons why.
What’s that you say? Speed is not a feature? Well, when the improvement is as dramatic as it is in ColdFusion 8, it can definitely be considered a feature. The ColdFusion team analyzed over 100 actual customer applications to find and eliminate bottlenecks. This resulted in an overall improvement that makes the server up to 4.25 times faster than ColdFusion 7.0.2. In fact, some specific areas and tags are 39 times faster than prior versions. In particular, if you’re undertaking object-oriented development using ColdFusion components (CFC), you’ll notice a marked improvement.
The best part is that you don’t need to do anything to take advantage of this feature other than install ColdFusion 8. Without changing a single line of code, your existing ColdFusion application will see a huge performance boost. So, here’s the plan…
- Sell your boss on a plan to dramatically improve site performance, budgeting four weeks of work.
- Buy and install ColdFusion 8.
- Spend four weeks improving your ranking on World of Warcraft.
If you aren’t already developing with ColdFusion, it’s important to keep in mind that ColdFusion has long since outgrown the accusations of being slow or unscalable. As a developer at The Economist who recently upgraded to ColdFusion 8 noted, “…the whole thing is ridiculously stable.”
Sometimes, when diagnosing application performance issues in previous versions of ColdFusion, it felt like you were a doctor trying to diagnose an internal injury without access to an x-ray machine. You knew something was generally wrong inside, but you had no way of seeing (and therefore, of treating) the issue. Well, the good news is that ColdFusion 8 (Enterprise and Developer versions) comes with an x-ray machine … er … a server monitor that allows you to peer at the internals of your ColdFusion server on which you’re running your application.
The ColdFusion Server Monitor is a Flex application that allows you to examine a variety of statistics related to the overall health of your server. It provides you with details about specific applications, sessions, requests, and queries. For example, you can get reports on slow requests, and drill-down into those requests to see variable memory usage for each request, as well as the performance of any includes, custom tags, and components within the request. This can help immensely when you’re trying to locate bottlenecks within a slow request. In my opinion, this feature alone will have a huge impact on how developers will build and debug ColdFusion applications going forward.
In addition, the Server Monitor offers customizable alerts that allow you to receive notification when certain undesirable behaviors occur, such as low JVM memory or excessively long-running threads. You can even customize the response that the Server Monitor implements when this behavior occurs, configuring it either to send an email, create a snapshot, kill threads running longer than a specific timeframe, or even execute a set of custom code from within a ColdFusion component that you specify.
ColdFusion 8 has added a long list of new tags and features that have been designed specifically to allow you to rapidly build Ajax-based Rich Internet Applications using a comfortable and familiar tag and function syntax. In fact, the libraries that I mentioned above are built into ColdFusion 8, making it possible, for example, to create an Ajax grid using Ext simply by using the cfgrid tag. You can even bind this grid to a dataset that’s returned by a CFC method simply by putting a reference to the cffunction into the bind attribute of the tag. ColdFusion 8 really does make it incredibly simple and intuitive to add some glitz to your application by integrating rich user interface elements.
The following example code shows how the
A long time ago, ColdFusion had its own IDE called ColdFusion Studio, which included a step debugger. When that tool moved on from this world, ColdFusion programmers became experts at trying to debug through the
cfabort method, which basically entailed dumping the value of a variable on-screen and aborting the request. While this was effective, it has some major drawbacks, the primary one being that it was an extremely slow and tedious process to debug an entire page this way. Nonetheless, many ColdFusion programmers like me grew accustomed to the drudgery and forgot what we were missing … Well, we’re without a serious debugger no longer!
The ColdFusion 8 debugger was built in the Eclipse IDE, which is a tool that will be familiar to anyone using either Flex Builder or CFEclipse. The debugger allows you to set breakpoints and to debug requests running on either a local or remote ColdFusion instance. Once a breakpoint is encountered, you can inspect the value of any and all variables within any scope contained in the request. Additionally, you can step through the request and watch certain expressions to look for inconsistencies in the value settings. I believe this, combined with the Server Monitor, not only makes the debugging process much easier, but allows us the insight to create much more efficient and bug-free applications. Not that I ever write bugs! (Ahem! — Editor.)
I liken the addition of multi-thread capabilities to ColdFusion 8 to being bitten by a radioactive spider. It provides the developer with a great deal of power, but we all know what comes with great power … yes, usually fame and money, but in this case I’m referring to great responsibility. Additional threads are used to improve the performance of a request that contains some sort of long-running process which is passed off to a thread. Typically, threads can either be:
- created and then rejoined to the current request thread when they have completed
- created and then simply forgotten about when they have completed
- created and run indefinitely, being alternatively put to sleep or put to work as needed
ColdFusion makes it very easy to spawn new threads with the
cfthread tag. Any code contained within the
cfthread tag is executed asynchronously, with the current request existing in an independent stream of code execution. The remainder of your request can continue to process without the need to wait for the thread’s code to finish unless it’s instructed to do so. Any experienced programmer will have run into a multitude of situations where the page request shouldn’t need to wait for a particular process to run before continuing, so clearly this is a very useful function (despite its propensity to be misused).
To give you an example of how this would work, the following example shows some code that loops through an array of RSS feed URLs and uses the new
cffeed tag to parse the RSS XML. It processes each feed on a separate thread so that they can all run simultaneously, reducing the overall time it takes to process the page. Once the threads are complete, another
cfthread tag is used to rejoin them to the current thread, where we can output the values. Those of you who are already familiar with ColdFusion might also notice that I’m using the new implicit array creation to build my feed array:
<cfset feeds = ["http://www.remotesynthesis.com/blog/rss.cfm?mode=full","http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"] /> <cfset threads = "" /> <cfloop from="1" to="#arrayLen(feeds)#" index="i"> <cfset threads = listAppend(threads,"thread"&i) /> <cfthread action="run" name="thread#i#" feed="#feeds[i]#"> <cffeed source="#feed#" properties="thread.myProps" query="thread.myQuery" /> </cfthread> </cfloop> <cfthread action="join" name="#threads#" timeout="6000" /> <cfloop list="#threads#" index="thread"> <cfif structKeyExists(cfthread[thread],"myProps")> <cfoutput>#cfthread[thread].myProps.title#<br/></cfoutput> </cfif> </cfloop>
As I said earlier, there are so many new features in ColdFusion 8 that I can’t possibly cover them all in detail here. However, here’s a handful of the key features that might pique your interest in this new release:
- Deeper PDF Integration: As one would expect from an Adobe product, ColdFusion 8 contains the most sophisticated PDF integration of any application server. It goes beyond simply creating PDFs on-the-fly to proving developers with the ability to create PDF forms and accept PDF form submissions, merge PDF files, add and remove pages, create page thumbnails, and much more.
- RSS/Atom Integration: As shown briefly above, the new cffeed tag makes it easy to read and create RSS or Atom feeds.
- Image Manipulation: ColdFusion 8 finally includes a long list of tags and functions to create and manipulate images.
- Zip/Jar File Manipulation: Create, modify and extract both .zip and .jar files.
- Presentations on Demand: Build on-the-fly presentations that work just like Adobe Presenter.
- .Net Integration: Work natively with .Net assemblies that exist either locally or on a remote server.
- Exchange Server Integration: Programmatically manage email, calendar items, contacts, and tasks on a Microsoft Exchange Server via ColdFusion tags.
As you can see, so many new features are included in ColdFusion 8 that your five favorites might be entirely different from mine. If you haven’t tried ColdFusion 8 yet, what’s stopping you? The Developer Version is free, after all. Give it a go!
ColdFusion 8 Performance Brief (PDF, 172K)
ColdFusion 8 server monitoring series:
- Part 1: Using the Server Monitor in development
- Part 2: Using the Server Monitor in production
- Part 3: Automated monitoring and request management with Alerts and Snapshots
- Part 4: Multiserver Monitor, Admin API monitoring, and more
An overview of Ajax features in ColdFusion 8