tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RĂ¼diger Herrmann <>
Subject How to cluster two embedded tomcat 7 instances
Date Thu, 09 Jun 2011 13:15:26 GMT
Hi all,

I would like to programmatically set up two Tomcat engines and have
them form a basic cluster - all in the same VM. Creating and starting
the servlet engines already works
  Tomcat tomcat = new Tomcat()
  tomcat.setPort( 123 );
  // create context, add servlet, ...

What I am struggling with is setting up the cluster. My first attempt
was to use the PersistentManager with Store that uses a shared
directory. But it seems that it only persists session in time
intervals. To enable failover, a session would need to be persisted
after each request. However, I didn't find out how to configure or
trigger the PersistentManager to do so.
Still, the PersistenceManager setup was straightforward and if anyone
knows how to form a cluster with this approach I would be grateful to

I am aware of the SimpleTcpCluster, which I would try next. Just,
before transforming the XML configuration into API calls (without
known their meaning) I wanted to ask if there is an easier or even
pre-built solution.

I work on enabling RAP [1], a web framework, to work in failover
cluster environments. To ensure cluster-support, I have a set of JUnit
tests that issue requests against an embeded cluster of servlet
engines and then examine the state of sessions of the respective
nodes, etc.
Performance isn't important, neither is any advanced clustering
feature (e.g. DeltaManager) needed. My focus is on finding a
lightweight and purely programmatic solution.

Thanks in advance,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message