Discussion:
sticky session failover
Len Takeuchi
2010-03-26 21:21:50 UTC
Permalink
Hello,

I have apache load balancing a number of tomcat instances using mod_jk
using sticky session. This is all working with the session id having
the jvmRoute appended. I am storing the session using persistent
manager using jdbc. I want to have failover for session as supported by
JvmRouteBinderValve. Is this possible to set up in an environment where
multicast is not supported? Do I need to set up a Cluster though I
don't need session replication since I'm using persistent manager for
session storage so all tomcat instances have access to session data?
What I want is just the JvmRouteBinderValve behavior of changing the
session id to the new jvmRoute and setting cookie when a tomcat instance
receives a session request from a different jvmRoute.

Regards,
Len
Arunkumar Janarthanan
2010-03-28 00:35:39 UTC
Permalink
Len,

Do you have a the "nofailover" parameter disabled ? this can help users
continue served by the working tomcat instances in-case of the tomcat
instance which cookie parameter set fails / not available.



<Proxy balancer://abc>
BalancerMember ajp://prod1:8081 route=app1
BalancerMember ajp://prod2:8081 route=app2
BalancerMember ajp://prod3:8081 route=app3
ProxySet stickysession=JSESSIONID
ProxySet nofailover=Off
</Proxy>
Post by Len Takeuchi
Hello,
I have apache load balancing a number of tomcat instances using mod_jk
using sticky session. This is all working with the session id having
the jvmRoute appended. I am storing the session using persistent
manager using jdbc. I want to have failover for session as supported by
JvmRouteBinderValve. Is this possible to set up in an environment where
multicast is not supported? Do I need to set up a Cluster though I
don't need session replication since I'm using persistent manager for
session storage so all tomcat instances have access to session data?
What I want is just the JvmRouteBinderValve behavior of changing the
session id to the new jvmRoute and setting cookie when a tomcat instance
receives a session request from a different jvmRoute.
Regards,
Len
Len Takeuchi
2010-03-28 17:40:48 UTC
Permalink
Hi Arunkumar,

The failover is working. What I need is the tomcat instance to which
failover occurs assumes ownership of the sticky session, by that the session
id has to be changed to use that tomcat instance's jvmRoute and cookie has
to be reset, otherwise it is no longer sticky session since requests for tha
session will be sent to ANY of the other tomcat instances configured by load
balancing. I believe this transfer of sticky session ownership done by
renaming of the session and resetting the cookie is performed by
JvmRouteBinderValve which is configured as part of a Cluster configuration.
My problem is that I'm not using cluster session replication because my
environment doesn't support multicast. I'm using PersistentManager for
session persistence using jdbc as mentioned. I don't think it is possible
to successfully configure a Cluster in this case (no multicast and using
PersistentManager instead of session replication) but a Cluster
configuration is required to configure JvmRouteBinderValve. I'm wondering
what my options are in this case. Do I have to write my own valve to do
what JvmRouteBinderValve does but that works without a cluster
configuration? Is my understanding correct?

Regards,
Len

-----Original Message-----
From: Arunkumar Janarthanan [mailto:***@gmail.com]
Sent: March-27-10 5:36 PM
To: Tomcat Users List
Subject: Re: sticky session failover

Len,

Do you have a the "nofailover" parameter disabled ? this can help users
continue served by the working tomcat instances in-case of the tomcat
instance which cookie parameter set fails / not available.



<Proxy balancer://abc>
BalancerMember ajp://prod1:8081 route=app1
BalancerMember ajp://prod2:8081 route=app2
BalancerMember ajp://prod3:8081 route=app3
ProxySet stickysession=JSESSIONID
ProxySet nofailover=Off
</Proxy>
Post by Len Takeuchi
Hello,
I have apache load balancing a number of tomcat instances using mod_jk
using sticky session. This is all working with the session id having
the jvmRoute appended. I am storing the session using persistent
manager using jdbc. I want to have failover for session as supported by
JvmRouteBinderValve. Is this possible to set up in an environment where
multicast is not supported? Do I need to set up a Cluster though I
don't need session replication since I'm using persistent manager for
session storage so all tomcat instances have access to session data?
What I want is just the JvmRouteBinderValve behavior of changing the
session id to the new jvmRoute and setting cookie when a tomcat instance
receives a session request from a different jvmRoute.
Regards,
Len
Mark Thomas
2010-03-28 18:26:48 UTC
Permalink
Post by Len Takeuchi
My problem is that I'm not using cluster session replication because my
environment doesn't support multicast. I'm using PersistentManager for
session persistence using jdbc as mentioned. I don't think it is possible
to successfully configure a Cluster in this case (no multicast and using
PersistentManager instead of session replication) but a Cluster
configuration is required to configure JvmRouteBinderValve.
Nope. This was fixed last year:
http://svn.apache.org/viewvc?view=revision&revision=794822

Mark
Len Takeuchi
2010-03-28 20:18:28 UTC
Permalink
Hi Mark,
Nope. This was fixed last year: http://svn.apache.org/viewvc?
view=revision&revision=794822
Mark
Thanks very much for you quick response. That's great that
JmvRouteBinderValve works with PersistentManager. I tried to configure it
by putting JvmRouteBinderValve config inside a Manager as below but this did
not seem to take effect:

<Manager className="org.apache.catalina.session.PersistentManager"
maxIdleBackup="0" saveOnRestart="true">
<Store className="org.apache.catalina.session.JDBCStore"
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/xxx"
connectionName="xxx"
connectionPassword="xxx"/>
<Valve
className="org.apache.catalina.cluster.session.JvmRouteBinderValve"/>
</Manager>

What is the correct way to configure JvmRouteBinderValve with
PersistentManager?

Regards,
Len
Caldarale, Charles R
2010-03-28 20:26:22 UTC
Permalink
Post by Len Takeuchi
Subject: Re: sticky session failover
I tried to configure it by putting JvmRouteBinderValve
config inside a Manager
To quote from the doc:

"A Valve element represents a component that will be inserted into the request processing pipeline for the associated Catalina container (Engine, Host, or Context)."

Note that <Manager> is not listed. You'll need to configure the <Valve> in each <Context> that needs it, or in the <Host> or <Engine> if you want the <Valve> to apply to all.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Len Takeuchi
2010-03-28 22:06:39 UTC
Permalink
Thanks Chuck. It worked when I put the JvmRouteBinderValve configuration
under Host.

Regards,
Len
Post by Caldarale, Charles R
Post by Len Takeuchi
Subject: Re: sticky session failover
I tried to configure it by putting JvmRouteBinderValve
config inside a Manager
"A Valve element represents a component that will be inserted into
the request processing pipeline for the associated Catalina
container (Engine, Host, or Context)."
Note that <Manager> is not listed. You'll need to configure the
<Valve> in each <Context> that needs it, or in the <Host> or
<Engine> if you want the <Valve> to apply to all.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE
PROPRIETARY MATERIAL and is thus for use only by the intended
recipient. If you received this in error, please contact the sender
and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
Loading...