Nginx and Tomcat session load balancing to achieve shared realization

 Since the project need to test the performance test ten million daily transactions, so use Nginx as a reverse proxy to achieve load balancing multiple Tomcat, in order to achieve the session sharing between multiple Tomcat, uses the open source Memcached-Session-Manager Framework . The following is the project build process:

1) a load-balancing nginx + 2Tomcat (due to unrealized session sharing, the application can only access the landing page);

2) Installation memcached (windows environment);

3) Configure msm session sharing environment to achieve;


Mainly msm environment to achieve a shared session to be introduced:

1) Download jar package:

couchbase-client-1.0.3.jar

javolution-5.4.3.1.jar

kryo-1.04.jar

kryo-2.24.0.jar

kryo-serializers-0.9.jar

memcached-2.6.jar

memcached-session-manager-1.5.1.jar

memcached-session-manager-tc7-1.5.1.jar

minlog-1.2.jar

msm-Javolution-serializer-1.5.1.jar

msm-KRYO-serializer-1.5.1.jar

msm-xstream-serializer-1.5.1.jar

2) The download package into the jar% TOMCAT_HOMT% \ lib in.

3)配置%TOMCAT_HOME%\config\context.xml

                Adding Context.xml file

 <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager" 
      memcachedNodes="n1:127.0.0.1:11211" 
      sticky="false" 
      lockingMode="auto" 
      sessionBackupAsync="false"   
      sessionBackupTimeout="1000"  
      transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory" 
      />

Finally start tomcat, said the successful launch msm environment successfully constructed.



Published 18 original articles · won praise 4 · views 20000 +

Guess you like

Origin blog.csdn.net/ostriches/article/details/49866511