tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: serializing session in DB
Date Mon, 02 Mar 2009 22:43:05 GMT
Hash: SHA1


On 3/2/2009 4:21 PM, Amit Chandel wrote:
> But only issue is that Tomcat doesn't persist sessions to DB
> synchronously as is the case with in-memory replication where session
> data is first replicated and then the request gets served. So if
> master fails, and the session data has not been persisted, subsequent
> requests going to the other tomcat node will see old session data
> from DB, and might frustrate the *user*. I would like to know how
> synchronous persistance of session data with Tomcat is done in
> practice.

I have no experience with JDBCStore, but you could always implement your
own SessionManager that does synchronous database updates.

If you don't want to implement a SessionManager (which might be a bit
heavy-handed and certainly Tomcat-specific), you could also write a
filter that wraps the HttpSession with your own object that does
synchronous DB reads and writes. This might also save you a LOT of RAM.
If you use the database exclusively for session attribute data, your
in-memory footprint for sessions could drop dramatically.

If you'd like an example of such a filter, I could probably provide one.

- -chris

Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


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

View raw message