geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache Geronimo v2.1 > Tomcat Native Clustering
Date Fri, 25 Dec 2009 20:06:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=GMOxDOC21&amp;forWysiwyg=true"
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="">Tomcat
Native Clustering</a></h2>
     <h4>Page <b>edited</b> by             <a href="">Ashish
     <div class="notificationGreySide">
         <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/GMOxDOC21/Farming"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/GMOxDOC21/Farming">Farming</a>&nbsp;</td><td
width='33%' class='ScrollbarParent'><sup><a href="/confluence/display/GMOxDOC21/Clustering"><img
border='0' align='middle' src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/GMOxDOC21/Clustering">Clustering</a></td><td width='33%'
class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/GMOxDOC21/WADI+Clustering+Support">WADI
Clustering Support</a></td><td class='ScrollbarNextIcon'><a href="/confluence/display/GMOxDOC21/WADI+Clustering+Support"><img
border='0' align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>

<p>The Tomcat Web container provides a native clustering solution that can be configured
through Geronimo using gbean definitions within config.xml or your deployment descriptors
. This document will go through the available GBeans and how to configure them for clustering
in a Geronimo server with a tomcat web container.<br/>
A cluster configuration should be considered when you want to improve the scalability and
availability of your Web application. The following sections provide detailed instructions
on how to set up your cluster nodes and how to deploy your applications with tomcat clustering

    <li><a href='#TomcatNativeClustering-Settingupaclusteringenvironment'>Setting
up a clustering environment</a></li>
    <li><a href='#TomcatNativeClustering-Planningyourcluster'>Planning your cluster</a></li>
    <li><a href='#TomcatNativeClustering-PreparingyourWebapplication'>Preparing
your Web application</a></li>
    <li><a href='#TomcatNativeClustering-EnableSessionAffinity'>Enable Session

<h1><a name="TomcatNativeClustering-Settingupaclusteringenvironment"></a>Setting
up a clustering environment</h1>
<p>Generally, to set up a small cluster you will need at least 2 nodes and 1 HTTP server.
The HTTP server is used to serve requests from clients and ensure well-balanced traffic load
among different nodes. Similarly, each node is configured to use the same logical Tomcat engine
and enable session affinity.</p>

<h1><a name="TomcatNativeClustering-Planningyourcluster"></a>Planning your
<p>The Tomcat cluster replicates HTTP session data via memory to memory multicast communication.</p>

<p>Every node transmits its session data to every node in the cluster. This algorithm
is only efficient when the clusters are small. If the clusters grow too large, the overhead
in storage utilization and network traffic becomes excessive. To avoid excessive overhead,
consider dividing your nodes into several smaller clusters.</p>

<p>HTTP session data is replicated among the nodes in the cluster using a multicast
broadcast. All nodes in the cluster must be on the same physical subnet and multicast broadcast
must be supported by that subnet.</p>

<h1><a name="TomcatNativeClustering-PreparingyourWebapplication"></a>Preparing
your Web application</h1>
<p>To participate in a cluster configuration, your Web application must be implemented

	<li>Ensure that every object placed in the HTTP session implements
The clustering feature serializes the objects when it distributes them to the other nodes
in the cluster.</li>
	<li>The deployment descriptor for your Web application, that is the <tt>web.xml</tt>
file in the Web archive, must indicate that your Web application is distributable. To do this,
insert the <b>distributable</b> element in the deployment descriptor.
<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeHeader
panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><b>Excerpt
from web.xml</b></div><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;?xml version=<span class="code-quote">"1.0"</span>
encoding=<span class="code-quote">"ISO-8859-1"</span>?&gt;</span>
&lt;!DOCTYPE web-app
    PUBLIC <span class="code-quote">"-//Sun Microsystems, Inc.//DTD Web Application
    <span class="code-quote">""</span>&gt;

<span class="code-tag">&lt;web-app&gt;</span>
    <span class="code-tag">&lt;display-name&gt;</span> ... <span class="code-tag">&lt;/display-name&gt;</span>
    <span class="code-tag">&lt;description&gt;</span> ... <span class="code-tag">&lt;/description&gt;</span>
    <span class="code-tag">&lt;distributable&gt;</span> <span class="code-tag">&lt;distributable/&gt;</span>
<span class="code-tag">&lt;/web-app&gt;</span>

	<li>Do not use stateful session Enterprise JavaBeans (EJBs). The clustering feature
does not replicate stateful EJBs among the nodes in the cluster.</li>
	<li>If your Web application uses a database, make sure the database can be accessed
from every node in the cluster. Ensure that the proper JDBC drivers are installed on every
node and that the datasource objects are defined correctly on every node.</li>
	<li>Do not depend on dynamic updates to the Java Naming and Directory Interface (JNDI).
You will need to configure all the JNDI names used by your application in every node of the
cluster. The clustering feature does not replicate JNDI changes among the nodes in the cluster.</li>

<h1><a name="TomcatNativeClustering-EnableSessionAffinity"></a>Enable Session

<p>Support for session affinity, also known as sticky session support, allows a load
balancing service to route an HTTP request back to the same node that created the HTTP session
associated with that request until that node fails. You must use session affinity if you configure
an asynchronous type of session replication. With asynchronous replication, the reply is returned
before the HTTP session is replicated so there is always a chance that the next request using
that session arrives before the replication is complete. In this case, the only way to ensure
that the request is processed using the correct session data is to route the request to the
node that sent the reply to the last request and originated the replication.</p>

<p>For every node in the cluster, update config.xml as follows after the server is stopped</p>

<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeHeader
panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><b>Excerpt
from config.xml</b></div><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;gbean name=<span class="code-quote">"TomcatEngine"</span>&gt;</span>
  <span class="code-tag">&lt;attribute name=<span class="code-quote">"initParams"</span>&gt;</span>
  <span class="code-tag">&lt;/attribute&gt;</span>
<span class="code-tag">&lt;/gbean&gt;</span>

     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>

       <a href="">View
       <a href="">View
       <a href=";showCommentArea=true#addcomment">Add

View raw message