33
Clustering, Multiple Instances in ColdFusion

Clustering Multiple Instances in Cold Fusion

Embed Size (px)

DESCRIPTION

This presentation is for anyone who wants to know what Clustering is and how to implement it, in ColdFusion. Clustering of resources is done to provide redundancy and scalability.

Citation preview

Page 1: Clustering Multiple Instances in Cold Fusion

Clustering, Multiple Instances in

ColdFusion

Page 2: Clustering Multiple Instances in Cold Fusion

About Me:

Certifications:● MCP 70-480 : Programming in HTML5 with Javascript and CSS3● Adobe 9A0-127 : Adobe Certified Expert – ColdFusion 9

Skills: ColdFusion 8,9 and 10, Java, Spring MVC, jQuery, Ajax, SQL Server

Connect Me:Facebook : https://www.facebook.com/naresheLinkedIn : in.linkedin.com/pub/nareshe

Contact Me:Email : [email protected] / [email protected] : mfsi_nareshe

Presenter: Naresh E, Mindfire Solutions

Page 3: Clustering Multiple Instances in Cold Fusion

Agenda

1. Clustering?2.What is Failover?3. What is Load Balancing?4. Sticky Sessions and Session Replication.5. Creating Local/Remote Instances in ColdFusion.6. Clustering in ColdFusion.7. Binding a cluster to a site.

Presenter: Naresh E, Mindfire Solutions

Page 4: Clustering Multiple Instances in Cold Fusion

Clustering

What?● Clustering means combining two or more resources so that they appear as a

single resource.● Resources could be a web-server, database, hardware component etc..● Connected through fast LANs.

Why?● To support FailOver and Load Balancing i.e. redundancy and scalability.

Page 5: Clustering Multiple Instances in Cold Fusion

FailOver (HA) Clusters

1. RedundancyIf Something fails, whole application DOES NOT fail.

2. High AvailabilityLevel of Redundancy

3. ColdFusion clustering supports FailOver at the Instance Level.

Page 6: Clustering Multiple Instances in Cold Fusion

Load Balancing Clusters

● To handle more users.● Load is distributed.● Algorithms

Ex: Round RobinRandom weighted

● Round Robin and Round Robin with Sticky Sessions

Page 7: Clustering Multiple Instances in Cold Fusion

Clustering and ColdFusion

● Encapsulation and Failover at Instance Level● Two iterations of software clustering:

○ ClusterCATS ○ J2EE Clustering

● ClusterCATS○ Centralized Management - Failover at

web server level● J2EE Clustering

○ Peer-to-Peer at the ColdFusion server-instance level

● “admin” instance in JRun.

Page 8: Clustering Multiple Instances in Cold Fusion

Importance of Sticky Sessions and Session Replication

Page 9: Clustering Multiple Instances in Cold Fusion

Sticky Sessions and Session Replication

Sticky Sessions: ● Same session and same instance for each request.● To be used when the session data is less.

Session Replication:● Same session but different instances.● To be used when session data is large.● Change in server.xml required.

Page 10: Clustering Multiple Instances in Cold Fusion

Round Robin with Sticky Sessions

Page 11: Clustering Multiple Instances in Cold Fusion

Benefits:1. High processing capacity2. Failover protection3. High availability and High reliability4. Resource Consolidation & Optimal use of resources5. Best of all for some, instances reduce license cost.

Sample Scenarios:● Cost Effective- 1 CF Server, n instances● HA - n CF Servers, 1 IIS● Best - n CF Servers + n IIS

We will still require the use of a software or hardware clustering device to enable failover at the web server level.

Page 12: Clustering Multiple Instances in Cold Fusion
Page 13: Clustering Multiple Instances in Cold Fusion

Creating seminardemo.com site:

1. Create Application.cfc file with the following code:component{

this.application = "demoApplication";this.sessionmanagement = true;

}2. Create index.cfm with the following code:

<cfdump var = "#server#">3. Create a site in IIS, pointing to this code, with the default document as “index.cfm”.

Here, I created a site with the name “seminardemo.com”

Page 14: Clustering Multiple Instances in Cold Fusion

Creating Instances

Page 15: Clustering Multiple Instances in Cold Fusion
Page 16: Clustering Multiple Instances in Cold Fusion
Page 17: Clustering Multiple Instances in Cold Fusion
Page 18: Clustering Multiple Instances in Cold Fusion

Creating Cluster and Adding Instances

Page 19: Clustering Multiple Instances in Cold Fusion
Page 20: Clustering Multiple Instances in Cold Fusion
Page 21: Clustering Multiple Instances in Cold Fusion
Page 22: Clustering Multiple Instances in Cold Fusion

Binding the cluster to the website in the web server

Using “wsconfig”

Page 23: Clustering Multiple Instances in Cold Fusion
Page 24: Clustering Multiple Instances in Cold Fusion
Page 25: Clustering Multiple Instances in Cold Fusion

● Web-server requires a restart after mapping the cluster. Restart the webserver and trigger the URL of the page, with server dump, from two different browsers and check for the “rootdir” value.

● You will find that one request is handled by one instance and the other, by the second instance inspite of refreshing the page, when sticky sessions is enabled.

● If you uncheck the Sticky Sessions, while creating a cluster and then when you trigger the request from a browser and refresh it, we see that each time the instance is changed. (Session Replication)

Page 26: Clustering Multiple Instances in Cold Fusion

Creating Remote Instance1. Register the remote instance to the local machine.

2. Create a cluster in the local machine.

3. Open the cfroot\instance-name\runtime\conf\server.xml file of the remote instance.

4. Add the xml, in the next slide, just above the </host>.

5. In the xml added, update the membership port with the multicast port of the cluster.

6. Restart all the instances.

Page 27: Clustering Multiple Instances in Cold Fusion

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8"> <Manager notifyListenersOnReplication="true" expireSessionsOnShutdown="false" className="org.apache.catalina.ha.session.DeltaManager"> </Manager> <Channel className="org.apache.catalina.tribes.group.GroupChannel"> <Membership port="45564" dropTime="3000" address="228.0.0.4" className="org.apache.catalina.tribes.membership.McastService" frequency="500"> </Membership> <Receiver port="4003" autoBind="100" address="auto" selectorTimeout="5000" maxThreads="6" className="org.apache.catalina.tribes.transport.nio.NioReceiver"> </Receiver> <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"> <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"> </Transport> </Sender> <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"> </Interceptor> <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"> </Interceptor> </Channel> <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=""> </Valve> <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"> </Valve> <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"> </ClusterListener> <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"> </ClusterListener> </Cluster>

To be updated based on cluster’s multicast port number

Page 28: Clustering Multiple Instances in Cold Fusion
Page 29: Clustering Multiple Instances in Cold Fusion
Page 30: Clustering Multiple Instances in Cold Fusion

Question and Answer

Page 32: Clustering Multiple Instances in Cold Fusion

Thank You