tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grotzke <>
Subject Re: How to cluster two embedded tomcat 7 instances
Date Thu, 09 Jun 2011 14:16:34 GMT

perhaps memcached-session-manager is an option for you:

It has integration tests that show how to configure it programatically:

Configuration options are described here:


On 06/09/2011 03:15 PM, Rüdiger Herrmann wrote:
> 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, ...
>   tomcat.start();
> 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
> know.
> 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.
> Background:
> 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,
> Rüdiger
> [1]
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Martin Grotzke

View raw message