{"id":84975,"date":"2026-07-26T21:16:42","date_gmt":"2026-07-26T13:16:42","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/84975.html"},"modified":"2026-07-26T21:16:42","modified_gmt":"2026-07-26T13:16:42","slug":"web%e5%ba%94%e7%94%a8%e6%9c%8d%e5%8a%a1%e5%99%a8tomcat-4","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/84975.html","title":{"rendered":"Web\u5e94\u7528\u670d\u52a1\u5668Tomcat"},"content":{"rendered":"<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>1. Web\u6280\u672f<\/li>\n<li>\n<ul>\n<li>1.1 \u6838\u5fc3\u6982\u5ff5<\/li>\n<li>1.2 \u9759\u3001\u52a8\u6001\u7f51\u9875<\/li>\n<li>1.3 \u540c\u6b65\u3001\u5f02\u6b65<\/li>\n<\/ul>\n<\/li>\n<li>2 Web\u67b6\u6784<\/li>\n<li>\n<ul>\n<li>2.1 \u5355\u4f53\u67b6\u6784&#xff08;Monolithic&#xff09;<\/li>\n<li>2.2 \u5fae\u670d\u52a1\u67b6\u6784&#xff08;Microservices&#xff09;<\/li>\n<li>2.3 \u5e38\u89c1Web\u670d\u52a1\u5668\/\u5bb9\u5668<\/li>\n<\/ul>\n<\/li>\n<li>3 Tomcat<\/li>\n<li>\n<ul>\n<li>3.1 \u5b9a\u4f4d<\/li>\n<li>3.2 \u6838\u5fc3\u529f\u80fd<\/li>\n<li>3.3 \u6838\u5fc3\u7ec4\u4ef6<\/li>\n<li>3.4 \u76ee\u5f55\u7ed3\u6784<\/li>\n<\/ul>\n<\/li>\n<li>4 \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861<\/li>\n<li>\n<ul>\n<li>4.1 \u90e8\u7f72\u65b9\u5f0f\u6f14\u8fdb<\/li>\n<li>4.2 LNMT\/LAMT\u67b6\u6784\u5bf9\u6bd4<\/li>\n<li>4.3 Session\u95ee\u9898\u8be6\u89e3<\/li>\n<\/ul>\n<\/li>\n<li>5 Memcached\u7f13\u5b58<\/li>\n<li>\n<ul>\n<li>5.1 \u7b80\u4ecb<\/li>\n<li>5.2 \u4e0eRedis\u5bf9\u6bd4<\/li>\n<li>5.3 \u57fa\u672c\u547d\u4ee4\u8be6\u89e3<\/li>\n<\/ul>\n<\/li>\n<li>6 Session\u5171\u4eab\u65b9\u6848&#xff08;MSM&#xff09;<\/li>\n<li>\n<ul>\n<li>6.1 \u80cc\u666f<\/li>\n<li>6.2 \u6240\u9700Jar\u5305<\/li>\n<li>6.3 \u5de5\u4f5c\u539f\u7406<\/li>\n<li>\n<ul>\n<li>Sticky\u6a21\u5f0f&#xff08;\u7c98\u6027\u4f1a\u8bdd&#xff0c;\u63a8\u8350&#xff09;<\/li>\n<li>Non-Sticky\u6a21\u5f0f&#xff08;\u975e\u7c98\u6027&#xff09;<\/li>\n<li>\u5e8f\u5217\u5316\u8fc7\u7a0b<\/li>\n<li>\u6545\u969c\u6062\u590d\u673a\u5236<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>7 \u5b9e\u8df5<\/li>\n<\/ul>\n<h2>1. Web\u6280\u672f<\/h2>\n<h3>1.1 \u6838\u5fc3\u6982\u5ff5<\/h3>\n<table>\n<tr>\u6982\u5ff5\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>B\/S\u67b6\u6784<\/td>\n<td>Browser\/Server&#xff0c;\u6d4f\u89c8\u5668\/\u670d\u52a1\u5668\u6a21\u5f0f\u3002\u5ba2\u6237\u7aef\u53ea\u9700\u6d4f\u89c8\u5668&#xff0c;\u4e1a\u52a1\u903b\u8f91\u96c6\u4e2d\u5728\u670d\u52a1\u5668&#xff0c;\u7ef4\u62a4\u6210\u672c\u4f4e&#xff0c;\u4f46\u53d7\u7f51\u7edc\u5f71\u54cd\u5927<\/td>\n<\/tr>\n<tr>\n<td>C\/S\u67b6\u6784<\/td>\n<td>Client\/Server&#xff0c;\u5ba2\u6237\u7aef\/\u670d\u52a1\u5668\u6a21\u5f0f&#xff08;\u5982QQ\u3001\u8fc5\u96f7\u3001\u6e38\u620f\u5ba2\u6237\u7aef&#xff09;\u3002\u9700\u5b89\u88c5\u4e13\u7528\u8f6f\u4ef6&#xff0c;\u6027\u80fd\u597d\u3001\u529f\u80fd\u5f3a&#xff0c;\u4f46\u5347\u7ea7\u7ef4\u62a4\u9ebb\u70e6<\/td>\n<\/tr>\n<tr>\n<td>HTTP\u534f\u8bae<\/td>\n<td>HyperText Transfer Protocol&#xff0c;\u5e94\u7528\u5c42\u6587\u672c\u4f20\u8f93\u534f\u8bae&#xff0c;1990\u5e74\u7531Tim Berners-Lee\u53d1\u660e&#xff0c;\u9ed8\u8ba4\u7aef\u53e380&#xff0c;HTTPS\u4e3a443<\/td>\n<\/tr>\n<tr>\n<td>\u52a8\u6001\u7f51\u9875<\/td>\n<td>\u670d\u52a1\u7aef\u6839\u636e\u8bf7\u6c42\u52a8\u6001\u751f\u6210HTML\u3002\u6f14\u8fdb&#xff1a;CGI&#xff08;\u901a\u7528\u7f51\u5173\u63a5\u53e3&#xff09;\u2192 ASP\/PHP\/JSP&#xff08;\u811a\u672c\u5d4c\u5165HTML&#xff09;\u2192 \u73b0\u4ee3MVC\u6846\u67b6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>1.2 \u9759\u3001\u52a8\u6001\u7f51\u9875<\/h3>\n<table>\n<tr>\u7279\u6027\u9759\u6001\u7f51\u9875\u52a8\u6001\u7f51\u9875<\/tr>\n<tbody>\n<tr>\n<td>\u5185\u5bb9\u751f\u6210<\/td>\n<td>\u9884\u5b58HTML\u6587\u4ef6<\/td>\n<td>\u670d\u52a1\u5668\u5b9e\u65f6\u751f\u6210<\/td>\n<\/tr>\n<tr>\n<td>\u4ea4\u4e92\u6027<\/td>\n<td>\u65e0<\/td>\n<td>\u652f\u6301\u7528\u6237\u4ea4\u4e92\u3001\u6570\u636e\u5e93\u64cd\u4f5c<\/td>\n<\/tr>\n<tr>\n<td>\u6269\u5c55\u540d<\/td>\n<td>.html\/.htm<\/td>\n<td>.php\/.jsp\/.asp\/.py\u7b49<\/td>\n<\/tr>\n<tr>\n<td>\u6027\u80fd<\/td>\n<td>\u52a0\u8f7d\u5feb&#xff0c;\u9002\u5408CDN<\/td>\n<td>\u9700\u670d\u52a1\u5668\u5904\u7406&#xff0c;\u76f8\u5bf9\u8f83\u6162<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u7528\u573a\u666f<\/td>\n<td>\u4f01\u4e1a\u5b98\u7f51\u3001\u6587\u6863<\/td>\n<td>\u7535\u5546\u3001\u793e\u4ea4\u3001\u7ba1\u7406\u7cfb\u7edf<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>1.3 \u540c\u6b65\u3001\u5f02\u6b65<\/h3>\n<table>\n<tr>\u65b9\u5f0f\u7279\u70b9\u6280\u672f\u5b9e\u73b0<\/tr>\n<tbody>\n<tr>\n<td>\u540c\u6b65<\/td>\n<td>\u8bf7\u6c42\u540e\u6574\u4e2a\u9875\u9762\u5237\u65b0&#xff0c;\u7528\u6237\u4f53\u9a8c\u5dee&#xff0c;\u670d\u52a1\u5668\u538b\u529b\u5927<\/td>\n<td>\u4f20\u7edfform\u63d0\u4ea4\u3001\u8d85\u94fe\u63a5\u8df3\u8f6c<\/td>\n<\/tr>\n<tr>\n<td>\u5f02\u6b65(Ajax)<\/td>\n<td>\u5c40\u90e8\u66f4\u65b0&#xff0c;\u4e0d\u5237\u65b0\u6574\u4e2a\u9875\u9762&#xff0c;\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u548c\u6027\u80fd<\/td>\n<td>XMLHttpRequest\u3001Fetch API\u3001Axios<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Ajax\u5de5\u4f5c\u6d41\u7a0b&#xff1a;JavaScript\u53d1\u8d77\u5f02\u6b65\u8bf7\u6c42 \u2192 \u670d\u52a1\u5668\u8fd4\u56de\u6570\u636e&#xff08;JSON\/XML&#xff09;\u2192 JavaScript\u66f4\u65b0DOM\u5c40\u90e8\u5185\u5bb9<\/p>\n<h2>2 Web\u67b6\u6784<\/h2>\n<h3>2.1 \u5355\u4f53\u67b6\u6784&#xff08;Monolithic&#xff09;<\/h3>\n<ul>\n<li>\u5b9a\u4e49&#xff1a;\u6240\u6709\u529f\u80fd\u6a21\u5757\u6253\u5305\u5728\u4e00\u4e2a\u5e94\u7528\u4e2d&#xff0c;\u7edf\u4e00\u90e8\u7f72\u8fd0\u884c<\/li>\n<li>\u4f18\u70b9&#xff1a;\n<ul>\n<li>\u6613\u4e8e\u5f00\u53d1\u6d4b\u8bd5&#xff1a;\u5355\u4e00\u4ee3\u7801\u5e93&#xff0c;\u8c03\u8bd5\u65b9\u4fbf<\/li>\n<li>\u90e8\u7f72\u7b80\u5355&#xff1a;\u4e00\u4e2aWAR\/JAR\u5305\u76f4\u63a5\u90e8\u7f72<\/li>\n<li>\u6269\u5c55\u65b9\u4fbf&#xff1a;\u6c34\u5e73\u590d\u5236&#xff08;\u591a\u5b9e\u4f8b\u90e8\u7f72&#xff09;<\/li>\n<li>\u4e8b\u52a1\u5904\u7406\u7b80\u5355&#xff1a;\u672c\u5730\u4e8b\u52a1\u5373\u53ef\u4fdd\u8bc1\u4e00\u81f4\u6027<\/li>\n<\/ul>\n<\/li>\n<li>\u7f3a\u70b9&#xff1a;\n<ul>\n<li>\u8026\u5408\u5ea6\u9ad8&#xff1a;\u6a21\u5757\u95f4\u8fb9\u754c\u6a21\u7cca&#xff0c;\u4ee3\u7801\u7ea0\u7f20<\/li>\n<li>\u5168\u7ad9\u98ce\u9669&#xff1a;\u4efb\u4e00\u6a21\u5757\u6545\u969c\u5f71\u54cd\u6574\u4e2a\u7cfb\u7edf<\/li>\n<li>\u6280\u672f\u6808\u9501\u5b9a&#xff1a;\u96be\u4ee5\u5f15\u5165\u65b0\u6280\u672f<\/li>\n<li>\u4e0d\u9002\u5408\u5feb\u901f\u8fed\u4ee3&#xff1a;\u5c0f\u6539\u52a8\u9700\u5168\u91cf\u90e8\u7f72<\/li>\n<li>\u56e2\u961f\u534f\u4f5c\u96be&#xff1a;\u5927\u91cf\u5f00\u53d1\u8005\u51b2\u7a81\u9891\u7e41<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>2.2 \u5fae\u670d\u52a1\u67b6\u6784&#xff08;Microservices&#xff09;<\/h3>\n<ul>\n<li>\u6838\u5fc3\u601d\u60f3&#xff1a;\u6309\u4e1a\u52a1\u9886\u57df\u62c6\u5206\u6210\u72ec\u7acb\u670d\u52a1&#xff0c;\u4e00\u4e2a\u670d\u52a1\u53ea\u505a\u4e00\u4ef6\u4e8b&#xff08;\u5355\u4e00\u804c\u8d23\u539f\u5219&#xff09;<\/li>\n<li>\u670d\u52a1\u7279\u5f81&#xff1a;\n<ul>\n<li>\u72ec\u7acb\u90e8\u7f72\u3001\u72ec\u7acb\u6269\u5c55<\/li>\n<li>\u62e5\u6709\u81ea\u5df1\u7684\u6570\u636e\u5e93&#xff08;Database per Service&#xff09;<\/li>\n<li>\u8f7b\u91cf\u7ea7\u901a\u4fe1\u673a\u5236<\/li>\n<\/ul>\n<\/li>\n<li>\u901a\u4fe1\u65b9\u5f0f&#xff1a;HTTP RESTful API\u3001\u6d88\u606f\u961f\u5217&#xff08;RabbitMQ\/Kafka&#xff09;\u3001gRPC<\/li>\n<li>\u57fa\u7840\u8bbe\u65bd&#xff1a;\u670d\u52a1\u6ce8\u518c\u53d1\u73b0&#xff08;Eureka\/Nacos&#xff09;\u3001\u914d\u7f6e\u4e2d\u5fc3\u3001\u7f51\u5173&#xff08;Gateway&#xff09;\u3001\u7194\u65ad\u9650\u6d41&#xff08;Hystrix\/Sentinel&#xff09;<\/li>\n<li>\u4f18\u70b9&#xff1a;\n<ul>\n<li>\u677e\u8026\u5408&#xff1a;\u670d\u52a1\u95f4\u901a\u8fc7\u63a5\u53e3\u901a\u4fe1<\/li>\n<li>\u72ec\u7acb\u90e8\u7f72&#xff1a;\u5355\u4e2a\u670d\u52a1\u5347\u7ea7\u4e0d\u5f71\u54cd\u5168\u5c40<\/li>\n<li>\u5c0f\u56e2\u961f\u5f00\u53d1&#xff1a;2 Pizza Team&#xff08;\u4e9a\u9a6c\u900a\u539f\u5219&#xff09;<\/li>\n<li>\u6280\u672f\u6808\u7075\u6d3b&#xff1a;\u4e0d\u540c\u670d\u52a1\u53ef\u7528\u4e0d\u540c\u8bed\u8a00\/\u6846\u67b6<\/li>\n<li>\u6545\u969c\u9694\u79bb&#xff1a;\u5355\u70b9\u6545\u969c\u4e0d\u4f1a\u62d6\u57ae\u6574\u4f53<\/li>\n<\/ul>\n<\/li>\n<li>\u7f3a\u70b9&#xff1a;\n<ul>\n<li>\u5206\u5e03\u5f0f\u590d\u6742\u6027&#xff1a;\u7f51\u7edc\u5ef6\u8fdf\u3001\u8d85\u65f6\u3001\u91cd\u8bd5<\/li>\n<li>\u6570\u636e\u4e00\u81f4\u6027\u6311\u6218&#xff1a;\u5206\u5e03\u5f0f\u4e8b\u52a1&#xff08;Saga\u3001TCC\u6a21\u5f0f&#xff09;<\/li>\n<li>\u8fd0\u7ef4\u6210\u672c\u9ad8&#xff1a;\u76d1\u63a7\u3001\u65e5\u5fd7\u3001\u94fe\u8def\u8ffd\u8e2a<\/li>\n<li>\u6d4b\u8bd5\u590d\u6742&#xff1a;\u96c6\u6210\u6d4b\u8bd5\u9700\u534f\u8c03\u591a\u670d\u52a1<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>2.3 \u5e38\u89c1Web\u670d\u52a1\u5668\/\u5bb9\u5668<\/h3>\n<table>\n<tr>\u7c7b\u578b\u4ea7\u54c1\u7279\u70b9<\/tr>\n<tbody>\n<tr>\n<td>\u5f00\u6e90<\/td>\n<td>Tomcat<\/td>\n<td>Apache\u5f00\u6e90&#xff0c;Servlet\/JSP\u5bb9\u5668&#xff0c;\u8f7b\u91cf<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>Jetty<\/td>\n<td>Eclipse\u5f00\u6e90&#xff0c;\u5d4c\u5165\u5f0f\u573a\u666f&#xff0c;\u8f7b\u91cf\u5feb\u901f<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>GlassFish<\/td>\n<td>Oracle\u5f00\u6e90&#xff0c;Java EE\u5b8c\u6574\u5b9e\u73b0<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>Undertow<\/td>\n<td>JBoss\u5f00\u6e90&#xff0c;\u57fa\u4e8eNIO&#xff0c;\u6027\u80fd\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>\u5546\u7528<\/td>\n<td>WebLogic<\/td>\n<td>Oracle&#xff0c;\u4f01\u4e1a\u7ea7&#xff0c;\u529f\u80fd\u5168\u9762&#xff0c;\u6536\u8d39<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>WebSphere<\/td>\n<td>IBM&#xff0c;\u5927\u578b\u91d1\u878d\u7535\u4fe1\u9996\u9009&#xff0c;\u6536\u8d39<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>JBoss EAP<\/td>\n<td>RedHat&#xff0c;\u5f00\u6e90&#043;\u5546\u4e1a\u652f\u6301<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>3 Tomcat<\/h2>\n<h3>3.1 \u5b9a\u4f4d<\/h3>\n<ul>\n<li>\u5b98\u65b9\u5b9a\u4e49&#xff1a;Apache Tomcat\u662f\u5f00\u6e90\u7684Servlet\u5bb9\u5668&#xff08;Servlet Container&#xff09;&#xff0c;\u5b9e\u73b0\u4e86Java EE&#xff08;\u73b0Jakarta EE&#xff09;\u4e2d\u7684Servlet\u3001JSP\u3001WebSocket\u7b49\u89c4\u8303<\/li>\n<li>\u4e0eWeb\u670d\u52a1\u5668\u533a\u522b&#xff1a;\n<ul>\n<li>Web\u670d\u52a1\u5668&#xff08;\u5982Nginx\u3001Apache Httpd&#xff09;&#xff1a;\u5904\u7406\u9759\u6001\u8d44\u6e90\u3001\u53cd\u5411\u4ee3\u7406\u3001\u8d1f\u8f7d\u5747\u8861<\/li>\n<li>Servlet\u5bb9\u5668&#xff08;\u5982Tomcat&#xff09;&#xff1a;\u8fd0\u884cJava Web\u5e94\u7528&#xff0c;\u5904\u7406\u52a8\u6001\u8bf7\u6c42<\/li>\n<\/ul>\n<\/li>\n<li>\u53cc\u91cd\u89d2\u8272&#xff1a;\u65e2\u662fServlet\u5bb9\u5668&#xff0c;\u4e5f\u53ef\u4f5c\u4e3a\u8f7b\u91cf\u7ea7Web\u670d\u52a1\u5668\u4f7f\u7528&#xff08;\u652f\u6301\u9759\u6001\u8d44\u6e90&#xff0c;\u4f46\u6027\u80fd\u4e0d\u5982Nginx&#xff09;<\/li>\n<\/ul>\n<h3>3.2 \u6838\u5fc3\u529f\u80fd<\/h3>\n<table>\n<tr>\u529f\u80fd\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>Servlet\u751f\u547d\u5468\u671f\u7ba1\u7406<\/td>\n<td>\u52a0\u8f7d\u3001\u521d\u59cb\u5316\u3001\u8c03\u7528service()\u3001\u9500\u6bc1Servlet\u5b9e\u4f8b<\/td>\n<\/tr>\n<tr>\n<td>\u8bf7\u6c42\u5904\u7406<\/td>\n<td>\u76d1\u542c\u7aef\u53e3&#xff08;\u9ed8\u8ba48080&#xff09;&#xff0c;\u89e3\u6790HTTP\u8bf7\u6c42&#xff0c;\u5206\u53d1\u7ed9\u5bf9\u5e94Servlet<\/td>\n<\/tr>\n<tr>\n<td>JSP\u7f16\u8bd1\u6267\u884c<\/td>\n<td>\u5c06JSP\u7ffb\u8bd1\u4e3aServlet\u6e90\u7801&#xff0c;\u7f16\u8bd1\u4e3aclass\u5e76\u6267\u884c<\/td>\n<\/tr>\n<tr>\n<td>\u4f1a\u8bdd\u7ba1\u7406<\/td>\n<td>Session\u521b\u5efa\u3001\u7ef4\u62a4\u3001\u6301\u4e45\u5316&#xff08;\u652f\u6301Cookie\/URL\u91cd\u5199&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u8fde\u63a5\u5668\u67b6\u6784<\/td>\n<td>Coyote&#xff08;HTTP\u8fde\u63a5\u5668&#xff09;&#043; Catalina&#xff08;Servlet\u5bb9\u5668&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u591a\u534f\u8bae\u652f\u6301<\/td>\n<td>HTTP\/1.1\u3001AJP&#xff08;Apache JServ Protocol&#xff0c;\u4e0eApache Httpd\u96c6\u6210&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>3.3 \u6838\u5fc3\u7ec4\u4ef6<\/h3>\n<ul>\n<li>Catalina&#xff1a;Servlet\u5bb9\u5668\u6838\u5fc3&#xff0c;\u5b9e\u73b0Servlet\u89c4\u8303<\/li>\n<li>Coyote&#xff1a;HTTP\u8fde\u63a5\u5668&#xff0c;\u5904\u7406\u7f51\u7edc\u8fde\u63a5\u3001\u89e3\u6790HTTP\u534f\u8bae<\/li>\n<li>Jasper&#xff1a;JSP\u5f15\u64ce&#xff0c;\u8d1f\u8d23JSP\u7f16\u8bd1<\/li>\n<li>Cluster&#xff1a;\u96c6\u7fa4\u7ec4\u4ef6&#xff0c;\u652f\u6301Session\u590d\u5236<\/li>\n<li>Realm&#xff1a;\u5b89\u5168\u57df&#xff0c;\u63d0\u4f9b\u7528\u6237\u8ba4\u8bc1\u6388\u6743<\/li>\n<\/ul>\n<h3>3.4 \u76ee\u5f55\u7ed3\u6784<\/h3>\n<p><span class=\"token variable\">$CATALINA_HOME<\/span>\/<br \/>\n\u251c\u2500\u2500 bin\/          <span class=\"token comment\"># \u542f\u52a8\/\u5173\u95ed\u811a\u672c&#xff08;startup.sh\/shutdown.sh&#xff09;<\/span><br \/>\n\u251c\u2500\u2500 conf\/         <span class=\"token comment\"># \u914d\u7f6e\u6587\u4ef6&#xff08;server.xml\u3001web.xml&#xff09;<\/span><br \/>\n\u251c\u2500\u2500 lib\/          <span class=\"token comment\"># \u516c\u5171\u7c7b\u5e93&#xff08;Servlet API\u3001JDBC\u9a71\u52a8\u7b49&#xff09;<\/span><br \/>\n\u251c\u2500\u2500 logs\/         <span class=\"token comment\"># \u65e5\u5fd7\u6587\u4ef6<\/span><br \/>\n\u251c\u2500\u2500 webapps\/      <span class=\"token comment\"># \u90e8\u7f72\u76ee\u5f55&#xff08;WAR\u5305\u81ea\u52a8\u89e3\u538b&#xff09;<\/span><br \/>\n\u251c\u2500\u2500 work\/         <span class=\"token comment\"># JSP\u7f16\u8bd1\u540e\u7684Servlet\u6e90\u7801\u548cclass<\/span><br \/>\n\u2514\u2500\u2500 temp\/         <span class=\"token comment\"># \u4e34\u65f6\u6587\u4ef6<\/span><\/p>\n<h2>4 \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861<\/h2>\n<h3>4.1 \u90e8\u7f72\u65b9\u5f0f\u6f14\u8fdb<\/h3>\n<table>\n<tr>\u6a21\u5f0f\u67b6\u6784\u9002\u7528\u573a\u666f\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>Standalone<\/td>\n<td>Tomcat\u5355\u72ec\u8fd0\u884c<\/td>\n<td>\u5f00\u53d1\u6d4b\u8bd5\u73af\u5883<\/td>\n<td>\u76f4\u63a5\u66b4\u9732Tomcat&#xff0c;\u6027\u80fd\u5dee\u3001\u4e0d\u5b89\u5168&#xff0c;\u751f\u4ea7\u4e0d\u63a8\u8350<\/td>\n<\/tr>\n<tr>\n<td>\u5355\u673a\u53cd\u5411\u4ee3\u7406<\/td>\n<td>Nginx\u2192Tomcat<\/td>\n<td>\u4e2d\u5c0f\u578b\u5e94\u7528<\/td>\n<td>Nginx\u5904\u7406\u9759\u6001\u8d44\u6e90&#xff08;CSS\/JS\/\u56fe\u7247&#xff09;&#xff0c;\u52a8\u6001\u8bf7\u6c42\u8f6c\u53d1Tomcat&#xff0c;\u52a8\u9759\u5206\u79bb<\/td>\n<\/tr>\n<tr>\n<td>\u53cd\u5411\u4ee3\u7406\u591a\u673a<\/td>\n<td>Nginx\u2192\u591aTomcat<\/td>\n<td>\u9ad8\u5e76\u53d1\u751f\u4ea7\u73af\u5883<\/td>\n<td>\u8d1f\u8f7d\u5747\u8861&#xff08;\u8f6e\u8be2\/\u6743\u91cd\/IP\u54c8\u5e0c&#xff09;&#xff0c;Tomcat\u6c34\u5e73\u6269\u5c55<\/td>\n<\/tr>\n<tr>\n<td>\u591a\u7ea7\u4ee3\u7406<\/td>\n<td>Nginx\u2192Nginx\u2192Tomcat<\/td>\n<td>\u8d85\u5927\u89c4\u6a21\/\u591a\u673a\u623f<\/td>\n<td>LVS\/Nginx\u505a\u56db\u5c42\u8d1f\u8f7d&#xff0c;Nginx\u505a\u4e03\u5c42\u8d1f\u8f7d&#xff0c;Tomcat\u96c6\u7fa4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>4.2 LNMT\/LAMT\u67b6\u6784\u5bf9\u6bd4<\/h3>\n<table>\n<tr>\u67b6\u6784\u7ec4\u4ef6\u7279\u70b9<\/tr>\n<tbody>\n<tr>\n<td>LNMT<\/td>\n<td>Linux &#043; Nginx &#043; MySQL &#043; Tomcat<\/td>\n<td>\u6027\u80fd\u9ad8\u3001\u5e76\u53d1\u5f3a\u3001\u914d\u7f6e\u7b80\u6d01\u3001\u8d44\u6e90\u5360\u7528\u4f4e&#xff0c;\u73b0\u4ee3\u4e3b\u6d41\u9009\u62e9<\/td>\n<\/tr>\n<tr>\n<td>LAMT<\/td>\n<td>Linux &#043; Apache(Httpd) &#043; MySQL &#043; Tomcat<\/td>\n<td>Apache\u6a21\u5757\u4e30\u5bcc\u3001.htaccess\u7075\u6d3b\u3001\u4e0ePHP\u96c6\u6210\u597d&#xff0c;\u4f20\u7edfLAMP\u53d8\u79cd<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Nginx vs Apache Httpd&#xff1a;<\/p>\n<ul>\n<li>Nginx&#xff1a;\u5f02\u6b65\u975e\u963b\u585e\u4e8b\u4ef6\u9a71\u52a8&#xff0c;\u9ad8\u5e76\u53d1\u4f4e\u5185\u5b58&#xff0c;\u9002\u5408\u53cd\u5411\u4ee3\u7406<\/li>\n<li>Apache&#xff1a;\u8fdb\u7a0b\/\u7ebf\u7a0b\u6a21\u578b&#xff0c;\u6a21\u5757\u591a\u3001\u529f\u80fd\u5168&#xff0c;\u9002\u5408\u590d\u6742\u4e1a\u52a1\u903b\u8f91<\/li>\n<\/ul>\n<h3>4.3 Session\u95ee\u9898\u8be6\u89e3<\/h3>\n<ul>\n<li>HTTP\u65e0\u72b6\u6001\u672c\u8d28&#xff1a;\u6bcf\u4e2a\u8bf7\u6c42\u72ec\u7acb&#xff0c;\u670d\u52a1\u5668\u4e0d\u4fdd\u5b58\u5ba2\u6237\u7aef\u4e0a\u4e0b\u6587<\/li>\n<li>Session\u673a\u5236&#xff1a;\n<li>\u9996\u6b21\u8bf7\u6c42&#xff1a;\u670d\u52a1\u5668\u521b\u5efaSession\u5bf9\u8c61&#xff0c;\u751f\u6210\u552f\u4e00SessionID<\/li>\n<li>\u54cd\u5e94\u5934&#xff1a;Set-Cookie: JSESSIONID&#061;xxx<\/li>\n<li>\u540e\u7eed\u8bf7\u6c42&#xff1a;\u6d4f\u89c8\u5668\u81ea\u52a8\u643a\u5e26Cookie&#xff0c;\u670d\u52a1\u5668\u901a\u8fc7ID\u627e\u5230Session<\/li>\n<\/li>\n<li>\u8d1f\u8f7d\u5747\u8861\u4e0b\u7684Session\u95ee\u9898&#xff1a;\n<ul>\n<li>\u8bf7\u6c421\u2192Tomcat A&#xff08;\u521b\u5efaSession&#xff09;<\/li>\n<li>\u8bf7\u6c422\u2192Tomcat B&#xff08;\u65e0\u6b64SessionID&#xff0c;\u91cd\u65b0\u521b\u5efa\u2192\u7528\u6237\u767b\u5f55\u72b6\u6001\u4e22\u5931&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\u89e3\u51b3\u65b9\u6848&#xff1a;\n<li>Session\u590d\u5236&#xff08;Tomcat Cluster&#xff09;&#xff1a;\u5b9e\u65f6\u540c\u6b65Session\u5230\u6240\u6709\u8282\u70b9&#xff0c;\u7f51\u7edc\u5f00\u9500\u5927<\/li>\n<li>Session\u7c98\u6ede&#xff08;IP Hash&#xff09;&#xff1a;\u56fa\u5b9a\u7528\u6237\u5230\u56fa\u5b9a\u8282\u70b9&#xff0c;\u5355\u70b9\u6545\u969c\u98ce\u9669<\/li>\n<li>Session\u96c6\u4e2d\u5b58\u50a8&#xff08;Memcached\/Redis&#xff09;&#xff1a;\u63a8\u8350\u65b9\u6848&#xff0c;MSM\u5b9e\u73b0<\/li>\n<\/li>\n<\/ul>\n<h2>5 Memcached\u7f13\u5b58<\/h2>\n<h3>5.1 \u7b80\u4ecb<\/h3>\n<ul>\n<li>\u5b9a\u4f4d&#xff1a;\u9ad8\u6027\u80fd\u5206\u5e03\u5f0f\u5185\u5b58\u5bf9\u8c61\u7f13\u5b58\u7cfb\u7edf&#xff0c;LiveJournal\u56e2\u961f2003\u5e74\u5f00\u53d1<\/li>\n<li>\u8bbe\u8ba1\u54f2\u5b66&#xff1a;\u7b80\u5355\u3001\u5feb\u901f\u3001\u5206\u5e03\u5f0f&#xff0c;\u4e13\u6ce8\u7f13\u5b58\u4e0d\u505a\u6301\u4e45\u5316<\/li>\n<li>\u6838\u5fc3\u7279\u70b9&#xff1a;\n<ul>\n<li>\u7eaf\u5185\u5b58\u64cd\u4f5c&#xff0c;\u8bfb\u5199\u901f\u5ea6\u6781\u5feb&#xff08;\u5fae\u79d2\u7ea7&#xff09;<\/li>\n<li>\u57fa\u4e8elibevent\u5b9e\u73b0\u9ad8\u6548\u4e8b\u4ef6\u9a71\u52a8\u7f51\u7edcIO<\/li>\n<li>\u5206\u5e03\u5f0f&#xff1a;\u5ba2\u6237\u7aef\u901a\u8fc7\u4e00\u81f4\u6027\u54c8\u5e0c\u9009\u62e9\u670d\u52a1\u5668\u8282\u70b9<\/li>\n<li>\u4e0d\u652f\u6301\u6301\u4e45\u5316&#xff1a;\u91cd\u542f\u6570\u636e\u4e22\u5931&#xff0c;\u7eaf\u7f13\u5b58\u7528\u9014<\/li>\n<li>LRU\u6dd8\u6c70&#xff1a;\u5185\u5b58\u6ee1\u65f6\u81ea\u52a8\u6dd8\u6c70\u6700\u5c11\u4f7f\u7528\u6570\u636e<\/li>\n<\/ul>\n<\/li>\n<li>\u9650\u5236&#xff1a;\n<ul>\n<li>\u5355\u4e2a\u5bf9\u8c61\u6700\u59271MB&#xff08;\u9002\u5408Session\u3001\u5c0f\u5bf9\u8c61&#xff0c;\u4e0d\u9002\u5408\u5927\u6587\u4ef6&#xff09;<\/li>\n<li>\u4ec5\u652f\u6301Key-Value&#xff08;String&#xff09;&#xff0c;\u65e0\u590d\u6742\u6570\u636e\u7ed3\u6784<\/li>\n<li>\u65e0\u8ba4\u8bc1\u673a\u5236&#xff0c;\u9700\u90e8\u7f72\u5728\u5185\u7f51<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>5.2 \u4e0eRedis\u5bf9\u6bd4<\/h3>\n<table>\n<tr>\u7279\u6027MemcachedRedis<\/tr>\n<tbody>\n<tr>\n<td>\u6570\u636e\u7ed3\u6784<\/td>\n<td>\u4ec5String<\/td>\n<td>String\u3001Hash\u3001List\u3001Set\u3001ZSet\u7b49<\/td>\n<\/tr>\n<tr>\n<td>\u6301\u4e45\u5316<\/td>\n<td>\u4e0d\u652f\u6301<\/td>\n<td>RDB\u5feb\u7167\u3001AOF\u65e5\u5fd7<\/td>\n<\/tr>\n<tr>\n<td>\u96c6\u7fa4<\/td>\n<td>\u5ba2\u6237\u7aef\u5206\u7247<\/td>\n<td>Redis Cluster\u539f\u751f\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td>\u529f\u80fd<\/td>\n<td>\u7b80\u5355\u7f13\u5b58<\/td>\n<td>\u7f13\u5b58\u3001\u6d88\u606f\u961f\u5217\u3001\u5206\u5e03\u5f0f\u9501\u7b49<\/td>\n<\/tr>\n<tr>\n<td>\u5185\u5b58\u7ba1\u7406<\/td>\n<td>\u9884\u5206\u914d\u5185\u5b58\u6c60<\/td>\n<td>\u73b0\u573a\u7533\u8bf7\u5185\u5b58<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u7528\u573a\u666f<\/td>\n<td>\u7eaf\u7f13\u5b58\u3001\u7b80\u5355KV<\/td>\n<td>\u590d\u6742\u6570\u636e\u7ed3\u6784\u3001\u6301\u4e45\u5316\u9700\u6c42<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>5.3 \u57fa\u672c\u547d\u4ee4\u8be6\u89e3<\/h3>\n<table>\n<tr>\u547d\u4ee4\u8bf4\u660e\u793a\u4f8b\u8fd4\u56de\u503c<\/tr>\n<tbody>\n<tr>\n<td>set<\/td>\n<td>\u8bbe\u7f6e\/\u66f4\u65b0\u952e\u503c&#xff08;\u5b58\u5728\u8986\u76d6&#xff0c;\u4e0d\u5b58\u5728\u521b\u5efa&#xff09;<\/td>\n<td>set username 0 3600 5<\/td>\n<td>STORED\/ERROR<\/td>\n<\/tr>\n<tr>\n<td>add<\/td>\n<td>\u4ec5\u65b0\u589e&#xff08;\u952e\u4e0d\u5b58\u5728\u624d\u6dfb\u52a0&#xff09;<\/td>\n<td>add counter 0 60 1<\/td>\n<td>STORED\/NOT_STORED<\/td>\n<\/tr>\n<tr>\n<td>replace<\/td>\n<td>\u4ec5\u66ff\u6362&#xff08;\u952e\u5b58\u5728\u624d\u66f4\u65b0&#xff09;<\/td>\n<td>replace config 0 0 10<\/td>\n<td>STORED\/NOT_STORED<\/td>\n<\/tr>\n<tr>\n<td>get<\/td>\n<td>\u83b7\u53d6\u503c<\/td>\n<td>get username<\/td>\n<td>VALUE\u2026END<\/td>\n<\/tr>\n<tr>\n<td>gets<\/td>\n<td>\u83b7\u53d6\u503c\u548cCAS\u4ee4\u724c&#xff08;\u7528\u4e8e\u4e50\u89c2\u9501&#xff09;<\/td>\n<td>gets username<\/td>\n<td>\u542b\u7248\u672c\u53f7<\/td>\n<\/tr>\n<tr>\n<td>delete<\/td>\n<td>\u5220\u9664\u952e<\/td>\n<td>delete oldkey<\/td>\n<td>DELETED\/NOT_FOUND<\/td>\n<\/tr>\n<tr>\n<td>incr\/decr<\/td>\n<td>\u539f\u5b50\u589e\u51cf&#xff08;\u4ec5\u6570\u5b57&#xff09;<\/td>\n<td>incr counter 1<\/td>\n<td>\u65b0\u503c\/ERROR<\/td>\n<\/tr>\n<tr>\n<td>flush_all<\/td>\n<td>\u6e05\u7a7a\u6240\u6709\u6570\u636e&#xff08;\u5371\u9669&#xff01;&#xff09;<\/td>\n<td>flush_all<\/td>\n<td>OK<\/td>\n<\/tr>\n<tr>\n<td>stats<\/td>\n<td>\u67e5\u770b\u7edf\u8ba1\u4fe1\u606f<\/td>\n<td>stats<\/td>\n<td>\u591a\u884c\u72b6\u6001\u6570\u636e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u53c2\u6570\u683c\u5f0f&#xff1a;command &lt;key&gt; &lt;flags&gt; &lt;exptime&gt; &lt;bytes&gt; [noreply]\\\\r\\\\n&lt;value&gt;\\\\r\\\\n<\/p>\n<ul>\n<li>key&#xff1a;\u952e\u540d&#xff0c;\u6700\u5927250\u5b57\u8282&#xff0c;\u4e0d\u80fd\u542b\u7a7a\u683c\/\u63a7\u5236\u5b57\u7b26<\/li>\n<li>flags&#xff1a;16\u4f4d\u65e0\u7b26\u53f7\u6574\u6570&#xff0c;\u5b58\u50a8\u989d\u5916\u6807\u8bb0&#xff08;\u5982\u6570\u636e\u7c7b\u578b&#xff09;&#xff0c;\u5ba2\u6237\u7aef\u81ea\u5b9a\u4e49<\/li>\n<li>exptime&#xff1a;\u8fc7\u671f\u65f6\u95f4&#xff08;\u79d2&#xff09;\n<ul>\n<li>0 &#061; \u6c38\u4e45\u5b58\u50a8&#xff08;\u4f46\u53d7LRU\u6dd8\u6c70&#xff09;<\/li>\n<li>30\u5929\u5185&#xff1a;\u79d2\u6570&#xff08;\u59823600&#061;1\u5c0f\u65f6&#xff09;<\/li>\n<li>Unix\u65f6\u95f4\u6233&#xff1a;1970\u5e741\u67081\u65e5\u4ee5\u6765\u7684\u79d2\u6570<\/li>\n<\/ul>\n<\/li>\n<li>bytes&#xff1a;\u6570\u636e\u5b57\u8282\u6570&#xff08;\u4e0d\u542b\\\\r\\\\n&#xff09;&#xff0c;\u5fc5\u987b\u4e0evalue\u5b9e\u9645\u957f\u5ea6\u4e00\u81f4<\/li>\n<li>noreply&#xff1a;\u53ef\u9009&#xff0c;\u4e0d\u7b49\u5f85\u670d\u52a1\u5668\u54cd\u5e94&#xff08;\u63d0\u5347\u6027\u80fd&#xff09;<\/li>\n<\/ul>\n<h2>6 Session\u5171\u4eab\u65b9\u6848&#xff08;MSM&#xff09;<\/h2>\n<h3>6.1 \u80cc\u666f<\/h3>\n<p>MSM&#xff08;Memcached Session Manager&#xff09;&#xff1a;\u5f00\u6e90Tomcat\u6269\u5c55&#xff0c;\u5c06Session\u5e8f\u5217\u5316\u540e\u5b58\u50a8\u5230Memcached&#xff0c;\u5b9e\u73b0&#xff1a;<\/p>\n<ul>\n<li>Session\u5171\u4eab&#xff1a;\u591aTomcat\u5b9e\u4f8b\u5171\u4eab\u540c\u4e00Session\u5b58\u50a8<\/li>\n<li>\u9ad8\u53ef\u7528&#xff1a;Memcached\u96c6\u7fa4\u6545\u969c\u65f6\u81ea\u52a8\u5207\u6362\u8282\u70b9<\/li>\n<li>\u5f39\u6027\u4f38\u7f29&#xff1a;Tomcat\u5b9e\u4f8b\u968f\u610f\u589e\u51cf&#xff0c;\u4e0d\u5f71\u54cd\u7528\u6237\u4f1a\u8bdd<\/li>\n<\/ul>\n<h3>6.2 \u6240\u9700Jar\u5305<\/h3>\n<p>\u5c06\u4ee5\u4e0bjar\u5305\u653e\u5165 $CATALINA_HOME\/lib\/ \u76ee\u5f55&#xff1a;<\/p>\n<table>\n<tr>Jar\u5305\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>memcached-session-manager<\/td>\n<td>MSM\u6838\u5fc3<\/td>\n<\/tr>\n<tr>\n<td>memcached-session-manager-tc9<\/td>\n<td>Tomcat 9\u9002\u914d\u5668&#xff08;\u6839\u636eTomcat\u7248\u672c\u9009\u62e9tc7\/tc8\/tc9&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>spymemcached<\/td>\n<td>Memcached Java\u5ba2\u6237\u7aef\u9a71\u52a8<\/td>\n<\/tr>\n<tr>\n<td>kryo<\/td>\n<td>\u9ad8\u6027\u80fdJava\u5e8f\u5217\u5316\u5e93&#xff08;\u66ff\u4ee3\u9ed8\u8ba4Java\u5e8f\u5217\u5316&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>kryo-serializers<\/td>\n<td>Kryo\u6269\u5c55\u5e8f\u5217\u5316\u5668<\/td>\n<\/tr>\n<tr>\n<td>minlog<\/td>\n<td>Kryo\u4f9d\u8d56<\/td>\n<\/tr>\n<tr>\n<td>objenesis<\/td>\n<td>Kryo\u4f9d\u8d56&#xff08;\u65e0\u53c2\u6784\u9020\u5b9e\u4f8b\u5316&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>asm<\/td>\n<td>\u5b57\u8282\u7801\u64cd\u4f5c\u5e93<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7248\u672c\u5339\u914d&#xff1a;tc9\u5bf9\u5e94Tomcat 9.x&#xff0c;tc8\u5bf9\u5e94Tomcat 8.x&#xff0c;\u52a1\u5fc5\u5339\u914d<\/p>\n<h3>6.3 \u5de5\u4f5c\u539f\u7406<\/h3>\n<h4>Sticky\u6a21\u5f0f&#xff08;\u7c98\u6027\u4f1a\u8bdd&#xff0c;\u63a8\u8350&#xff09;<\/h4>\n<p>\u7528\u6237\u8bf7\u6c42 \u2192 Nginx&#xff08;IP Hash\u56fa\u5b9a\u5230Tomcat A&#xff09;\u2192 Tomcat A<br \/>\n              \u2193<br \/>\n         Session\u5b58\u50a8&#xff1a;Memcached Node <span class=\"token number\">1<\/span>&#xff08;\u4e3b&#xff09;<br \/>\n              \u2193<br \/>\n         \u5f02\u6b65\u5907\u4efd\u5230&#xff1a;Memcached Node <span class=\"token number\">2<\/span>&#xff08;\u5907&#xff09;<\/p>\n<p>\u6d41\u7a0b&#xff1a;<\/p>\n<li>Tomcat A\u521b\u5efaSession&#xff0c;\u540c\u65f6\u5199\u5165Memcached Node 1&#xff08;\u4e3b&#xff09;<\/li>\n<li>\u5f02\u6b65\u590d\u5236\u5230Memcached Node 2&#xff08;\u5907&#xff09;<\/li>\n<li>\u7528\u6237\u540e\u7eed\u8bf7\u6c42\u59cb\u7ec8\u5230Tomcat A&#xff0c;\u76f4\u63a5\u4ece\u672c\u5730\u5185\u5b58\u8bfbSession&#xff08;\u6027\u80fd\u6700\u4f18&#xff09;<\/li>\n<li>\u6545\u969c\u5207\u6362&#xff1a;\u82e5Tomcat A\u5b95\u673a&#xff0c;Nginx\u5c06\u8bf7\u6c42\u8f6c\u53d1\u5230Tomcat B<\/li>\n<li>Tomcat B\u53d1\u73b0\u65e0\u672c\u5730Session&#xff0c;\u53bbMemcached Node 1\u8bfb\u53d6&#xff0c;\u6062\u590d\u7528\u6237\u72b6\u6001<\/li>\n<h4>Non-Sticky\u6a21\u5f0f&#xff08;\u975e\u7c98\u6027&#xff09;<\/h4>\n<p>\u7528\u6237\u8bf7\u6c421 \u2192 Tomcat A \u2192 \u5199\u5165Memcached Node <span class=\"token number\">1<\/span>\/2&#xff08;\u6839\u636eSessionID\u54c8\u5e0c&#xff09;<br \/>\n\u7528\u6237\u8bf7\u6c422 \u2192 Tomcat B \u2192 \u4eceMemcached\u8bfb\u53d6&#xff08;\u53ef\u80fd\u4e0d\u540c\u8282\u70b9&#xff09;<\/p>\n<p>\u7279\u70b9&#xff1a;\u6bcf\u4e2a\u8bf7\u6c42\u90fd\u53ef\u80fd\u5230\u4e0d\u540cTomcat&#xff0c;\u6bcf\u6b21\u9700\u4eceMemcached\u8bfb\u53d6Session&#xff0c;\u7f51\u7edc\u5f00\u9500\u5927&#xff0c;\u4f46Tomcat\u6545\u969c\u65e0\u611f\u77e5<\/p>\n<h4>\u5e8f\u5217\u5316\u8fc7\u7a0b<\/h4>\n<p>Tomcat Session\u5bf9\u8c61<br \/>\n       \u2193<br \/>\nKryo\u5e8f\u5217\u5316&#xff08;\u4e8c\u8fdb\u5236&#xff0c;\u9ad8\u6548&#xff09;<br \/>\n       \u2193<br \/>\n\u538b\u7f29&#xff08;\u53ef\u9009Snappy\/LZ4&#xff09;<br \/>\n       \u2193<br \/>\n\u5b58\u50a8\u5230Memcached&#xff08;Key<span class=\"token operator\">&#061;<\/span>SessionID&#xff0c;Value<span class=\"token operator\">&#061;<\/span>\u5e8f\u5217\u5316\u6570\u636e&#xff09;<\/p>\n<p>SessionID\u6620\u5c04&#xff1a;Memcached\u7684Key &#061; \u4f1a\u8bddID &#043; &#8211; &#043; Tomcat\u6807\u8bc6&#xff08;\u907f\u514d\u591aTomcat\u51b2\u7a81&#xff09;<\/p>\n<h4>\u6545\u969c\u6062\u590d\u673a\u5236<\/h4>\n<ul>\n<li>Memcached\u8282\u70b9\u6545\u969c&#xff1a;\u81ea\u52a8\u5207\u6362\u5230\u5907\u4efd\u8282\u70b9&#xff0c;Session\u4e0d\u4e22\u5931&#xff08;Sticky\u6a21\u5f0f&#xff09;<\/li>\n<li>Tomcat\u8282\u70b9\u6545\u969c&#xff1a;Nginx\u5254\u9664\u6545\u969c\u8282\u70b9&#xff0c;\u8bf7\u6c42\u8f6c\u5230\u5176\u4ed6Tomcat&#xff0c;\u4eceMemcached\u6062\u590dSession<\/li>\n<li>\u7f51\u7edc\u5206\u533a&#xff1a;\u4f9d\u8d56Memcached\u96c6\u7fa4\u81ea\u8eab\u7684\u9ad8\u53ef\u7528&#xff08;\u5982Repcached\u53cc\u5411\u590d\u5236&#xff09;<\/li>\n<\/ul>\n<h2>7 \u5b9e\u8df5<\/h2>\n<p>Tomcat\u5b9e\u8df5<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u76ee\u5f551. Web\u6280\u672f1.1 \u6838\u5fc3\u6982\u5ff51.2 \u9759\u3001\u52a8\u6001\u7f51\u98751.3 \u540c\u6b65\u3001\u5f02\u6b652 Web\u67b6\u67842.1 \u5355\u4f53\u67b6\u6784&#xff08;Monolithic&#xff09;2.2 \u5fae\u670d\u52a1\u67b6\u6784&#xff08;Microservices&#xff09;2.3 \u5e38\u89c1Web\u670d\u52a1\u5668\/\u5bb9\u56683 Tomcat3.1 \u5b9a\u4f4d3.2 \u6838\u5fc3\u529f\u80fd3.3 \u6838\u5fc3\u7ec4\u4ef63.4 \u76ee\u5f55\u7ed3\u67844 \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u88614.1 \u90e8\u7f72\u65b9\u5f0f\u6f14\u8fdb4.2 LNMT\/LAMT\u67b6\u6784\u5bf9\u6bd44.3 Session\u95ee\u9898\u8be6\u89e35 Memcached\u7f13\u5b585.1<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[223,87,44],"topic":[],"class_list":["post-84975","post","type-post","status-publish","format-standard","hentry","category-server","tag-tomcat","tag-87","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Web\u5e94\u7528\u670d\u52a1\u5668Tomcat - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/84975.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Web\u5e94\u7528\u670d\u52a1\u5668Tomcat - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u76ee\u5f551. Web\u6280\u672f1.1 \u6838\u5fc3\u6982\u5ff51.2 \u9759\u3001\u52a8\u6001\u7f51\u98751.3 \u540c\u6b65\u3001\u5f02\u6b652 Web\u67b6\u67842.1 \u5355\u4f53\u67b6\u6784&#xff08;Monolithic&#xff09;2.2 \u5fae\u670d\u52a1\u67b6\u6784&#xff08;Microservices&#xff09;2.3 \u5e38\u89c1Web\u670d\u52a1\u5668\/\u5bb9\u56683 Tomcat3.1 \u5b9a\u4f4d3.2 \u6838\u5fc3\u529f\u80fd3.3 \u6838\u5fc3\u7ec4\u4ef63.4 \u76ee\u5f55\u7ed3\u67844 \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u88614.1 \u90e8\u7f72\u65b9\u5f0f\u6f14\u8fdb4.2 LNMT\/LAMT\u67b6\u6784\u5bf9\u6bd44.3 Session\u95ee\u9898\u8be6\u89e35 Memcached\u7f13\u5b585.1\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/84975.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-26T13:16:42+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/84975.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/84975.html\",\"name\":\"Web\u5e94\u7528\u670d\u52a1\u5668Tomcat - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-26T13:16:42+00:00\",\"dateModified\":\"2026-07-26T13:16:42+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/84975.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/84975.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/84975.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web\u5e94\u7528\u670d\u52a1\u5668Tomcat\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Web\u5e94\u7528\u670d\u52a1\u5668Tomcat - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/84975.html","og_locale":"zh_CN","og_type":"article","og_title":"Web\u5e94\u7528\u670d\u52a1\u5668Tomcat - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u76ee\u5f551. Web\u6280\u672f1.1 \u6838\u5fc3\u6982\u5ff51.2 \u9759\u3001\u52a8\u6001\u7f51\u98751.3 \u540c\u6b65\u3001\u5f02\u6b652 Web\u67b6\u67842.1 \u5355\u4f53\u67b6\u6784&#xff08;Monolithic&#xff09;2.2 \u5fae\u670d\u52a1\u67b6\u6784&#xff08;Microservices&#xff09;2.3 \u5e38\u89c1Web\u670d\u52a1\u5668\/\u5bb9\u56683 Tomcat3.1 \u5b9a\u4f4d3.2 \u6838\u5fc3\u529f\u80fd3.3 \u6838\u5fc3\u7ec4\u4ef63.4 \u76ee\u5f55\u7ed3\u67844 \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u88614.1 \u90e8\u7f72\u65b9\u5f0f\u6f14\u8fdb4.2 LNMT\/LAMT\u67b6\u6784\u5bf9\u6bd44.3 Session\u95ee\u9898\u8be6\u89e35 Memcached\u7f13\u5b585.1","og_url":"https:\/\/www.wsisp.com\/helps\/84975.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-26T13:16:42+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/84975.html","url":"https:\/\/www.wsisp.com\/helps\/84975.html","name":"Web\u5e94\u7528\u670d\u52a1\u5668Tomcat - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-26T13:16:42+00:00","dateModified":"2026-07-26T13:16:42+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/84975.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/84975.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/84975.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Web\u5e94\u7528\u670d\u52a1\u5668Tomcat"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/84975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=84975"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/84975\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=84975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=84975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=84975"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=84975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}