MSM (Memcached-session-manager) supports TOMCAT6 and TOMCAT7 and uses the Value (Tomcat valve) to track request. When request requests arrive, the Tomcat session is updated to memcached at the end of the memcached load Session,request request to support the sticky and Non-sticky modes for session sharing purposes.
Sticky Mode: Tomcat session is the main session, Memcached to prepare the session. When request requests arrive, the session is loaded from memcached to Tomcat (the Tomcat session is taken directly when the Tomcat Jvmroute is changed); When the request ends, the Tomcat The session is updated to memcached to achieve the purpose of master and standby synchronization.
Non-sticky Mode: Tomcat session for relay session, MEMCACHED1 main session,memcached 2 for the session. When request requests arrive, the session is loaded from memcached 2 to Tomcat, (when there is no session in the container, the main session is loaded from memcached1 to Tomcat, which is only one memcached node, or When the request ends, the Tomcat session is updated to the master memcached1 and Memcached2, and the Tomcat session is cleared MEMCACHED2. To achieve the primary and standby synchronization purposes.
First download memcached-win32-1.4.4-14 + jdk1.7 and install, download apache-tomcat-7.0.57, respectively, the port number is: 8081, 8082 Download the jar package: javolution-5.4.3.1.jar memcached-session-manager-1.6.5.jar
Memcached-session-manager-tc7-1.6.5.jar
Msm-javolution-serializer-1.6.5.jar
Msm-kryo-serializer-1.6.5.jar
Msm-xstream-serializer-1.6.5.jar
: http://code.google.com/p/memcached-session-manager/downloads/list
Spymemcached-2.11.4.jar
The context node in Tomcat Context.xml is incremented:
sticky mode:
<manager className= " De.javakaffee.web.msm.MemcachedBackupSessionManager "
memcachednodes=" n1:localhost:11211 "
requesturiignorepattern=". */. ( PNG|GIF|JPG|CSS|JS) $ "
sessionbackupasync=" false "
sessionbackuptimeout=" + "
transcoderfactoryclass= "De.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"
copycollectionsforserialization= "false"/>
Non-sticky mode:
<manager classname= "De.javakaffee.web.msm.MemcachedBackupSessionManager"
Memcachednodes= "n1:localhost:11211"
Sticky= "false"
Requesturiignorepattern= ". * *. (PNG|GIF|JPG|CSS|JS) $ "
Sessionbackupasync= "false"
sessionbackuptimeout= "100"
Transcoderfactoryclass= "De.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"
Copycollectionsforserialization= "false"/>
Memcached-session-manager Implementing Tomcat session sharing