????Session????

????Cookie??Web???????????в???????????????????????Cookie??????????????????????????????????DWR??????????У???????????????д???????????cookie?????????????????????γ?????????????????????????Cookie????????????????????á?????????????????????Cookie?????????????????NTES_SESS???????????SessionID????

????NTES_SESS??URS?????Cookie?????NTESSTUDYSI??????÷????Session?????NTESSTUDYSI?洢SessionID?????????????????ò????????????????????????????????????????????????????????????????????????á?Cookie??Session??????????????????????б??????Session???????棬????????????

????Cookie??????

????cookie??С?????С?????????????HTTPЭ??????????????????????????????????????????????????????????HTTP????????????????????Cookie?????Cookie?????????????????????е?cookie??????????????????????????????;????????е?Cookie?????洢??????????????????????????????cookie??????????

????Session??????

????Session??????????????ζ???????????????????????????????Session?????????SessionID??????????????????SessionID???????????????(???????棬?????????????)??????????????????????????????????SessionID???????????????У?????????????????????????SessionID(?????????Session???????????????Session)?????????SessionID??????????????????????????Session?????????б????洢????????

????Session??????????????Cookie(Session Cookie)????δ???ù???????Cookie?????Cookie???????????????????????????????????????Cookie???????????????Session???Cookie???????????????????Cookie?????????????Cookie——???Cookie(Persistent Cookies)?????Cookie????????????????е?Cookie???(?????????????Ч????)?????Cookie??????????????ID???????????????????ε???????????????????????????????????Cookie??????????????????????????????Cookie????????????????????????????????????????塣

????????????н?????????????????URS??????Cookie????????Cookie????????????NTES_SESS??ζ????Values??????????Cookie???????????????????棬??ò????????????????(?????????)???????????????Cookie????????????NTESSTUDYSI??Σ????????ò????Tomcat????????????32λ??SessionID +jvmRoute????????????????????????????????????д???SessionID?????????????????Tomcat???????????????Session;?????????SessionID????????SessionID??????????????Tomcat?????????????????Tomcat????Session????????30Min??

???????????

?????????????СС??SessionID????????????????????????

????1. Session????

????????Lofter???????????????????getHomePage????????????????????JVM?????????????????????Young GC???????????Old????治????????????????Full GC?????Jmap??λ?????????java.util.concurrent.ConcurrentHashMap$Segment???????????????????????????????????????????????Dump????????????棬???MAT (Memory Analyzer Tool)?????????????????????????????????????ConcurrentHashMap$Segment??

???????????????????????????org.apache.catalina.session.StandardManager???????session.StandardManager??洢Session????????

??????????Session??????????????????????У?????????Cookie???????Cookie????а???SessionID???????????????????Tomcat?????????????????????????????????????????????????м????????????Tomcat??????????Session????????????Session???2K??????????????Session????????Session?????????????????????????????????????????Session?????Session????????????????(?′?????????????Я??SessionID)????????Session??????????Session????????????????????е??????Session?????????30Min????????????Session????????б???????30Min?????????30Min???????????????????Session??????????????? ??????????????????????????

????2. Session????

???????????????????м?????SessionID???????????????????????Session???????????????Session?????????????????Tomcat??web.xml???????session????????30Min?????????????SessionID??30Min??????????Tomcat??Session??????????????????SessionID??????е??????????????????????SessionID????????Tomcat???????ζ????????Session?????

????Mark??Session?????????????????÷?????????Tomcat?????????web.xml????????????webroot????????е????????web.xml?????????????????????session.setMaxInactiveInterval(15*60)????????????????????ü?????????????????

????3. SessionID????????

??????????????????У???????????????????????Session????????????д???????й????SessionID????????????????????Session?

???????????????????Nginx+Tomcat??????????????Nginx????????????Nginx?????Tomcat??Nginx????Session??????session sticky????????????????????jvm_route???????Nginx???????????upstream.conf???????

????upstream study {

????server 10.120.36.68:8010 srun_id=qa18-8010;

????server 10.120.36.97:8010 srun_id=qa19-8010;

????jvm_route $cookie_NTESSTUDYSI reverse;

????keepalive 100;

????}

????????????????????????Nginx????????Tomcat????????????????????SessionID?е???????????????????Tomcat??????NTESSTUDYSI=1816E5ECBC052F6ABA420FEE7B06DA86.qa18-8010;???????SessionID????????? 10.120.36.68(qa18)????????????

??????qa18?????????Tomcat???????server.xml?У???????jvmRoute="qa18-8010"??????????????SessionID??????qa18-8010???????????????????μ????????????????

???????????Nginx?????????upstream.conf???????srun_id=qa18-8010????tomcat??????????????jvmRoute="qatest18-8010"????????Cookie?????SessionID??????qatest18-8010????????????Nginx??????SessionID???????????server????????????????session????÷????Tomcat?????????????????Session????????????session?????????????л?????session??????????