Fog Creek Software
Discussion Board




J2EE: Sessions with Multiple App Servers

What are the options for maintaining session state across multiple application servers in a J2EE environment? Thanks.

J2EE Newbie
Monday, August 18, 2003

Three Options (and not just J2EE)

Store sessions on the client inside a cookie, or in the url

Store a session ID in the url or a cookie, and have the load balancer always route requests with that session ID to a particular server (sticky load balancer), you can also skip the url rewrite or cookie and simply assume every IP address is a session

Store session data in a 3rd computer not the app server (could be ejb, ldap, db, flat file etc ...) and have each app server read from the data store computer on every request

Daniel Shchyokin
Monday, August 18, 2003

Use J2EE clustered servers to maintain session state across multiple application servers. Such cluster-licences are expensive and provided by not all J2EE vendors.  Carefully check what your vendor offers.

Avoid by design managing sessions across application servers yourself as much as possible. Synchronization of sessions between different physical servers and may lead to new error and performance degradation,  especially at peak hours.

Evgeny Gesin /Javadesk/
Monday, August 18, 2003

The last sentense should be read as: Synchronization of sessions between different physical servers may lead to new errors and performance degradation,  especially at peak hours. ;-)

Evgeny Gesin /Javadesk/
Monday, August 18, 2003

May this should help
http://www.onjava.com/pub/a/onjava/2002/07/17/tomcluster.html

David Rabinowitz
Tuesday, August 19, 2003

Thanks all.

J2EE Newbie
Tuesday, August 19, 2003

*  Recent Topics

*  Fog Creek Home