The amazing adventures of Doug Hughes

Archive for May, 2008

HA – Clustering – Alagad Training Bootcamp

We have blogged many times around items related to clustering and high availability, as it relates to ColdFusion-JRun. In addition, I have been to several clients who broughtAlagad in because they wanted to improve application performance and where if ColdFusion Enterprise is installedthis often eventually involved clustering CF. So we have decided we are going to make all things relating to HA into a bootcamp style training offering. I worked on the theory of this coming back to LA from Webmaniacs in DC and there is no doubt in my mind that we can structure a one day class which would be based on my field work and intensely hands-on andwhich would involved the following:

  • Understanding the workingsClustering in CF-Jrun
  • Analyzing the effects of load testing in clusteredand non-clustered environments, the differences etc.
  • Hands-on installation of ColdFusion including the creation of a master instance.
  • Hands-on creation of instances and a cluster.
  • Hands-on installation of SeeFusion for monitoring tests.
  • Hands-on installation of aCF application and connecting to a web server with the web server configuration tool.
  • Hands-on creation of a load test script which will be run both against a single instance and a cluster.
  • Tuning of CF as the tests progress and analysis of logs.

As we already have a good deal of material we are looking to offer this initially around the time of CF United 2008 (June 18 – June 21st 2008). This will be a very practical and hands-on offering. More news on this soon. By the way, thank you to all those who attended my class at Webmaniacs, Mark Kruger kindly blogged about that here.

Derby != SQLite and Other Derby Myths

After chatting with some folks after my Derby presentation, I came to a realization that Derby, the Apache database, is still woefully misunderstood within the ColdFusion community. As Charlie Arehart describes, “Derby is the ColdFusion of the database world.” What he means by that is that Derby is misunderstood and underutilized. In this post, I am going to address some recurring ‘myths’ I have heard people discuss about Derby.

Myth #1 – Derby is just like SQLite
Derby is NOT SQLite. SQLite its the ‘lightweight’ database that is included as part of Adobe Integrated Runtime, Derby is the full featured database included with ColdFusion. To put it in terms that might make a bit more sense, Derby is SQL Server, SQLite is an Excel spreadsheet. I know that is not a true comparison, but in terms of functionality, its pretty close.

Myth #2 – Derby has limited functionality
With Derby you have a database that can go toe to toe with the big databse systems in terms of functionality. Derby supports user defined functions, stored procedures, triggers, views and constraints. To get a better idea of what Derby is capable of, take a look at the online documentation.

Myth #3 – You can only use Derby with ColdFusion 8
You can connect to Derby using JDBC drivers, so you can easily use Derby databases with ColdFusion going back to ColdFusion MX.

While there are other topics I have discussed with people, these are pretty much the “big 3” that I hear most frequently.

I plan to offer other posts that will shed somemore light on Derby and show it is a viable option for most web applications.

Advanced Model-Glue Presentation Materials

A couple of people asked me to post my presentation and sample code for the Advanced Model-Glue session I gave at WebManiacs. As such, they are attached to this blog entry.

Youll need both Model-Glue and Reactor for the sample application to work.

Web Maniacs Presentations – Derby and CFExchange

I just got home from Web Maniacs. Kudos to Fig Leaf for putting on another great conference.

Several people had asked for the presentations and files so I am posting them here.

Two conferences down, two to go.

CFExchange Presentation and Files

Derby Presentation

SES Urls in Model-Glue 3

Over the weekend there was a chain of messages on the Model-Glue list about how to get SES Urls working in Model-Glue 3. This is actually quite simple, but the best technique is not immediately apparent. Respondents on the mailing list had it pretty much right but missed an important capability of Model-Glue, which is enabled by the use of ColdSpring.

First off, Model-Glue 3 introduces the concept of a UrlManager. Most people will probably never have to deal with this component, but, behind the scenes this is what essentially populates the event with values from the URL and form scopes.

If you were to dig into the Model-Glue 3 core ColdSpring configuration file you would find a bean with an id of “modelglue.UrlManager” which is of type “ModelGlue.gesture.eventrequest.url.UrlManager.” If you were to look under the /ModelGlue/gesture/eventrequest/url directory you would find two files, UrlManager.cfc, which is the default URL Manager and SesUrlManager.cfc, which we are not configured to use.

