Scaling with ColdFusion MX 7 Load Balancing
New to ColdFusion MX 7 Enterprise Edition is integrated load balancing and failover, with the capability to create and manage a cluster directly from the ColdFusion Administrator. ColdFusion MX 7 Load Balancing monitors your ColdFusion MX 7 servers and can redirect requests away from a server that is beginning to enter a busy state. When ColdFusion Load Balancing redirects requests to another server, it does so by redirecting them to the URL of another machine in the cluster. If your server is completely out of commission (that is, turned off), ColdFusion Load Balancing cannot communicate with it and therefore cannot redirect requests away from it.Perhaps the most attractive aspect of using ColdFusion MX 7 Load Balancing for load-balancing solutions is its integration with ColdFusion MX 7. ColdFusion MX 7 Load Balancing is extremely easy to configure and set up, unlike many other software and hardware load-balancing solutions.
Understanding ColdFusion MX 7 Load Balancing
ColdFusion Load Balancing consists of server and client components. The server component runs on the ColdFusion MX 7 server. ColdFusion MX 7 Load Balancing Explorer is the client-management facility for building and managing clusters. Each of these components plays a critical role in the configuration and support of your ColdFusion MX 7 Load Balancing clusters. The server component manages the server's contact with the cluster. The client component allows management of the cluster, creation of alarms, and cluster monitoring.CAUTION
Be sure to test your Web site when redirection occurs from one Web server to another. To function properly, your application may need to compensate for path variables or employ session-state management.NOTEAlthough you can have a cluster consisting of a mix of Unix-, Solaris-, and Windows-based servers running ColdFusion MX 7 Load Balancing, you must have at least one Windows machine to run the ColdFusion MX 7 Load Balancing Explorer, or to run ColdFusion MX 7 Load Balancing Web Explorer for Unix clusters.
Configuring a Load Balanced Cluster
Setup and configuration of ColdFusion MX 7 Load Balancing is very simple. But before we walk through the process, there are a few things you need to do before you deploy your cluster.First, confirm that all instances of ColdFusion you want to cluster are set up identically, with exactly the same databases, code, mappings, and so on.If you are going to use session failover, make sure you turn on J2EE sessions in the ColdFusion Administrator, and enable session replication for each server. This will allow your session data to be shared across systems in the cluster, so if one ColdFusion instance is unavailable, your users' requests will be routed to another free server without session data being lost.Multiple ColdFusion Instances." If you have multiple remote servers, the same steps will be applicable.
1. | Check that all ColdFusion server instances have been created and that applications and databases have been deployed. |
2. | Open the ColdFusion MX 7 Administrator, select Enterprise Manger in the navigation panel, and then select Cluster Manager. You'll see the window in Figure 3.9.Figure 3.9. Adding a new cluster via the ColdFusion MX 7 Cluster Manager.[View full size image] ![]() |
3. | Name your cluster and click Add. Your cluster will be displayed in the Configured Clusters area. |
4. | Select your cluster and click on the Edit icon next to the name. The Edit Cluster window is displayed (Figure 3.10).Figure 3.10. Editing a cluster in the ColdFusion MX 7 Cluster Manager.[View full size image] ![]() |
5. | Using the arrow buttons, add the instances you want to cluster. |
6. | If you want to share session information over the cluster, enable the Replicate Sessions option and select a cluster algorithm. Then click Submit.NOTEWhen you enable the Sticky Sessions option, the connector does not always route requests based strictly on the cluster algorithm. For more information, see Administrator Online Help. |
7. | You may need to restart each instance of JRun/ColdFusion MX 7. In addition, check your system to ensure that everything is functioning correctly. It's a good idea to check every instance of ColdFusion; verify that things like data sources, mappings, Verity Collections, and so forth are all deployed correctly. If you're using session replication, make sure each instance is also using J2EE sessions and session replication.NOTEColdFusion components do not support session replication. When designing your ColdFusion applications, keep this in mind when you build persistence mechanisms. |
8. | If your ColdFusion MX 7 servers are not on the same subnet, you'll need to edit the JRun security properties file (found at jrun_root/lib/security.properties). Add the IP addresses of all the other servers in the cluster to the jrun.trusted.hosts property. If all your servers are on the same subnet, you can ignore this step. |
9. | Now bind your cluster to a Web site.Start the Web Server Configuration Tool (Start > All Programs > Macromedia > ColdFusion MX 7 > Web Server Configuration Tool) or navigate to jrun_root\bin\wsconfig.exe and run the Tool.Select the Web site to which you want to connect. Instead of choosing a single server instance, select the cluster. See Figure 3.11 for an example.Figure 3.11. Deploy an existing archive with Web Server Connector Tool.![]() |
10. | Now go to each instance's jrun.xml file, which should be in jrun_root\ servers\ \SERVER-INF\jrun.xml. Make sure that the entry for the ProxyService deactivated attribute is set to false, like this:
|
11. | Finally, you can now test to see if your cluster is working correctly. |
If your server is up and running and you want to take it out of the cluster for maintenance, you can simply remove the instance(s) for that server from the cluster via the ColdFusion MX 7 Administrator. When you're finished with maintenance, you can simply add the instance(s) back in. Or, if you want to add more ColdFusion MX 7 servers to the cluster, simply add them via the ColdFusion MX 7 Administrator. Nothing could be simpler.TIPYou may notice that ColdFusion MX 7 allows you to weight ColdFusion servers for situations where you have systems with different resourcessuch as one server that has four CPUs and 4 GB of memory, compared with a server that has two CPUs and one gig of data. You can give the four-CPU server a higher weight, which will make the ColdFusion MX 7 Load Balancer refer a large percentage of server requests to that server.