clustering multiple instances in cold fusion

Post on 02-Dec-2014

104 Views

Category:

Software

5 Downloads

Preview:

Click to see full reader

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.

TRANSCRIPT

Clustering, Multiple Instances in

ColdFusion

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 : nareshe@mindfiresolutions.com / naresh.tulip@gmail.comSkype : mfsi_nareshe

Presenter: Naresh E, Mindfire Solutions

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

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.

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.

Load Balancing Clusters

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

Ex: Round RobinRandom weighted

● Round Robin and Round Robin with Sticky Sessions

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.

Importance of Sticky Sessions and Session Replication

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.

Round Robin with Sticky Sessions

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.

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”

Creating Instances

Creating Cluster and Adding Instances

Binding the cluster to the website in the web server

Using “wsconfig”

● 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)

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.

<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

Question and Answer

Thank You

top related