The SesUrlManager.cfc is the URL manager you can use with SES Urls. This component knows how to parse urls with this format:


So, the question then becomes, how do I use the SesUrlManager instead of the standard UrlManager? Easy, just update Model-Glue’s configuration. There are two ways to do this.
The first and most obvious way is to edit Model-Glue’s core configuration file and change the “modelglue.UrlManager” bean to “ModelGlue.gesture.eventrequest.url.SesUrlManager.” However, this introduces a problem. Namely, every application which uses the instance of Model-Glue you edited will now be using the SesUrlManager, which you may not want.

The second and not-so-obvious way to do this is to simply define the “modelglue.UrlManager” bean into your application’s ColdSpring.xml file. Behind the scenes, when Model-Glue is loaded, in the /modelglue/modelglue.cfm file included by your index.cfm, the framework creates a ColdSpring bean factory and loads beans from the core Model-Glue configuration file. Then, it loads all the beans from your ColdSpring configuration file. Any beans in your ColdSpring configuration that already exist in ColdSpring are overwritten by your configuration.

So, by placing the “modelglue.UrlManager” into your configuration file you’re non-destructively overriding how the Model-Glue framework works. This is, quite frankly, my favorite feature of the framework. You can apply this same technique to any ColdSpring-configured Model-Glue object. I actually wrote a blog entry on this a while back: “Extending Model-Glue via ColdSpring.” I’ll be talking on this and other Advanced Model-Glue topics at both WebManiacs and CFUnited!

The Differences Between This and Variables

This morning I received an email from Jason, whom I met at CF.United():

We are working to adopt/increase OO in our environment. We were debating over what may be best practice for object properties as far as ColdFusion components are concerned. For example:

<cffuntion name="init" ...>
	<cfset = "bar">


<cffuntion name="init" ...>
	<cfset = "bar">

From the conference, conventions seemed mixed. We understand from blogs the benefits of the later example from a practice standpoint in mirroring OOP. However, are you aware of any performance advantage or future directions of either? One of use remembered hearing something particular about using “this”.

First, allow me to give a little background for those who may be new to the concept. In the same way that ColdFusion provides a plethora of scopes including the variables, request, session, and application scopes, CFCs provide two scopes of their own: “this” and variables.

The “this” scope is public. Anything can set values into this scope from outside the component. Essentially, it treats a component like a structure with methods. The result is that you have no protection over the data in your component. Programmers can accidentally (or intentionally) add bad data into your CFC which may break it or change its behavior in ways you do not want or intend.

In CFCs the variables scope is private. Only the component itself can write to the variables scope. This allows you to hide the component’s data and control and validate access via methods on your component. Getters and setters are typically created for this purpose. This also allow you to do more than just set values. For example, let’s say your component had an email address property. When you call setEmailAddress(), the setter could set variables.emailAddress, but it could also split the string on the @ sign and set variables.username and variables.domain as well.

Well, to directly answer your question, use of the “this” scope is faster. Presumably, this is because each function in a CFC is compiled down to a Java class. Orchestrating all the Java classes required for a CFC instance may add some overhead. In fact, In Model-Glue 3 Joe is actually preferring the use of the this scope due to the performance benefits and the ease of programming.

I’m still a fan of the variables scope with getters and setters. I like the notion that, if I need to, I can change the implementation of these functions. So, if I initially had an email address property that was accessed via a getter and setter I could add validation and/or the extra logic to set the username and domain without breaking the rest of my system. If I were using the this scope I would be unable to do that without modifying any code that touches the CFC. But, I pay a price for that in the time it takes to write the extra code and the overhead that extra code adds.

Beyond that, the use of “instance” variable in the variables scope is not even really a convention. Some people like it because they can now copy variables.instance out of the component easily. I don’t tend to do this.

HA High Availability – Great Discussion

This might seem like an odd thing to do, as what I am going do do here is simply add a link to one of our previous blog posts. The reason is that there is a really interesting and informative discussion going on about High Availability (HA), on Windows 2003 and ColdFusion. There is some very informative information there and this is not theory but an actaul user adding their experiences with HA and clustering.

You can view it here if you go to the comments section.

Tag Cloud