views:

163

answers:

1

I work on a very high volume public website running on Tomcat 5.5. Currently we require stickiness to a particular server in order to maintain session. I'd like to start replicating session, but have had trouble finding a good FOSS solution. I've written my own Manager (using memcached as the store) but am having trouble dealing with race conditions if more than one server is handling the requests for the same user.

Is there a solution out there I should be looking at? I'm looking for not just something that works as a fallback if stickiness fails, but that would work if user requests are regularly spread to multiple servers.

A: 

This is a tough issue. In my opinion, Servlet sessions in Tomcat doesn't work at all if you have multiple servers and geo-distributed.

Our solution is to make our server totally stateless. All sessions are stored in database only. We use geo-localized MySQL with memory engine and the performance is much better than the old methods using Tomcat session replication.

Even though the chance of race condition is much less, it still occurs occasionally. We added record versioning in DB so we can detect race conditions and retry.

ZZ Coder