{"id":166261,"date":"2019-12-25T12:00:32","date_gmt":"2019-12-25T04:00:32","guid":{"rendered":"https:\/\/gulass.cn\/?p=166261"},"modified":"2019-12-10T15:54:13","modified_gmt":"2019-12-10T07:54:13","slug":"tomcat-modify-config","status":"publish","type":"post","link":"https:\/\/gulass.cn\/tomcat-modify-config.html","title":{"rendered":"Tomcat\u4fee\u6539\u5185\u5b58\u914d\u7f6e"},"content":{"rendered":"
\u4e00\u3001\u914d\u7f6e<\/strong><\/div>\n

Tomcat\/conf\/server.xml\u4fee\u6539\u914d\u7f6e<\/p>\n

<connector port=\"8080\" protocol=\"org.apache.coyote.http11.Http11NioProtocol\"\r\n        redirectPort=\"8443\"\r\n        URIEncoding=\"UTF-8\"\r\n        minSpareThreads=\"25\"\r\n        maxSpareThreads=\"300\"\r\n        maxThreads=\"500\"\r\n        acceptCount=\"500\"\r\n        connectionTimeout=\"30000\"\r\n        enableLookups=\"false\"\/><\/pre>\n
\u4e8c\u3001\u53c2\u6570\u8bf4\u660e<\/strong><\/div>\n

maxIdleTime\uff1a\u6700\u5927\u7a7a\u95f2\u65f6\u95f4\uff0c\u8d85\u8fc7\u8fd9\u4e2a\u7a7a\u95f2\u65f6\u95f4\uff0c\u4e14\u7ebf\u7a0b\u6570\u5927\u4e8eminSpareThreads\u7684\uff0c\u90fd\u4f1a\u88ab\u56de\u6536\uff0c\u9ed8\u8ba4\u503c1\u5206\u949f\uff0860000ms\uff09\uff1b<\/p>\n

minSpareThreads\uff1a\u6700\u5c0f\u7a7a\u95f2\u7ebf\u7a0b\u6570\uff0c\u4efb\u4f55\u60c5\u51b5\u90fd\u4f1a\u5b58\u6d3b\u7684\u7ebf\u7a0b\u6570\uff0c\u5373\u4fbf\u8d85\u8fc7\u4e86\u6700\u5927\u7a7a\u95f2\u65f6\u95f4\uff0c\u4e5f\u4e0d\u4f1a\u88ab\u56de\u6536\uff0c\u9ed8\u8ba4\u503c4\uff1b<\/p>\n

maxSpareThreads\uff1a\u6700\u5927\u7a7a\u95f2\u7ebf\u7a0b\u6570\uff0c\u5728\u6700\u5927\u7a7a\u95f2\u65f6\u95f4\uff08maxIdleTime\uff09\u5185\u6d3b\u8dc3\u8fc7\uff0c\u6b64\u65f6\u7a7a\u95f2\uff0c\u5f53\u7a7a\u95f2\u65f6\u95f4\u5927\u4e8emaxIdleTime\u5219\u88ab\u56de\u6536\uff0c\u5c0f\u5219\u7ee7\u7eed\u5b58\u6d3b\uff0c\u7b49\u5f85\u88ab\u8c03\u5ea6\uff0c\u9ed8\u8ba4\u503c50\uff1b<\/p>\n

maxThreads\uff1a\u6700\u5927\u7ebf\u7a0b\u6570\uff0c\u5927\u5e76\u53d1\u8bf7\u6c42\u65f6\uff0ctomcat\u80fd\u521b\u5efa\u6765\u5904\u7406\u8bf7\u6c42\u7684\u6700\u5927\u7ebf\u7a0b\u6570\uff0c\u8d85\u8fc7\u5219\u653e\u5165\u8bf7\u6c42\u961f\u5217\u4e2d\u8fdb\u884c\u6392\u961f\uff0c\u9ed8\u8ba4\u503c\u4e3a200\uff1b<\/p>\n

acceptCount\uff1a\u5f53\u6700\u5927\u7ebf\u7a0b\u6570\uff08maxThreads\uff09\u88ab\u4f7f\u7528\u5b8c\u65f6\uff0c\u53ef\u4ee5\u653e\u5165\u8bf7\u6c42\u961f\u5217\u6392\u961f\u4e2a\u6570\uff0c\u8d85\u8fc7\u8fd9\u4e2a\u6570\u8fd4\u56deconnection refused\uff08\u8bf7\u6c42\u88ab\u62d2\u7edd\uff09\uff0c\u4e00\u822c\u8bbe\u7f6e\u548cmax<\/p>\n

Threads\u4e00\u6837\uff0c\u4e0d\u8fc7\u8fd9\u4e2a\u5177\u4f53\u9700\u8981\u6839\u636e\u81ea\u5df1\u7684\u5e94\u7528\u5b9e\u9645\u8bbf\u95ee\u5cf0\u503c\u548c\u5e73\u5747\u503c\u6765\u6743\u8861\uff0c\u9ed8\u8ba4\u503c\u4e3a100\uff1b<\/p>\n

connectionTimeout\uff1a\u7f51\u7edc\u8fde\u63a5\u8d85\u65f6\uff0c\u5047\u8bbe\u8bbe\u7f6e\u4e3a0\u8868\u793a\u6c38\u4e0d\u8d85\u65f6\uff0c\u8fd9\u6837\u8bbe\u7f6e\u9690\u60a3\u5de8\u5927\uff0c\u901a\u5e38\u53ef\u8bbe\u7f6e\u4e3a30000ms\uff0c\u9ed8\u8ba460000ms\u3002<\/p>\n

Windows Tomcat\u5141\u8bb8\u6bcf\u4e2a\u8fdb\u7a0bmaxThreads\uff08\u6700\u5927\u7ebf\u7a0b\u6570\uff092000<\/p>\n

Linux Tomcat\u5141\u8bb8\u6bcf\u4e2a\u8fdb\u7a0bmaxThreads\uff08\u6700\u5927\u7ebf\u7a0b\u6570\uff091000<\/p>\n

\"\"<\/p>\n

\u56fe\u89e3\u7ebf\u7a0b\u6c60\u539f\u7406<\/p>\n

\"\"<\/p>\n

\u8bf7\u770b\u4e0b\u9762\u4e09\u79cd\u60c5\u51b5<\/strong><\/span><\/div>\n

\u60c5\u51b51\uff1a\u63a5\u53d7\u4e00\u4e2a\u8bf7\u6c42\uff0c\u6b64\u65f6tomcat\u8d77\u52a8\u7684\u7ebf\u7a0b\u6570\u6ca1\u6709\u5230\u8fbemaxThreads\uff0ctomcat\u4f1a\u8d77\u52a8\u4e00\u4e2a\u7ebf\u7a0b\u6765\u5904\u7406\u6b64\u8bf7\u6c42\u3002<\/p>\n

\u60c5\u51b52\uff1a\u63a5\u53d7\u4e00\u4e2a\u8bf7\u6c42\uff0c\u6b64\u65f6tomcat\u8d77\u52a8\u7684\u7ebf\u7a0b\u6570\u5df2\u7ecf\u5230\u8fbemaxThreads\uff0ctomcat\u4f1a\u628a\u6b64\u8bf7\u6c42\u653e\u5165\u7b49\u5f85\u961f\u5217\uff0c\u7b49\u5f85\u7a7a\u95f2\u7ebf\u7a0b\u3002<\/p>\n

\u60c5\u51b53\uff1a\u63a5\u53d7\u4e00\u4e2a\u8bf7\u6c42\uff0c\u6b64\u65f6tomcat\u8d77\u52a8\u7684\u7ebf\u7a0b\u6570\u5df2\u7ecf\u5230\u8fbemaxThreads\uff0c\u7b49\u5f85\u961f\u5217\u4e2d\u7684\u8bf7\u6c42\u4e2a\u6570\u4e5f\u8fbe\u5230\u4e86acceptCount\uff0c\u6b64\u65f6tomcat\u4f1a\u76f4\u63a5\u62d2\u7edd\u6b64\u6b21\u8bf7\u6c42\uff0c\u8fd4\u56deconnection refused<\/p>\n

maxThreads\u5982\u4f55\u914d\u7f6e<\/strong><\/div>\n

\u4e00\u822c\u7684\u670d\u52a1\u5668\u64cd\u4f5c\u90fd\u5305\u62ec\u91cf\u65b9\u9762\uff1a1\u8ba1\u7b97\uff08\u4e3b\u8981\u6d88\u8017cpu\uff09\uff0c2\u7b49\u5f85\uff08io\u3001\u6570\u636e\u5e93\u7b49\uff09<\/p>\n

\u7b2c\u4e00\u79cd\u6781\u7aef\u60c5\u51b5\uff0c\u5982\u679c\u6211\u4eec\u7684\u64cd\u4f5c\u662f\u7eaf\u7cb9\u7684\u8ba1\u7b97\uff0c\u90a3\u4e48\u7cfb\u7edf\u54cd\u5e94\u65f6\u95f4\u7684\u4e3b\u8981\u9650\u5236\u5c31\u662fcpu\u7684\u8fd0\u7b97\u80fd\u529b\uff0c\u6b64\u65f6maxThreads\u5e94\u8be5\u5c3d\u91cf\u8bbe\u7684\u5c0f\uff0c\u964d\u4f4e\u540c\u4e00\u65f6\u95f4\u5185\u4e89\u62a2cpu\u7684\u7ebf\u7a0b\u4e2a\u6570\uff0c\u53ef\u4ee5\u63d0\u9ad8\u8ba1\u7b97\u6548\u7387\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7684\u6574\u4f53\u5904\u7406\u80fd\u529b\u3002<\/p>\n

\u7b2c\u4e8c\u79cd\u6781\u7aef\u60c5\u51b5\uff0c\u5982\u679c\u6211\u4eec\u7684\u64cd\u4f5c\u7eaf\u7cb9\u662fIO\u6216\u8005\u6570\u636e\u5e93\uff0c\u90a3\u4e48\u54cd\u5e94\u65f6\u95f4\u7684\u4e3b\u8981\u9650\u5236\u5c31\u53d8\u4e3a\u7b49\u5f85\u5916\u90e8\u8d44\u6e90\uff0c\u6b64\u65f6maxThreads\u5e94\u8be5\u5c3d\u91cf\u8bbe\u7684\u5927\uff0c\u8fd9\u6837\u624d\u80fd\u63d0\u9ad8\u540c\u65f6\u5904\u7406\u8bf7\u6c42\u7684\u4e2a\u6570\uff0c\u4ece\u800c\u63d0\u9ad8\u7cfb\u7edf\u6574\u4f53\u7684\u5904\u7406\u80fd\u529b\u3002\u6b64\u60c5\u51b5\u4e0b\u56e0\u4e3atomcat\u540c\u65f6\u5904\u7406\u7684\u8bf7\u6c42\u91cf\u4f1a\u6bd4\u8f83\u5927\uff0c\u6240\u4ee5\u9700\u8981\u5173\u6ce8\u4e00\u4e0btomcat\u7684\u865a\u62df\u673a\u5185\u5b58\u8bbe\u7f6e\u548clinux\u7684open file\u9650\u5236\u3002<\/p>\n

\u6211\u5728\u6d4b\u8bd5\u65f6\u9047\u5230\u4e00\u4e2a\u95ee\u9898\uff0cmaxThreads\u6211\u8bbe\u7f6e\u7684\u6bd4\u8f83\u5927\u6bd4\u59823000\uff0c\u5f53\u670d\u52a1\u7684\u7ebf\u7a0b\u6570\u5927\u5230\u4e00\u5b9a\u7a0b\u5ea6\u65f6\uff0c\u4e00\u822c\u662f2000\u51fa\u5934\uff0c\u5355\u6b21\u8bf7\u6c42\u7684\u54cd\u5e94\u65f6\u95f4\u5c31\u4f1a\u6025\u5267\u7684\u589e\u52a0\uff0c\u767e\u601d\u4e0d\u5f97\u5176\u89e3\u8fd9\u662f\u4e3a\u4ec0\u4e48\uff0c\u56db\u5904\u5bfb\u6c42\u7b54\u6848\u65e0\u679c\uff0c\u6700\u540e\u6211\u603b\u7ed3\u7684\u539f\u56e0\u53ef\u80fd\u662fcpu\u5728\u7ebf\u7a0b\u5207\u6362\u65f6\u6d88\u8017\u7684\u65f6\u95f4\u968f\u7740\u7ebf\u7a0b\u6570\u91cf\u7684\u589e\u52a0\u8d8a\u6765\u8d8a\u5927\uff0ccpu\u628a\u5927\u591a\u6570\u65f6\u95f4\u90fd\u7528\u6765\u5728\u8fd92000\u591a\u4e2a\u7ebf\u7a0b\u76f4\u63a5\u5207\u6362\u4e0a\u4e86\uff0c\u5f53\u7136cpu\u5c31\u6ca1\u6709\u65f6\u95f4\u6765\u5904\u7406\u6211\u4eec\u7684\u7a0b\u5e8f\u4e86\u3002\u4ee5\u524d\u4e00\u76f4\u7b80\u5355\u7684\u8ba4\u4e3a\u591a\u7ebf\u7a0b=\u9ad8\u6548\u7387\u3002\u3002\u5176\u5b9e\u591a\u7ebf\u7a0b\u672c\u8eab\u5e76\u4e0d\u80fd\u63d0\u9ad8cpu\u6548\u7387\uff0c\u7ebf\u7a0b\u8fc7\u591a\u53cd\u800c\u4f1a\u964d\u4f4ecpu\u6548\u7387\u3002\u5f53cpu\u6838\u5fc3\u6570<\u7ebf\u7a0b\u6570\u65f6\uff0ccpu\u5c31\u9700\u8981\u5728\u591a\u4e2a\u7ebf\u7a0b\u76f4\u63a5\u6765\u56de\u5207\u6362\uff0c\u4ee5\u4fdd\u8bc1\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u4f1a\u83b7\u5f97cpu\u65f6\u95f4\uff0c\u5373\u901a\u5e38\u6211\u4eec\u8bf4\u7684\u5e76\u53d1\u6267\u884c\u3002\u6240\u4ee5maxThreads\u7684\u914d\u7f6e\u7edd\u5bf9\u4e0d\u662f\u8d8a\u5927\u8d8a\u597d\u3002<\/p>\n

\u73b0\u5b9e\u5e94\u7528\u4e2d\uff0c\u6211\u4eec\u7684\u64cd\u4f5c\u90fd\u4f1a\u5305\u542b\u4ee5\u4e0a\u4e24\u79cd\u7c7b\u578b\uff08\u8ba1\u7b97\u3001\u7b49\u5f85\uff09\uff0c\u6240\u4ee5maxThreads\u7684\u914d\u7f6e\u5e76\u6ca1\u6709\u4e00\u4e2a\u6700\u4f18\u503c\uff0c\u4e00\u5b9a\u8981\u6839\u636e\u5177\u4f53\u60c5\u51b5\u6765\u914d\u7f6e\u3002\u6700\u597d\u7684\u505a\u6cd5\u662f\uff1a\u5728\u4e0d\u65ad\u6d4b\u8bd5\u7684\u57fa\u7840\u4e0a\uff0c\u4e0d\u65ad\u8c03\u6574\u3001\u4f18\u5316\uff0c\u624d\u80fd\u5f97\u5230\u6700\u5408\u7406\u7684\u914d\u7f6e\u3002<\/p>\n

acceptCount\u7684\u914d\u7f6e\uff0c\u6211\u4e00\u822c\u662f\u8bbe\u7f6e\u7684\u8ddfmaxThreads\u4e00\u6837\u5927\uff0c\u8fd9\u4e2a\u503c\u5e94\u8be5\u662f\u4e3b\u8981\u6839\u636e\u5e94\u7528\u7684\u8bbf\u95ee\u5cf0\u503c\u4e0e\u5e73\u5747\u503c\u6765\u6743\u8861\u914d\u7f6e\u7684\u3002<\/p>\n

\u5982\u679c\u8bbe\u7684\u8f83\u5c0f\uff0c\u53ef\u4ee5\u4fdd\u8bc1\u63a5\u53d7\u7684\u8bf7\u6c42\u8f83\u5feb\u76f8\u5e94\uff0c\u4f46\u662f\u8d85\u51fa\u7684\u8bf7\u6c42\u53ef\u80fd\u5c31\u76f4\u63a5\u88ab\u62d2\u7edd<\/p>\n

\u5982\u679c\u8bbe\u7684\u8f83\u5927\uff0c\u53ef\u80fd\u5c31\u4f1a\u51fa\u73b0\u5927\u91cf\u7684\u8bf7\u6c42\u8d85\u65f6\u7684\u60c5\u51b5\uff0c\u56e0\u4e3a\u6211\u4eec\u7cfb\u7edf\u7684\u5904\u7406\u80fd\u529b\u662f\u4e00\u5b9a\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

Tomcat\/conf\/server.xml\u4fee\u6539\u914d\u7f6e <connector port=”8080″ pr […]<\/p>\n","protected":false},"author":310,"featured_media":166269,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-166261","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/166261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/310"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=166261"}],"version-history":[{"count":15,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/166261\/revisions"}],"predecessor-version":[{"id":166287,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/166261\/revisions\/166287"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/166269"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=166261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=166261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=166261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}