2

Is it possible to share a session among 2 tomcats that runs the same web application and which is both balanced by haproxy? (haproxy is round robin based, and not using sticky-session)

by sharing i mean creating the session in one place (haproxy or tomcat) and be able to get it from the other tomcat.

(our goal is statless web application servers)..

Thanks!

Urbanleg
  • 6,252
  • 16
  • 76
  • 139

1 Answers1

0

It is possible. You can cluster your tomcat servers together.

Configure Tomcat to Share Sessions

The key to enable session sharing is to declare two XML elements: one in your application's web.xml (1) and the other in Tomcat's server.xml (2):

  1. <distributable />
  2. <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" />

Important Note: Your session attributes must be serializable.

Sources:

Ianthe the Duke of Nukem
  • 1,721
  • 2
  • 20
  • 37