{"id":45860,"date":"2020-11-03T14:34:31","date_gmt":"2020-11-03T06:34:31","guid":{"rendered":"http:\/\/www.zhushiyao.com\/?p=45860"},"modified":"2020-11-03T14:35:20","modified_gmt":"2020-11-03T06:35:20","slug":"103de1eafb","status":"publish","type":"post","link":"http:\/\/www.zhushiyao.com\/?p=45860","title":{"rendered":"Tomcat\u8c03\u4f18\u548cJVM\u53c2\u6570\u4f18\u5316\u7684"},"content":{"rendered":"<div class=\"bpp-post-content\">\n<section>\n<section style=\"padding-right: 10px; padding-left: 10px; text-align: left; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; line-height: 1.6; letter-spacing: 0.034em; color: #3f3f3f; font-size: 16px;\">\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u5173\u4e8eTomcat\u8c03\u4f18\u548cJVM\u4f18\u5316\uff0c\u6211\u542c\u5b8c\u8fd9\u4e2a\u7684\u65f6\u5019\uff0c\u5f53\u65f6\u5c31\u60f3\u8bf4\uff0c\u95ee\u8fd9\u4e2a\u4e0d\u662f\u5e94\u8be5\u7684\u4e48\uff1f\u90a3\u4e48\u4e0b\u9762\u963f\u7c89\u5c31\u7ed9\u5927\u5bb6\u597d\u597d\u7684\u63b0\u626f\u63b0\u626f\u8fd9\u4e2aTomcat\u4f18\u5316\u548c JVM \u53c2\u6570\u4f18\u5316\u7684\u4e8b\u60c5<\/p>\n<h3 style=\"margin-bottom: 15px; font-weight: bold; color: black; font-size: 20px; margin-top: 1.2em;\"><span style=\"font-size: 17px; display: inline-block; margin-left: 8px; color: #48b378;\">Tomcat<\/span><\/h3>\n<figure style=\"margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"display: block; margin-right: auto; margin-left: auto; border-radius: 4px; margin-bottom: 25px;\" title=\"\u8fd9\u5e74\u5934\u8fd8\u6709\u95eeTomcat\u8c03\u4f18\u548cJVM\u53c2\u6570\u4f18\u5316\u7684\uff0c\u4f60\u8fd8\u4e0d\u77e5\u9053\u600e\u4e48\u56de\u7b54\u4e48\uff1f\u90a3\u4e48\u4f60\u4e00\u5b9a\u9700\u8981\u770b\u770b\u8fd9\u7bc7\u6587\u7ae0\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/11\/3-1604385271.png\" alt=\"\u8fd9\u5e74\u5934\u8fd8\u6709\u95eeTomcat\u8c03\u4f18\u548cJVM\u53c2\u6570\u4f18\u5316\u7684\uff0c\u4f60\u8fd8\u4e0d\u77e5\u9053\u600e\u4e48\u56de\u7b54\u4e48\uff1f\u90a3\u4e48\u4f60\u4e00\u5b9a\u9700\u8981\u770b\u770b\u8fd9\u7bc7\u6587\u7ae0\" \/><\/figure>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u5173\u4e8eTomcat\u662f\u4ec0\u4e48\u4e1c\u897f\uff0c\u76f8\u4fe1\u5927\u5bb6\u505a\u5f00\u53d1\u7684\uff0c\u80af\u5b9a\u662f\u4e00\u70b9\u4e5f\u4e0d\u964c\u751f\uff0c\u670d\u52a1\u5668\uff0cWeb\u5e94\u7528\u670d\u52a1\u5668\uff0c\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u5e94\u7528\u670d\u52a1\u5668\uff0c\u5728\u4e2d\u5c0f\u578b\u7cfb\u7edf\u548c\u5e76\u53d1\u8bbf\u95ee\u7528\u6237\u4e0d\u662f\u5f88\u591a\u7684\u573a\u5408\u4e0b\u88ab\u666e\u904d\u4f7f\u7528\uff0c\u662f\u5f00\u53d1\u548c\u8c03\u8bd5JSP \u7a0b\u5e8f\u7684\u9996\u9009\u3002<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u800c\u6211\u4eec\u5728\u65e5\u5e38\u7684\u5f00\u53d1\u4e2d\uff0c\u53ef\u80fd\u5f88\u5927\u4e00\u90e8\u5206\u6211\u4eec\u53ea\u662f\u77e5\u9053\u600e\u4e48\u4f7f\u7528Tomcat\u670d\u52a1\u5668\uff0c\u4f46\u662f\u5374\u4e0d\u77e5\u9053\u600e\u4e48\u53bb\u8c03\u6574Tomcat\u91cc\u9762\u7684\u5404\u79cd\u914d\u7f6e\u53c2\u6570\uff0c\u8ba9Tomcat\u80fd\u591f\u66f4\u597d\u7684\u8fd0\u884c\uff0c\u90a3\u4e48\u5c31\u542c\u963f\u7c89\u6765\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u628a\u3002<\/p>\n<h4 style=\"margin-bottom: 15px; font-weight: bold; color: black; font-size: 18px; margin-top: 30px;\">\u914d\u7f6e\u6587\u4ef6\u4fee\u6539\u4f18\u5316<\/h4>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">Tomcat\u5728Windows\u4e0b\u4e00\u822c\u7684\u76ee\u5f55\u90fd\u662f\u6211\u4eec\u4e0b\u8f7d\u89e3\u538b\u51fa\u6765\u7684\u76ee\u5f55\u4e5f\u5c31\u662f${TOMCAT_HOME}\uff0c\u5c31\u50cf\u8fd9\u4e2a\u6837\u5b50 D:developtomcatapache-tomcat-7.0.88\uff0c\u800c\u4ed6\u7684\u914d\u7f6e\u6587\u4ef6\u5c31\u662fconf\u4e0b\u7684server.xml\u6587\u4ef6\uff0c\u800c\u6211\u4eec\u9700\u8981\u8c03\u4f18\u7684\u80af\u5b9a\u4e5f\u662f\u8fd9\u4e2a\u6587\u4ef6\u91cc\u9762\u7684\u5185\u5bb9\u3002<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u6211\u4eec\u5c31\u5148\u4ece Connector \u6765\u8fdb\u884c\u5206\u6790\uff1a<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">Connector \uff1a\u8fde\u63a5\u5668\uff0c\u8d1f\u8d23\u63a5\u6536\u5ba2\u6237\u7684\u8bf7\u6c42\uff0c\u4ee5\u53ca\u5411\u5ba2\u6237\u7aef\u56de\u9001\u54cd\u5e94\u7684\u6d88\u606f<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u800c\u6211\u4eec\u5bf9 Connector \u4f18\u5316\uff0c\u5176\u5b9e\u4f18\u5316\u7684\u5c31\u662f\u6211\u4eec\u5728\u8bbf\u95ee\u8bf7\u6c42\u65f6\u5019\u7684\u5e76\u53d1\u80fd\u529b\uff0c\u800c\u5f80\u5f80\u5e76\u53d1\u4e5f\u662f\u6211\u4eec\u5728\u5de5\u4f5c\u4e2d\u5f88\u591a\u65f6\u5019\u9700\u8981\u53bb\u8003\u8651\u7684\u95ee\u9898\uff0c\u800c\u6211\u4eec\u5728\u8fd9\u4e2a\u8fde\u63a5\u5668\u91cc\u9762\u53ef\u4ee5\u914d\u7f6e\u4ec0\u4e48\u5185\u5bb9\u5462\uff1f<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"overflow-x: auto; padding: 16px; color: #383a42; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #fafafa; border-radius: 5px;\">\u00a0\u00a0\u00a0\u00a0&lt;Connector\u00a0executor=<span style=\"color: #50a14f; line-height: 26px;\">\"tomcatThreadPool\"<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0port=<span style=\"color: #50a14f; line-height: 26px;\">\"8080\"<\/span>\u00a0protocol=<span style=\"color: #50a14f; line-height: 26px;\">\"HTTP\/1.1\"<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0connectionTimeout=<span style=\"color: #50a14f; line-height: 26px;\">\"20000\"<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0redirectPort=<span style=\"color: #50a14f; line-height: 26px;\">\"8443\"<\/span>\u00a0\/&gt;\n<\/code><\/pre>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u6211\u4eec\u6700\u5e38\u7528\u7684\u5c31\u662f\u5728\u91cc\u9762\u914d\u7f6e\u4e00\u4e2aURL\u7684\u7edf\u4e00\u7f16\u7801\u683c\u5f0f\u6bd4\u5982\u8bf4\u6211\u4eec\u5728\u91cc\u9762\u914d\u7f6e\u4e00\u4e2a UTF-8 \u7684\u7f16\u7801\u683c\u5f0f\u3002<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">URIEncoding<\/strong> \uff1aURIEncoding = UTF-8<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">executor<\/strong> : \u6307\u5b9a\u8fd9\u4e2a\u8fde\u63a5\u5668\u6240\u4f7f\u7528\u7684\u6267\u884c\u5668\uff08\u7ebf\u7a0b\u6c60\uff09<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">connectionTimeout<\/strong> \uff1a\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">maxThreads<\/strong> \uff1a\u5ba2\u6237\u8bf7\u6c42\u6700\u5927\u7ebf\u7a0b\u6570<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">minSpareThreads<\/strong> \uff1aTomcat\u521d\u59cb\u5316\u65f6\u521b\u5efa\u7684\u7ebf\u7a0b\u6570\uff0c\u4e00\u76f4\u4f1a\u8fd0\u884c\u7684\u7ebf\u7a0b<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">maxSpareThreads<\/strong> \uff1aTomcat\u8fde\u63a5\u5668\u7684\u6700\u5927\u7a7a\u95f2\u7ebf\u7a0b\u6570<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">minProcessors<\/strong> \uff1a\u670d\u52a1\u5668\u521b\u5efa\u65f6\u7684\u6700\u5c0f\u5904\u7406\u7ebf\u7a0b\u6570<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">maxProcessors<\/strong> \uff1a\u670d\u52a1\u5668\u540c\u65f6\u6700\u5927\u5904\u7406\u7ebf\u7a0b\u6570<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">enableLookups<\/strong> \uff1a\u82e5\u8bbe\u4e3atrue, \u5219\u652f\u6301\u57df\u540d\u89e3\u6790\uff0c\u53ef\u628a ip \u5730\u5740\u89e3\u6790\u4e3a\u4e3b\u673a\u540d,\u800c\u4e3a\u4e86\u51cf\u5c11\u6027\u80fd\u7684\u6d88\u8017\u7684\u8bdd\uff0c\u6211\u4eec\u5c31\u6709\u65f6\u5019\u4f1a\u5173\u95ed\u5b83<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">redirectPort<\/strong> \uff1a\u5728\u9700\u8981\u57fa\u4e8e\u5b89\u5168\u901a\u9053\u7684\u573a\u5408\uff0c\u628a\u5ba2\u6237\u8bf7\u6c42\u8f6c\u53d1\u5230\u57fa\u4e8eSSL \u7684 redirectPort \u7aef\u53e3<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">acceptAccount<\/strong> \uff1a\u76d1\u542c\u7aef\u53e3\u961f\u5217\u6700\u5927\u6570\uff0c\u6ee1\u4e86\u4e4b\u540e\u5ba2\u6237\u8bf7\u6c42\u4f1a\u88ab\u62d2\u7edd\uff08\u4e0d\u80fd\u5c0f\u4e8emaxSpareThreads \uff09<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u800c\u6211\u4eec\u4e00\u822c\u6700\u5e38\u642d\u914d\u7684\uff0c\u5374\u662f URIEncoding \u800c\u5f88\u5c11\u7684\u53bb\u6539\u5176\u4ed6\u7684\u914d\u7f6e\uff0c\u4f46\u662f\u5728\u9762\u8bd5\u4e2d\uff0c\u80af\u5b9a\u4e0d\u4f1a\u8bf4\u8ba9\u4f60\u53bb\u4f18\u5316\u7f16\u7801\u683c\u5f0f\u628a\uff0c\u800c\u6211\u4eec\u4fee\u6539\u7684\u4e00\u5b9a\u662f\u5176\u4ed6\u7684\u5173\u4e8e\u6700\u5927\u5904\u7406\u7ebf\u7a0b\u6570\uff0c\u57df\u540d\u89e3\u6790\u5566\uff0c<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u800c\u6211\u4eec\u5728\u6700\u7ec8\u7684\u914d\u7f6e\u5c31\u4e0d\u518d\u662f\u4e0a\u9762\u7684\u4ee3\u7801\u4e86\uff0c\u800c\u53d8\u6210\u4e86\u4f18\u5316\u4e4b\u540e\u7684\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"overflow-x: auto; padding: 16px; color: #383a42; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #fafafa; border-radius: 5px;\">\u00a0\u00a0\u00a0\u00a0&lt;Connector\u00a0port=<span style=\"color: #50a14f; line-height: 26px;\">\"8080\"<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0protocol=<span style=\"color: #50a14f; line-height: 26px;\">\"HTTP\/1.1\"<\/span>\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0connectionTimeout=<span style=\"color: #50a14f; line-height: 26px;\">\"20000\"<\/span>\u00a0\u8d85\u65f6\u65f6\u95f4\uff0c\u6beb\u79d2\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0redirectPort=<span style=\"color: #50a14f; line-height: 26px;\">\"443\"<\/span>\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0maxThreads=<span style=\"color: #50a14f; line-height: 26px;\">\"3000\"<\/span>\u00a0\u6700\u5927\u7ebf\u7a0b\u6570\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0minSpareThreads=<span style=\"color: #50a14f; line-height: 26px;\">\"20\"<\/span>\u00a0\u6700\u5c0f\u7a7a\u95f2\u7ebf\u7a0b\u6570\uff0c\u8fd9\u91cc\u662f\u4e00\u76f4\u4f1a\u8fd0\u884c\u7684\u7ebf\u7a0b\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0acceptCount=<span style=\"color: #50a14f; line-height: 26px;\">\"1000\"<\/span>\u00a0\u76d1\u542c\u7aef\u53e3\u961f\u5217\u6570\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0enableLookups=<span style=\"color: #50a14f; line-height: 26px;\">\"false\"<\/span>\u00a0\u5173\u95eddns\u89e3\u6790\uff0c\u51cf\u5c11\u6027\u80fd\u635f\u8017\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0server=<span style=\"color: #50a14f; line-height: 26px;\">\"None\"<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0URIEncoding=<span style=\"color: #50a14f; line-height: 26px;\">\"UTF-8\"<\/span>\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/&gt;\n\n<\/code><\/pre>\n<h3 style=\"margin-bottom: 15px; font-weight: bold; color: black; font-size: 20px; margin-top: 1.2em;\"><span style=\"font-size: 17px; display: inline-block; margin-left: 8px; color: #48b378;\">NIO\u548cBIO\u8fd8\u6709 NIO2<\/span><\/h3>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u5176\u5b9e\u5173\u4e8e NIO \u548c BIO \u548c AIO \u963f\u7c89\u5728\u4e4b\u524d\u5df2\u7ecf\u5b8c\u5168\u90fd\u8bf4\u8fc7\u4e86\uff0c\u540c\u6b65\u963b\u585e IO \u5c31\u662f BIO \uff0c\u800c\u540c\u6b65\u975e\u963b\u585eIO\u548c\u5f02\u6b65\u963b\u585eIO \u5c31\u662f NIO \uff0c\u800c\u5f02\u6b65\u975e\u963b\u585eIO\u5c31\u662f AIO \u5566\uff0c<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">BIO \uff1a\u540c\u6b65\u963b\u585eIO<\/p>\n<figure style=\"margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"display: block; margin-right: auto; margin-left: auto; border-radius: 4px; margin-bottom: 25px;\" title=\"\u8fd9\u5e74\u5934\u8fd8\u6709\u95eeTomcat\u8c03\u4f18\u548cJVM\u53c2\u6570\u4f18\u5316\u7684\uff0c\u4f60\u8fd8\u4e0d\u77e5\u9053\u600e\u4e48\u56de\u7b54\u4e48\uff1f\u90a3\u4e48\u4f60\u4e00\u5b9a\u9700\u8981\u770b\u770b\u8fd9\u7bc7\u6587\u7ae0\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/11\/6-1604385271.png\" alt=\"\u8fd9\u5e74\u5934\u8fd8\u6709\u95eeTomcat\u8c03\u4f18\u548cJVM\u53c2\u6570\u4f18\u5316\u7684\uff0c\u4f60\u8fd8\u4e0d\u77e5\u9053\u600e\u4e48\u56de\u7b54\u4e48\uff1f\u90a3\u4e48\u4f60\u4e00\u5b9a\u9700\u8981\u770b\u770b\u8fd9\u7bc7\u6587\u7ae0\" \/><\/figure>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">NIO \uff1a\u540c\u6b65\u975e\u963b\u585eIO\u548c\u5f02\u6b65\u963b\u585eIO<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">AIO \uff1a\u8fd9\u79cd\u5f02\u6b65\u975e\u963b\u585e IO \u662f\u6211\u4eec\u6700\u9700\u8981\u6ce8\u610f\u7684\uff0c\u662f\u4ece JDK7 \u53ca\u5176\u4ee5\u4e0a\u624d\u4f1a\u652f\u6301\u7684\u3002<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u8bdd\u4e0d\u591a\u8bf4\uff0c\u76f4\u63a5\u4e0a\u5982\u4f55\u4fee\u6539\uff0c<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"overflow-x: auto; padding: 16px; color: #383a42; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #fafafa; border-radius: 5px;\">&lt;Connector\u00a0connectionTimeout=<span style=\"color: #50a14f; line-height: 26px;\">\"20000\"<\/span>\u00a0port=<span style=\"color: #50a14f; line-height: 26px;\">\"8080\"<\/span>\u00a0protocol=<span style=\"color: #50a14f; line-height: 26px;\">\"HTTP\/1.1\"<\/span>\u00a0redirectPort=<span style=\"color: #50a14f; line-height: 26px;\">\"8443\"<\/span>\/&gt;\n\n&lt;Connector\u00a0connectionTimeout=<span style=\"color: #50a14f; line-height: 26px;\">\"20000\"<\/span>\u00a0port=<span style=\"color: #50a14f; line-height: 26px;\">\"8080\"<\/span>\u00a0protocol=<span style=\"color: #50a14f; line-height: 26px;\">\"org.apache.coyote.http11.Http11NioProtocol\"<\/span>\u00a0redirectPort=<span style=\"color: #50a14f; line-height: 26px;\">\"8443\"<\/span>\/&gt;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u7f51\u4e0a\u6709\u4eba\u8bf4\uff0c\u4ece Tomcat8 \u4ee5\u4e0a\u5c31\u662f NIO \u6a21\u5f0f\u4e86\uff0c\u4f46\u662f\u5b9e\u9645\u60c5\u51b5\u597d\u50cf\u662f\u6ca1\u6709\uff0c\u8fd8\u662f\u9700\u8981\u81ea\u5df1\u624b\u52a8\u53bb\u6362\u6210 NIO \u6a21\u5f0f\u3002<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u5173\u4e8e Tomcat\u7684\u4f18\u5316\uff0c\u963f\u7c89\u5c31\u4e0d\u518d\u7ed9\u5927\u5bb6\u53d9\u8ff0\u4e86\uff0c\u7ed9\u5927\u5bb6\u518d\u6765\u8bf4\u8bf4\u8fd9\u4e2a\u5173\u4e8e JVM \u7684\u4f18\u5316\u3002<\/p>\n<h4 style=\"margin-bottom: 15px; font-weight: bold; color: black; font-size: 18px; margin-top: 30px;\">JVM<\/h4>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u963f\u7c89\u6700\u5f00\u59cb\u5199\u6587\u7ae0\u7684\u65f6\u5019\uff0c\u5c31\u662f\u9996\u5148\u4ece JVM \u5199\u8d77\u6765\u7684\uff0c\u5927\u5bb6\u53ef\u4ee5\u641c\u7d22\u4e00\u4e0b\u66fe\u7ecf\u963f\u7c89\u5199\u7684\u5173\u4e8e JVM \u7684\u5185\u5bb9\uff0c\u91cc\u9762\u6709\u5bf9 JVM \u7684\u5b8c\u6574\u7684\u4ecb\u7ecd\uff0c\u5bf9 FullGC \uff0cYGC \u7b49\u5783\u573e\u6536\u96c6\u65b9\u5f0f\uff0c\u90fd\u505a\u8fc7\u4ecb\u7ecd\uff0c\u8fd9\u91cc\u963f\u7c89\u53ea\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u600e\u4e48\u53bb\u901a\u8fc7\u4fee\u6539 Tomcat \u7684\u914d\u7f6e\uff0c\u6765\u8fbe\u5230\uff0c\u6211\u4eec\u5bf9 JVM \u7684\u4f18\u5316\u3002<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u5927\u5bb6\u90fd\u77e5\u9053\uff0c\u6b63\u786e\u7684\u9009\u62e9\u4e0d\u540c\u7684 GC \u7b56\u7565\uff0c\u8c03\u6574 JVM\u3001GC \u7684\u53c2\u6570\uff0c\u53ef\u4ee5\u6781\u5927\u7684\u51cf\u5c11\u7531\u4e8e GC \u5de5\u4f5c\uff0c\u800c\u5374\u8fd9\u6837\u4f1a\u5927\u5927\u7684\u63d0\u9ad8\u6211\u4eec\u7a0b\u5e8f\u7684\u8fd0\u884c\u6548\u7387\u3002<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u76ee\u5f55\u8fd8\u662f\u90a3\u4e2a\u76ee\u5f55\uff0cTomcat \u7684\u6839\u76ee\u5f55\u4e0b\u7684 bin \u76ee\u5f55\uff0ccatalina.bat \uff0cLinux\u7684\u8bdd\uff0c\u53bb\u4fee\u6539.sh \u7684\u6587\u4ef6\u5373\u53ef\u3002<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u627e\u5230 JAVA_OPTS \u800c\u4ed6\u5c31\u662f\u7528\u6765\u8bbe\u7f6e JVM \u76f8\u5173\u8fd0\u884c\u53c2\u6570\u7684\u53d8\u91cf\u7684\uff0c\u5728\u8fd9\u91cc\u963f\u7c89\u4e5f\u7ed9\u5927\u5bb6\u8bf4\u4e00\u4e0b\u5173\u4e8e JVM \u7684\u53c2\u6570\u5c5e\u6027\uff0c\u4e0d\u7136\u4e0d\u80fd\u76f4\u63a5\u778e\u6539\u5427\uff0c\u5bb9\u6613\u51fa\u4e8b\u3002<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-Xms<\/strong> \uff1a\u521d\u59cb\u5806\u5927\u5c0f \u7269\u7406\u5185\u5b58\u76841\/64(&lt;1GB)<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-Xmx<\/strong> \uff1a\u6700\u5927\u5806\u5927\u5c0f \u7269\u7406\u5185\u5b58\u76841\/4(&lt;1GB)<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-Xmn<\/strong> \uff1a\u5e74\u8f7b\u4ee3\u5927\u5c0f(1.4or lator) \u00a0\u6ce8\u610f\u7684\u662f\u8fd9\u4e2a ,\u6574\u4e2a\u5806\u5927\u5c0f=\u5e74\u8f7b\u4ee3\u5927\u5c0f + \u5e74\u8001\u4ee3\u5927\u5c0f + \u6301\u4e45\u4ee3\u5927\u5c0f.<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:NewSize<\/strong> \uff1a\u8bbe\u7f6e\u5e74\u8f7b\u4ee3\u5927\u5c0f(for 1.3\/1.4)<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:MaxNewSize<\/strong> \uff1a\u5e74\u8f7b\u4ee3\u6700\u5927\u503c(for 1.3\/1.4)<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:PermSize<\/strong> \uff1a\u8bbe\u7f6e\u6301\u4e45\u4ee3(perm gen)\u521d\u59cb\u503c \u7269\u7406\u5185\u5b58\u76841\/64<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:MaxPermSize<\/strong> \uff1a\u8bbe\u7f6e\u6301\u4e45\u4ee3\u6700\u5927\u503c \u7269\u7406\u5185\u5b58\u76841\/4<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-Xss<\/strong> \uff1a\u6bcf\u4e2a\u7ebf\u7a0b\u7684\u5806\u6808\u5927\u5c0f<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:NewRatio<\/strong> \uff1a\u5e74\u8f7b\u4ee3(\u5305\u62ecEden\u548c\u4e24\u4e2aSurvivor\u533a)\u4e0e\u5e74\u8001\u4ee3\u7684\u6bd4\u503c(\u9664\u53bb\u6301\u4e45\u4ee3)<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:+AggressiveOpts<\/strong> \uff1a\u52a0\u5feb\u7f16\u8bd1<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:+UseBiasedLocking<\/strong> \uff1a\u9501\u673a\u5236\u7684\u6027\u80fd\u6539\u5584<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:+DisableExplicitGC<\/strong> \uff1a\u5173\u95edSystem.gc()<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:+UseParNewGC<\/strong> \uff1a\u8bbe\u7f6e\u5e74\u8f7b\u4ee3\u4e3a\u5e76\u884c\u6536\u96c6<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:+UseConcMarkSweepGC<\/strong> \uff1a\u4f7f\u7528CMS\u5185\u5b58\u6536\u96c6<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:MaxTenuringThreshold<\/strong> \uff1a\u5783\u573e\u6700\u5927\u5e74\u9f84<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX+UseCMSCompactAtFullCollection<\/strong> \uff1a\u5728FULL GC\u7684\u65f6\u5019\uff0c \u5bf9\u5e74\u8001\u4ee3\u7684\u538b\u7f29<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:LargePageSizeInBytes<\/strong> \uff1a\u5185\u5b58\u9875\u7684\u5927\u5c0f\u4e0d\u53ef\u8bbe\u7f6e\u8fc7\u5927\uff0c \u4f1a\u5f71\u54cdPerm\u7684\u5927\u5c0f<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:+UseFastAccessorMethods<\/strong> \uff1a\u539f\u59cb\u7c7b\u578b\u7684\u5feb\u901f\u4f18\u5316<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\"><strong style=\"line-height: 1.75em;\">-XX:+UseCMSInitiatingOccupancyOnly<\/strong> \uff1a\u4f7f\u7528\u624b\u52a8\u5b9a\u4e49\u521d\u59cb\u5316\u5b9a\u4e49\u5f00\u59cbCMS\u6536\u96c6<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u800c\u8fd9\u4e9b\u5185\u5bb9\u5c31\u662f\u9700\u8981\u4f60\u53bb\u81ea\u5df1\u624b\u52a8\u53bb\u6311\u9009\u4e00\u4e9b\u5408\u9002\u7684\u81ea\u5df1\u53bb\u914d\u7f6e\u4e0a\u53bb\uff0c\u800c\u4e0d\u662f\u4e00\u80a1\u8111\u7684\u590d\u5236\u4e0a\u53bb\uff0c\u4e0d\u7136\u9002\u5f97\u5176\u53cd\u5c31\u4e0d\u597d\u4e86\u3002<\/p>\n<p style=\"padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;\">\u7ed9\u963f\u7c89\u70b9\u4e2a\u5728\u770b\u5427\uff1f<\/p>\n<\/section>\n<section><\/section>\n<section><\/section>\n<section><\/section>\n<p style=\"margin: 1em 4px; padding-top: 8px; padding-bottom: 8px; max-width: 100%; min-height: 1em; font-size: 16px; white-space: normal; text-align: center; letter-spacing: 0.75px; line-height: 26px; color: black; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, Cambria, Cochin, Georgia, Times, serif; overflow-wrap: break-word !important; box-sizing: border-box !important;\"><span style=\"max-width: 100%; color: #ff6827; font-size: 12px; letter-spacing: 0.544px; word-spacing: 1px; caret-color: #333333; font-family: -apple-system-font, system-ui, Arial, sans-serif; overflow-wrap: break-word !important; box-sizing: border-box !important;\">&lt; END &gt;<\/span><\/p>\n<section><\/section>\n<\/section>\n<p>\u8f6c\u81ea\uff1ahttps:\/\/mp.weixin.qq.com\/s\/lwL3KXuj96Tl5QRr-1GsjA<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5173\u4e8eTomcat\u8c03\u4f18\u548cJVM\u4f18\u5316\uff0c\u6211\u542c\u5b8c\u8fd9\u4e2a\u7684\u65f6\u5019\uff0c\u5f53\u65f6\u5c31\u60f3\u8bf4\uff0c\u95ee\u8fd9\u4e2a\u4e0d\u662f\u5e94\u8be5\u7684\u4e48\uff1f\u90a3\u4e48\u4e0b\u9762\u963f\u7c89\u5c31\u7ed9\u5927\u5bb6\u597d\u597d\u7684 &hellip; <a href=\"http:\/\/www.zhushiyao.com\/?p=45860\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cTomcat\u8c03\u4f18\u548cJVM\u53c2\u6570\u4f18\u5316\u7684\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[938,957],"_links":{"self":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/45860"}],"collection":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=45860"}],"version-history":[{"count":2,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/45860\/revisions"}],"predecessor-version":[{"id":45867,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/45860\/revisions\/45867"}],"wp:attachment":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=45860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=45860"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=45860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}