You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rob Bugh <ro...@earthlink.net> on 2007/02/06 20:32:52 UTC

Session Affinity and Session Replication

Hello All,

I'm trying to get a better understanding when to use Session Affinity and Session Replication and have a question. Let me set my question up by describing my configuration. It consists of an Apache server with mod_jk and two Tomcat servers, where the Apache server is configured to load-balance between the two Tomcat servers. So my question is, if I enable session affinity but not session replication, how can I failover a connection without losing the session data?

Let me restate my question more like a use case:

      - Given the above configuration of Apache and 2 Tomcat servers

      - A session has already been started on Tomcat-1 (session contains data)

      - A new request comes in with the same session id. Session affinity is on so the request should go to Tomcat-1. But Tomcat-1 is down so the request fails over to Tomcat-2.

      - Since session replication is not enabled how does Tomcat-2 get the session data? Or can it?


Can this problem be solved by using both sticky sessions and session replication? Or do I have to abandon session affinity and just use session replication. All the documentation I've read to date indicates not to use sticky sessions and session replication together.


Thanks,
Rob


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Session Affinity and Session Replication

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rob,

Rob Bugh wrote:
> So my question is, if I enable session affinity but not session 
> replication, how can I failover a connection without losing the 
> session data?

You can't, unless you are using some other mechanism to share that data.

Many times, losing a session isn't a big deal if there's not too much
information held only in the session.

> - Since session replication is not enabled how does Tomcat-2 get the 
> session data? Or can it?

Tomcat-2 has to start over with a new session (i.e. there's no
recovery). In order to share sessions between servers, you must have
session replication enabled.

> Can this problem be solved by using both sticky sessions and session 
> replication?

That's generally the idea.

> Or do I have to abandon session affinity and just use session
> replication. All the documentation I've read to date indicates not to
> use sticky sessions and session replication together.

What have you been reading? I've never done either of these, but it
would seem that the two in concert is the best solution.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFyNyB9CaO5/Lv0PARAv5TAJ4zap7ujCUpxTEZyUCQmF8buCgmuACgwGg7
iMwHkO1UcBkHRHRcbEojn7E=
=ZiJl
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Session Affinity and Session Replication

Posted by Hassan Schroeder <ha...@gmail.com>.
On 2/6/07, Rob Bugh <ro...@earthlink.net> wrote:

> All the documentation I've read to date indicates not to use sticky
> sessions and session replication together.

Can you cite where you saw that?

I've set up a similar config (using mod_proxy_ajp) with both sticky
sessions and session replication and it worked fine.

FWIW,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org