Tomcat Session Replication/Clustering

I’m considering whether or not to use the new session clustering capabilities of Tomcat 5. Unfortunately there isn’t much information out there on the subject. I found a short mention in this “What’s New in Tomcat 5” article on OnJava and a relatively thorough article on the Tomcat site “Clustering/Session Replication How-To“. Is there anyone out that a) has implemented it and can offer some validation that it works as advertised or b) that has more information beyond what is in the above mentioned articles?

I’m specifically interested in opinions on:

a) Beyond the obvious, what are the implications of using the ‘useDirtyFlag’ in server.xml? How much does it affect performance? Which did you decide to use and why? The comments in server.xml provide the best description of the ‘useDirtyFlag’ I’ve seen yet. For those who haven’t peeked:

true means that we only replicate a session after setAttribute,removeAttribute has been called.
false means to replicate the session after each request.
false means that replication would work for the following piece of code:
HashMap map = (HashMap)session.getAttribute(“map”);

Setting ‘useDirtyFlag’ to false sounds like it would cause a ton of extra work. Setting it to true just means you have to be more intentional when you want to save data to the session. Thoughts?
b) Which persistence mechanism did you choose (PersistenceManager, JDBCManager, SimpleTcpCluster)?

Also, does anyone know if the Tomcat book that Oreilly pushed out in June of last year covers Tomcat 5? The article above seems to imply that it does, but I looked at a hardcopy at Barnes & Noble and that only covers Tomcat 4.x.

3 thoughts on “Tomcat Session Replication/Clustering”

  1. Hi,

    I’m also interested in finding our how to use the JDBCManager in Tomcat 5 but similarly have been unable to find any documentation. Have you managed to come across anything since you posted this?


  2. Hi Aaron,

    Thanks for your reply. The good news is that I think that I have got to the bottom of the issue.

    It seems that the root of the confusion is the Apache Clustering documentation that refers to something called JDBCManager here:

    After spending more time than I’d care to mention Googling (the reason I hit your blog in the first place) to get to the bottom of this I think JDBCManager is an error and it should say JDBC Store instead. For example if you look at Brian McCallister’s blog entry here you can see how to configure Tomcat 5 to use JDBC based persistence here:

    Actually my interest in getting persistence working was to find out how to configure a High Availability Open Source stack and the really cool thing is that a project at ObjectWeb called C-JDBC can be used to facilitate this.

    Hope this helps!


Leave a Reply

Your email address will not be published. Required fields are marked *