Jul
4

CFUnited's day three keynote was given by Vince Bonfanti, President and co-founder of New Atlanta Communications, LLC. Vince spent about half the time giving a high-level overview of BlueDragon and it's pre-history and the rest of the time talking about BlueDragon 7 and the new features contained therein. What follows is my perspective on the new features of BlueDragon 7 based on Vince's presentation and my talks with Josh Adams, Technical Sales Engineer for New Atlanta.

First and foremost, what new features are going to be released in BlueDragon 7? Here's the list as of today:

  • Multi-threaded programming support with CFTHREAD and CFJOIN
  • CFQUERY enhancements
    • CACHEDUNTILCHANGE attribute (available in BD.NET and SQL 2005 only)
    • BACKGROUND attribute (for background SQL processing)
  • "null" keyword and IsNull() function
    • ability to return "null" in CFC methods
    • IsNull() for checking for null database values
  • CFC interfaces via CFINTERFACE tag
  • Application.cfc enhancements
    • onClientStart event handler
    • onMissingTemplate event handler
  • CFDOCUMENT enhancements
    • PNG and JPEG output formats (FlashPaper not supported)
    • tag will be multi-threaded on all BD editions excluding FREE version
  • CFCHART enhancements
    • CFCHARTLEGEND, CFCHARTTITLE, and CFCHARTIMAGE tags
  • CFSEARCH enhancements
    • multiple language support
    • Microsoft Wod and PDF support
  • CFTIMER tag
  • SOAP-related functions
  • MySQL 5 support including Stored Procs
  • 64-bit Windows and Linux support
  • misc performance enhancements
  • misc bug fixes
Even a cursory look at the new features brings several things to mind. First, New Atlanta has been busy working on some great enhancements and second, it's obvious there are features in the list above that are not included in Adobe's CFMX 7 and vice versa. And, there are some feature overlaps where CFMX 7 and BlueDragon 7 offer the same functionality implemented in different ways (multi-threading for instance). What I want to do today is take a few moments to look at the new features I think developers will be most interested in reading about.

Multi-threading with CFTHREAD and CFJOIN
Multi-threading ColdFusion is not something new. Ever since the release of CFMX 7 developers have had control of ColdFusion's threading via Event Gateways, specifically with the Asynchronous Gateway that's included in CFMX 7 Enterprise Edition. In early 2004 I gave a presentation to the Nashville ColdFusion User Group demonstrating the asynchronous gateway using Damon Cooper's example of creating 100 text files with a 100-thread pool. It was an impressive example then and it's still likely the most used example when demonstrating asynchronous gateways. To BlueDragon's credit, developers have been begging for the ability to manage ColdFusion threads in a simple tag-based or function-based mechanism. Well, now you can. Let's look at some example BlueDragon 7 code:

<cfthread firstName="Aaron" lastName="West">
   <cfquery >
      INSERT INTO Employees
      VALUES ('#attributes.firstName#', '#attributes.lastName#')
   </cfquery>
</cfthread>

When this block of code is executed on a BD7 server a new thread will be spawned to handle the insertion query. The page with this code will continue to process without waiting for the query to do its thing. This example illustrates one way to pass data into the newly spawned thread - using attributes to the CFTHREAD tag. Another way to pass data into the thread is by using the Application scope. Note, the newly created thread may last longer or shorter than the initial request thread and therefore has no access to the initial request, session or CGI scopes. This also hints to the fact the new thread has it's own variables scope. If your mind is racing at ways you can use CFTHREAD to quicken up pages by off-loading intensive code to separate threads, you're not alone. But what if you want to create some new threads and have your original request thread tied to them somehow? Well, you can:

<cfthread name="separateThread">
   <cfset message = "Hello, world">
</cfthread>

<cfjoin thread="separateThread">

<cfoutput>#separateThread.message#</cfoutput>

Just like the previous example, a separate thread will be created to handle the code contained within the CFTHREAD body. In this example we introduce usage of the "name" attribute of the CFTHREAD tag and the CFJOIN tag which tells the main request thread to wait for the nominated thread to finish processing. Once the "separateThread" thread finishes, process will be returned to the main thread where you can access data stored in the separate thread using the syntax [threadname].[variable_name].

