What are the different approaches for Java EE sess

2020-05-23 18:21发布

问题:

I am working on a project that requires really high availability and my team is currently working on upgrading some infra-structure and software for a future release.

One of the features we would like to enable is to have session replication across not only different servers, but ideally across different sites (geographically spread). Is that possible? What are the approaches?

For what I have seen so far, to enable session replication, the usual vendor approaches are either one of these:

  • Serializable session attributes
  • < distributable /> tag in the web.xml with additional configuration in vendor specific xml

Are there other approaches? Should I go for in-memory replication? Or should I persist the session state? What app server vendors implement each solution?

Edit: I started a bounty, so I really am looking for a comprehensive answer. :)

回答1:

You might want to look at Hazelcast and their HTTP Session Clustering feature



回答2:

If you're using tomcat then memcached-session-manager would be an option. It's a custom session manager that replicates sessions via memcached and supports both sticky and non-sticky sessions: http:// code.google.com/p/memcached-session-manager

Cheers, Martin



回答3:

Take a look at Oracle Coherence with HTTP session management module Coherence*Web.

It is in-memory basically but can be more persistence through DB or other storages.