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:

/index.cfm/variable1/value1/variable2/value2</p>

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 this.foo = "bar">

Vs.

<cffuntion name="init" ...>
	<cfset variables.instance.foo = "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.

CF.Objective() '08 and Alagad

This is my third day back from CF.Ojective() ’08 and I think I have almost caught up on sleep. No matter what your purpose, attending a conference is all work. You’re attending sessions, talking with other developers and sponsors, or networking. Not to mention staying up late for social events. Individually, each of these can be exhausting. Collectively they can be overwhelming. As a sponsor who is also speaking you get no breaks. Despite the fact that I still want to sleep through the day, the conference was fantastic. I may be a bit biased, but trust me, Jared put on a good show.

CF.Objective() was the first conference Alagad has ever sponsored. This was a new thing for me, being on the other side of the table. Our purpose there was to help people learn about Alagad and what it is that we do. In particular I spent a lot of time talking to people and informing them of Alagad’s Object Oriented and Framework-based Coldfusion expertise.

A recurring theme was that a lot of companies are really feeling the pain of years of procedural development and they were wondering if Alagad could help them refractor their application to OO and Frameworks and what the techniques for that are. The short answer is yes, and the techniques vary depending on the client’s goals. Overall, I really sensed that ColdFusion shops are actively working to embrace enterprise development techniques.

We also spoke with a lot of people about our Performance Tuning and clustering services. Mike Brunt, our specialist in that area, was on hand to teach a class on clustering. It was really interesting to see how many people are exchanged knowing glances when I asked them about their applications’ performance and stability. It seems that many people are having challenges in this area. However, they are beginning to realize that you can and should load test your applications and tune you JVM to get the best performance and stability out of your application. We are also happy to lend a guiding hand where we can, of course.

Other recurring topics were, as would be expected, training and the various Alagad products. I think the community really understands that Alagad is much more than just the Image Component.

We handed out quite a bit of schwag. We handed out about 50 or so Coffee mugs and couple hundred pens. In addition to that, we had a drawing where Andrew Gscheidle won an iPod nano and Mark Mandel won a Wii!

CF.Objective '08

Lastly, it was fun having everyone by the booth. Here are a few more photos for good measure.

CF.Objective '08

CF.Objective '08

CF.Objective '08

CF.Objective '08

My Job is Done! Everyone in the World Knows Model-Glue!

Ok, so that’s not true. But, whether you know it or not, Alagad is teaching two full-day classes before the CFUnited 08 conference. Jared is teaching “ColdFusion’s AJAX Advantage,” a class on ColdFusion’s AJAX features. I’m supposed to be teaching “Introduction To Model-Glue,” a one-day crash course to help developers new to Model-Glue get started.

Unfortunately, though Jared leads the rest of the classes in registrants, my Model-Glue class has no registrants yet. (Thus everyone already knows Model-Glue?) At this point it looks like the class will be canceled. This is bad and good. It’s bad because I apparently did a bad job of marketing the class. But it’s good because it frees up an already-committed room at the conference where I can teach you whatever you might want to know about ColdFusion and most ColdFusion frameworks.

At this point I’m wondering if there are any companies who would like customized training on any particular topic for their team? I’m happy to take a class of, perhaps 6 people and teach them the Model-Glue content and tailor it to their needs or to teach them something else entirely.

We’re also evaluating changing the topic and having Mike Brunt teach a full day class on load testing and performance tuning applications.

I’d like to get your feedback on what you or your company might pay $450 per person for. What’s does your company need help with?

A Possible Problem When Using Hardware Clustering

I presented at CF.Objective on the subject of clustering and distributing ColdFusion applications. During the presentation I pointed out a “gotcha” I have encountered many times; where I have been asked to review existing High Availability (HA) environments. It has been mentioned before in previous blog posts but I wanted to amplify it, as I believe it is very important to avoid this pitfall. Hardware clustering devices can and often do, perform two distinct functions.

  1. Failover – The device watches all members in the cluster it manages to make sure they are available. If one member fails, the hardware clustering device will stop sending requests to it.
  2. Load Balancing – The device sends requests around the cluster members based on whatever algorithm is chosen; RoundRobin, LeastConnections etc. The idea being to spread the load in an even manner across all members.

In the first of these functionalist (FAILOVER), the clustering device needs a way to know whether members in the cluster are available. Typically this is achieved by the clustering device “pinging” cluster members. How this is done is critical as the pinging itself can cause performance issues, if not done carefully and properly. Here are things I have found, with comments.

  • The hardware clustering device simply looks for an http “200” response from the cluster members. This sounds innocuous however if the default website in the web server is a “heavy” ColdFusion site with lots going on in the root directory, for instance lots of things in the Application.cfm-Application.cfc and Index.cfm these will run with every single “ping” from the clustering device. I have seen that cause performance problems, particularly if the “pings” are very frequent – 3-5 second intervals.
  • The hardware clustering device pings a ColdFusion page buried-located with in a “heavy” ColdFusion application, for instance lots of things in the Application.cfm-Application.cfc and Index.cfm these will run with every single “ping” from the clustering device. I have seen that cause performance problems, particularly if the “pings” are very frequent – 3-5 second intervals.

Neither of these situations are good ones to have and both can be avoided. The best way to do this, in my experience, is to create a “lightweight” ColdFusion page which returns a simple text string which is retrieved by a query for a database. By doing this, successfully, we can ascertain that the Web Server, ColdFusion and the Database Server are all responding and available. This page should located outside of any full-blown CF applications, unless it can be assured that no “heavy-lifting” takes place when the main application runs.

Tag Cloud