Advanced Macromedia ColdFusion MX 7 Application Development
Scaling with ColdFusion MX for J2EE Application Server with JRun is very similar to scaling with ColdFusion. Indeed, as discussed in Chapter 3, ColdFusion MX 7 can use JRun's clustering functionality for both load balancing and failover. All JRun services are clusterable and JVM pooling can be invoked, creating a highly scalable Web site architecture. There are three levels of clustering available for ColdFusion on JRun: connector clustering, Web server clustering, and object clustering. Connector clustering can be implemented by installing J2EE Connectors on the Web servers, allowing them to natively connect to the application server. These connectors can help maintain session state. Session persistence is maintained through connecting to a centrally located database store using JDBC or through a shared file. JRun clusters can be created and managed through the Java Management Console (JMC). Deployment services are also provided. Steps to set up object clusters will be defined shortly. Creating multiple instances of your JRun server will allow you to scale physically across multiple servers as well as on each server. Running multiple instances of JRun is called JVM pooling or cloning. Multiple instances of JRun are managed with the Web server connector plug-in. Three different algorithms for load balancing are offered: round robin, weighted round robin, and weighted random. If the JRun server fails, the connector automatically fails over to another JRun server in the cluster. To create multiple JRun instances on one JRun server, open the JMC and click Create New Server, as seen in Figure 4.7. Follow the wizard by inputting a unique server name, and click Create Server to create the server. Update the server URL and ports numbers, and click Finish. Adding this server to a cluster is described in the next section, "Configuring a Cluster." Figure 4.7. Creating a new server in JRun.
Object clustering uses the Jini lookup service. Each JRun server contains a service called the ClusterManager, which encapsulates the Jini lookup service. ClusterManagers work together in a peer-based fashion to provide cluster administration, thus eliminating the single-point-of-failure issue. Each service that is clustered can join the lookup service either by multicast or unicast IP packet methods. Multicasting allows a single IP packet to be received by multiple systems. This limits network traffic and makes one-to-many or many-to-many network services possible. Unicast is defined, as is the more traditional method for sending IP packets, in which each server sends an individual IP pack to each receiving server. Configuring a JRun Cluster
To create a cluster with JRun, open the JMC. Click the Create New Cluster link to open the Creating a New JRun Cluster window (see Figure 4.8). Input the new cluster name; in this example, the cluster name is mycompany. Click Next, and in the next window select all servers to add to the cluster (see Figure 4.9). Click Next again, and the cluster is now set up, as shown in Figure 4.10. Figure 4.8. Creating a new JRun cluster.
Figure 4.9. Add servers to the new cluster.
Figure 4.10. Cluster setup is complete.
Managing a JRun Cluster
After you have created your cluster using the JMC, you can work with your cluster to fine-tune its settings and to manage your Web site deployments. You can refine the settings in your cluster and add componentssee Figure 4.11 for cluster management options. Enterprise applications, Web applications, Java Beans, and deployment settings can be added or changed. The deployment settings let you set and control how deployments are performed on servers in your cluster. Notice the two instances of JRun server: default and newServer. Figure 4.11. Cluster management options for mycompany in JRun.
To deploy your JRun applications, add an EAR or WAR file into one of the auto-deployment directories on one of the servers in the cluster. Creating an EAR or a WAR file is not explained here, but is covered in depth in Chapter 6, "Deploying Applications." In a live production environment, it's important to turn off the hot deployment feature on each server in the cluster, as shown in Figure 4.12. This is done to ensure that the deployment to each server is fully deployed when the server is restarted. Figure 4.12. Deployment settings for mycompany cluster with hot deploy turned off.
Restart each server in the cluster and verify the deployment. Click on the cluster name, and then click on J2EE components. On the summary page, you can view all deployed components. NOTE A WAR file is a J2EE Web application archive. An enterprise archive (EAR) file is a collection of WAR files, JAR files (EJBs), and other related files, including the application XML file.
|