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.
- 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.
- 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.