tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Who wants my Cassandra session manager for Tomcat?
Date Tue, 10 Apr 2012 18:38:01 GMT

On 4/10/12 2:18 PM, Morten Jorgensen wrote:
> I cannot simply replace all
> session data management (currently using HttpSession) across my entire
> applications, as the time/resources required to do this is massive. I
> need to be able to replace the foundation for my applications, while
> retaining as much of the applications as-is. Nor can I rely on the
> existing session managers in Tomcat, as these do not scale to meet the
> traffic volumes that my customers see in their environments.

You can do this without using a replacement SessionManager, and it will
work across all containers. Use a Filter that wraps the
HttpServletRequest and returns a customized HttpSession object.

This custom HttpSession can use the "real" (in-memory) session for
certain attributes and it can use Cassandra for others. You can even
make it configurable on a per-session-key basis.

(We do this for certain non-Serializable data that is also very big,
when the client code can handle it being null: we wrap certain objects
in SoftReferences and let the GC destroy them if it needs memory. Then,
the webapp can discover a null value and re-load the object in question
from primary storage. It works seamlessly through the HttpSession

I think this would be a better strategy in general, since it will work
with any servlet container.

> I would imagine that there are several architects out there that are
> experiencing similar problems, hence I want to share my work.

I think the best place for this kind of thing is probably directly on
the Wiki (if the amount of code is small) or if you can host it
somewhere and put a link to it on the "AddOns" page.


View raw message