Here are some things to think about when using CFTHREAD. You will likely be able to create a large number of threads with the CFTHREAD tag (there will be a limit, but this has not been announced by New Atlanta). You can let some of them process completely on their own or you can write CFJOIN tags to force the main request to wait for one or more of the spawned threads. For instance, you could spawn 4 separate threads with 4 CFTHREAD tags and only wait for one of them to finish before allowing the main request to continue. Perhaps the one thread you are waiting on has data that you need to access in the main request body while the other 3 threads are unrelated and can process entirely on their own. Another thing to keep in mind is newly created threads occupy the same thread pool as all other threads on your BlueDragon 7 server. This means all new threads WILL impact performance of users browsing pages on the same BD7 server. This implementation is very different from CFMX 7's Asynchronous Gateway where threads created with the gateway occupy a separate thread pool that does not affect normal server usage, i.e. they happen in the background. So while you certainly have some new power with CFTHREAD, use it wisely. Creating too many threads in the main thread pool can impact performance heavily and with some bad code, you could definitely bring down the BD7 server.

EDIT: See comments on this entry as to why I've striked some content here.

I applaud New Atlanta for creating the new multi-threading capability but I think they should seriously look into having the threads run in their own thread pool - something I stressed to Josh Adams. Now, if Adobe would implement a tag-based CFTHREAD developers would have the best of both worlds, the ability to use the asynchronous event gateway (only accessible in the Enterprise edition of CFMX 7) to create additional threads and the use of a more approachable tag-based solution (which could potentially be available in any CFMX 7 edition).

CFQUERY enhancements
The new feature here to look at is the CACHEDUNTILCHANGE attribute. It's my understanding that this feature is only available due to some new abilities with SQL Server 2005. Specifically, SQL's ability to "watch" certain data and report when it has changed. Hooking this capability to BD7 is the new CACHEDUNTILCHANGE attribute which will essentially cause BD7 to be notified by SQL Server 2005 when the data in the query has changed. When the data has changed and the query with the new attribute is executed, the data will be updated. Otherwise, it will remain the same. This is pretty awesome considering it is very difficult for developers to determine the appropriate time scale for implementing query-based caching with the CACHEDWITHIN attribute. Oftentimes your initial speculation for how long the data should be cached changes thus causing you to edit your code. With BD7's CACHEDUNTILCHANGE attribute these code changes are no longer necessary as you always have real-time, live data with perfect query-based caching.

In addition to the features described above eyebrows were raised during Vince's keynote when he mentioned the IsNull() function for checking null database values and the multi-threaded ability of the CFDOCUMENT tag. I also think the MySQL 5 support is pretty cool. With all these new features and the ability of CFML to run on the .NET platform I believe responsible developers should look into BlueDragon 7. In the least, developers should be aware of what's out there and what alternatives there are to CFMX 7. I'm not endorsing Blue Dragon 7 with this article, I'm just helping get the information out there so people can be more tuned-in to the ColdFusion community and the products and tools available to ColdFusion development. If you're interested in learning more aboug BD7 the beta is slated to start later this month (or in August) with product release currently scheduled for October of this year.

Aaron West's Gravatar
About this post:

This entry was posted by Aaron West on July 4, 2006 at 12:33 PM. It was filed in the following categories: ColdFusion, CFUnited 2006. It has been viewed 12415 times and has 6 comments.

6 Responses to BlueDragon 7's New Features: A Detailed Look

  1. Vince Bonfanti's Gravatar Vince Bonfanti

    Hi Aaron,

    Threads created using CFTHREAD *do* run within their own thread pool, separate from the request threads; sorry this wasn't made clear. Also, we weren't able to cover all the CFTHREAD features in detail due to time constraints, so another item not discussed is the ability to set thread priorities, which is also implemented by CFTHREAD.

    Vince

  2. Vince, thanks for the clarification. I'm glad to hear there is a separate thread pool for CFTHREAD's. Are you able to talk about the management of this thread pool - specifically, if developers will be able to manage it via an admin like with CFMX 7?

  3. Vince Bonfanti's Gravatar Vince Bonfanti

    Yes, it's possible to manage threads created via CFTHREAD both programatically and from the admin console. For example, the GetAllThreads() function will return an array of all threads created via CFTHREAD. The ThreadRunningTime() function will tell you how long a single thread has been running, and the ThreadStop() method will allow you to kill a thread.

    Vince

  4. Awesome, thanks Vince.

  5. Adam Cameron's Gravatar Adam Cameron

    I have to say that the more I read about BD and the direction it's going, the more I think it's going more the direction I want a CFML server to go than CF is.

    I've got a major architectural / direction decision coming up soon, and reading stuff like this, as well as the word from my colleagues re comparing CF to BD (performance, useful features, accessibility of the New Atlanta BD team cf the Adobe CF team), and I think the scales might be swinging towards BD at present.

    And I never thought I'd say that.

    --
    Adam

  6. Adam, I'm glad to hear you are looking into whether BD is a fit for your work and needs. That's exactly the sentiment Vince has conveyed in recent blog posts and I tried to do the same with this one. I hope you found some useful insights here.

Leave a Reply

Leave this field empty

If you subscribe, any new posts to this thread will be sent to your email address.

RSS