Author: pero Date: Tue Apr 11 09:20:28 2006 New Revision: 393256 URL: http://svn.apache.org/viewcvs?rev=393256&view=rev Log: JvmRouteBinderValve now support also sessionid rewriting from request parameter jsessionid, Add documentation for this valve to cluster-howto.xml. :-)
Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java tomcat/container/tc5.5.x/webapps/docs/changelog.xml tomcat/container/tc5.5.x/webapps/docs/cluster-howto.xml Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java?rev=393256&r1=393255&r2=393256&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java Tue Apr 11 09:20:28 2006 @@ -45,12 +45,13 @@ * Valve to handle Tomcat jvmRoute takeover using mod_jk module after node * failure. After a node crashed the next request going to other cluster node. * Now the answering from apache is slower ( make some error handshaking. Very - * bad with apache at my windows.). We rewrite now the cookie jsessionid + * bad with apache at my windows.). We rewrite now the jsessionid * information to the backup cluster node. After the next response all client * request goes direct to the backup node. The change sessionid send also to all * other cluster nodes. Well, now the session stickyness work directly to the * backup node and traffic don't go back too restarted cluster nodes! - * + * As jsessionid was created by cookie, the change JSESSIONID cookie resend with next response. + * * At all cluster node you must configure the as ClusterListener since 5.5.10 * [EMAIL PROTECTED] org.apache.catalina.cluster.session.JvmRouteSessionIDBinderListener JvmRouteSessionIDBinderListener} * or before with @@ -90,7 +91,7 @@ /** * The descriptive information about this implementation. */ - protected static final String info = "org.apache.catalina.cluster.session.JvmRouteBinderValve/1.2"; + protected static final String info = "org.apache.catalina.cluster.session.JvmRouteBinderValve/1.3"; /*--Instance Variables--------------------------------------*/ @@ -225,12 +226,7 @@ log.warn(sm.getString("jvmRoute.missingJvmRouteAttribute")); return; } - if (request.isRequestedSessionIdFromURL()) { - if (log.isDebugEnabled()) - log.debug(sm.getString("jvmRoute.skipURLSessionIDs")); - } else { - handleJvmRoute( request, response,session.getIdInternal(), jvmRoute); - } + handleJvmRoute( request, response,session.getIdInternal(), jvmRoute); if (log.isDebugEnabled()) { long t2 = System.currentTimeMillis(); long time = t2 - t1; @@ -352,7 +348,8 @@ catalinaSession.setId(newSessionID); if (catalinaSession instanceof DeltaSession) ((DeltaSession) catalinaSession).resetDeltaRequest(); - setNewSessionCookie(request, response,newSessionID); + if(request.isRequestedSessionIdFromCookie()) + setNewSessionCookie(request, response,newSessionID); // set orginal sessionid at request, to allow application detect the // change if (sessionIdAttribute != null && !"".equals(sessionIdAttribute)) { Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=393256&r1=393255&r2=393256&view=diff ============================================================================== --- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original) +++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Tue Apr 11 09:20:28 2006 @@ -105,12 +105,19 @@ </subsection> <subsection name="Cluster"> <changelog> + <update> + Add JvmRouteBinderValve documentation at cluster-howto.xml. (pero) + </update> + <add> + JvmRouteBinderValve now supports now sessionid's from request and cookies. + Thanks to Brian Stansberry for reporting it. (pero) + </add> <fix> <bug>38779</bug> Fix wrong jmx message arg at SimpleTcpCluster at o.a.c.cluster.tcp.mbeans-descriptors.xml, submitted by Pawel Tucholski (pero) </fix> <fix> - Fix that after every Keep Alive Socket close a log warning is generated TcpReplicationThread (pero) + Fix that not after every "Keep Alive Socket close" a log warning is generated at TcpReplicationThread (pero) </fix> <fix> <bug>39178</bug>: Now ROOT.war deployment with FarmWarDeployer is possible (pero) Modified: tomcat/container/tc5.5.x/webapps/docs/cluster-howto.xml URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/webapps/docs/cluster-howto.xml?rev=393256&r1=393255&r2=393256&view=diff ============================================================================== --- tomcat/container/tc5.5.x/webapps/docs/cluster-howto.xml (original) +++ tomcat/container/tc5.5.x/webapps/docs/cluster-howto.xml Tue Apr 11 09:20:28 2006 @@ -854,7 +854,8 @@ autoConnect="true" maxPoolSocketLimit="10" keepAliveTimeout="-1" - keepAliveMaxRequestCount="10000"/> + keepAliveMaxRequestCount="10000" + waitForAck="true" /> </source> </p> </section> @@ -962,6 +963,51 @@ With <em>Cluster.setProperty(<String>,<String>)</em> you can modify attributes for all register managers. The method exists as MBeans operation. </p> +</section> + +<section name="Bind session after crash to failover node"> +<p> +As you configure more then two nodes at same cluster for backup, most loadbalancer +send don't all your requests after failover to the same node. +</p> +<p> +The JvmRouteBinderValve handle tomcat jvmRoute takeover using mod_jk module after node +failure. After a node crashed the next request going to other cluster node. The JvmRouteBinderValve +now detect the takeover and rewrite the jsessionid +information to the backup cluster node. After the next response all client +request goes direct to the backup node. The change sessionid send also to all +other cluster nodes. Well, now the session stickyness work directly to the +backup node, but traffic don't go back too restarted cluster nodes!<br/> +As jsessionid was created by cookie, the change JSESSIONID cookie resend with next response. +</p> +<p> +You must add JvmRouteBinderValve and the corresponding cluster message listener JvmRouteSessionIDBinderListener. +As you add the new listener you must also add the default ClusterSessionListener that receiver the normal cluster messages. + +<source> +<Cluster className="org.apache.catalina.tcp.SimpleTcpCluster" > +... + <Valve className="org.apache.catalina.cluster.session.JvmRouteBinderValve" + enabled="true" sessionIdAttribute="takeoverSessionid"/> + <ClusterListener className="org.apache.catalina.cluster.session.JvmRouteSessionIDBinderListener" /> + <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener" /> +... +<Cluster> +</source> +</p> +<p> +<b>Hint:</b><br/> +With attribute <i>sessionIdAttribute</i> you can change the request attribute name that included the old session id. +Default attribuite name is <i>org.apache.catalina.cluster.session.JvmRouteOrignalSessionID</i>. +</p> +<p> +<b>Trick:</b><br/> +You can enable this mod_jk turnover mode via JMX before you drop a node to all backup nodes! +Set enable true on all JvmRouteBinderValve backups, disable worker at mod_jk +and then drop node and restart it! Then enable mod_jk Worker and disable JvmRouteBinderValves again. +This use case means that only requested session are migrated. +</p> + </section> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]