{"id":34788,"date":"2026-11-26T18:00:00","date_gmt":"2026-11-26T10:00:00","guid":{"rendered":"https:\/\/cn.hostease.com\/blog\/?p=34788"},"modified":"2026-11-12T15:37:44","modified_gmt":"2026-11-12T07:37:44","slug":"wordpress-time-wait-database-server","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/blog\/tutorials\/wordpress-time-wait-database-server\/","title":{"rendered":"WordPress \u8fde\u63a5\u6570\u5f02\u5e38\u5347\u9ad8\u6392\u67e5\uff1aTIME_WAIT \u5806\u79ef\u3001\u6570\u636e\u5e93\u8fde\u63a5\u4e0e\u670d\u52a1\u5668\u5185\u6838\u53c2\u6570"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/11\/wordpress-time-wait-database-server-cover.webp\" alt=\"WordPress \u8fde\u63a5\u6570\u5f02\u5e38\u6392\u67e5\u5c01\u9762\u56fe\" loading=\"lazy\" \/><\/p>\n<p>\u4f60\u7684 WordPress \u7ad9\u70b9\u662f\u5426\u9047\u5230\u8fc7\u8fd9\u79cd\u60c5\u51b5\uff1a\u76d1\u63a7\u9762\u677f\u4e0a\u7684\u5e76\u53d1\u8fde\u63a5\u6570\u4e00\u8def\u722c\u5347\uff0c\u9875\u9762\u5f00\u59cb\u53d8\u6162\u751a\u81f3\u62a5&#8221;\u6570\u636e\u5e93\u8fde\u63a5\u8fc7\u591a&#8221;\uff0c\u91cd\u542f\u670d\u52a1\u540e\u8fc7\u51e0\u5c0f\u65f6\u53c8\u590d\u53d1\u3002\u8fd9\u7bc7\u6587\u7ae0\u5c31\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u2014\u2014\u5e26\u4f60\u6309&#8221;\u5148\u770b\u73b0\u8c61\u3001\u518d\u67e5\u8fde\u63a5\u3001\u6700\u540e\u8c03\u5185\u6838&#8221;\u7684\u987a\u5e8f\uff0c\u628a TIME_WAIT \u5806\u79ef\u3001\u6570\u636e\u5e93\u8fde\u63a5\u6cc4\u6f0f\u548c\u5185\u6838\u53c2\u6570\u4e09\u7c7b\u6839\u56e0\u9010\u4e00\u6392\u67e5\u6e05\u695a\uff0c\u5e2e\u52a9\u4f60\u4e0d\u7528\u76f2\u76ee\u91cd\u542f\u5c31\u80fd\u8ba9\u8fde\u63a5\u6570\u56de\u5230\u6b63\u5e38\u6c34\u4f4d\u3002\u8fd9\u5957\u65b9\u6cd5\u540c\u6837\u9002\u7528\u4e8e <a href=\"https:\/\/cn.hostease.com\/vps\/\">VPS<\/a>\uff08<a href=\"https:\/\/cn.hostease.com\/vps\/\">\u865a\u62df\u4e13\u7528\u670d\u52a1\u5668<\/a>\uff09\u548c<a href=\"https:\/\/cn.hostease.com\/dedicated-server\/\">\u72ec\u7acb\u670d\u52a1\u5668<\/a>\u73af\u5883\uff0c\u5982\u679c\u4f60\u8fd8\u5728\u9009\u578b\u9636\u6bb5\uff0c\u53ef\u4ee5\u5148\u4e86\u89e3<a href=\"https:\/\/cn.hostease.com\/vps\/\">\u76f8\u5173\u4e3b\u673a\u65b9\u6848<\/a>\u518d\u51b3\u5b9a\u90e8\u7f72\u73af\u5883\u3002<\/p>\n<h2>\u4e3a\u4ec0\u4e48\u8fde\u63a5\u6570\u4f1a\u5f02\u5e38\u5347\u9ad8\uff1a\u5148\u5206\u6e05\u4e09\u79cd\u5806\u79ef<\/h2>\n<p>\u5148\u7406\u89e3\u8fde\u63a5\u6570\u7684\u6784\u6210\u3002\u76d1\u63a7\u91cc\u7684&#8221;\u8fde\u63a5\u6570&#8221;\u901a\u5e38\u662f TCP \u8fde\u63a5\u603b\u6570\uff0c\u7531\u4e09\u90e8\u5206\u7ec4\u6210\uff1a\u6b63\u5728\u4f20\u8f93\u6570\u636e\u7684 ESTABLISHED \u8fde\u63a5\u3001\u5df2\u5173\u95ed\u4f46\u7b49\u5f85\u56de\u6536\u7684 TIME_WAIT \u8fde\u63a5\uff0c\u4ee5\u53ca PHP \u5230 MySQL \u7684\u6570\u636e\u5e93\u8fde\u63a5\u3002\u4efb\u4f55\u4e00\u7c7b\u5931\u63a7\u90fd\u4f1a\u8868\u73b0\u4e3a&#8221;\u8fde\u63a5\u6570\u5347\u9ad8&#8221;\uff0c\u4f46\u5904\u7406\u65b9\u6cd5\u5b8c\u5168\u4e0d\u540c\uff0c\u6240\u4ee5\u7b2c\u4e00\u6b65\u662f\u5206\u7c7b\u8ba1\u6570\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u8c03\u53c2\u6570\u3002\u8fde\u63a5\u884c\u4e3a\u8fd8\u548c\u63d2\u4ef6\u3001\u7f13\u5b58\u7b56\u7565\u5bc6\u5207\u76f8\u5173\uff0c\u53ef\u5148\u53c2\u8003\u8fd9\u7bc7 <a href=\"https:\/\/cn.hostease.com\/blog\/wordpress\/\">WordPress \u63d2\u4ef6\u4e0e\u4e3b\u9898\u6559\u7a0b<\/a> \u8865\u9f50\u5e94\u7528\u5c42\u80cc\u666f\u3002<\/p>\n<p>\u5177\u4f53\u600e\u4e48\u533a\u5206\uff1f\u7528\u4e0b\u9762\u8fd9\u6761\u547d\u4ee4\u4e00\u6b21\u62ff\u5230\u4e09\u7c7b\u8fde\u63a5\u7684\u6570\u91cf\uff08\u9700\u8981 root \u6743\u9650\u6267\u884c\uff09\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-linenumbers=\"false\">\nss -ant state established | tail -n +2 | wc -l; ss -ant state time-wait | tail -n +2 | wc -l\n<\/pre>\n<p>\u7b2c\u4e00\u6761\u8f93\u51fa\u662f\u6d3b\u8dc3\u8fde\u63a5\u6570\uff0c\u7b2c\u4e8c\u6761\u662f TIME_WAIT \u6570\u91cf\u3002\u6570\u636e\u5e93\u8fde\u63a5\u8981\u5728 MySQL \u91cc\u6267\u884c <code>SHOW PROCESSLIST;<\/code> \u770b Threads_connected \u7684\u503c\u3002\u6bcf\u9694 10 \u5206\u949f\u91c7\u6837\u4e00\u6b21\uff0c\u8fde\u7eed\u89c2\u5bdf 3 \u6b21\uff0c\u5c31\u80fd\u5224\u65ad\u54ea\u4e00\u7c7b\u5728\u6da8\uff1aTIME_WAIT \u98d9\u5347\u5c5e\u4e8e\u5185\u6838\u56de\u6536\u95ee\u9898\uff0c\u6570\u636e\u5e93\u8fde\u63a5\u903c\u8fd1 <code>max_connections<\/code> \u5c5e\u4e8e\u5e94\u7528\u5c42\u6cc4\u6f0f\uff0cESTABLISHED \u6301\u7eed\u589e\u957f\u5219\u591a\u534a\u662f\u771f\u5b9e\u6d41\u91cf\u6216\u722c\u866b\u3002\u5206\u7c7b\u6e05\u695a\u4e86\uff0c\u6392\u67e5\u624d\u4e0d\u4f1a\u8d70\u5f2f\u8def\u3002<\/p>\n<h2>TIME_WAIT \u5806\u79ef\uff1a\u77ed\u8fde\u63a5\u8fc7\u591a\u65f6\u7684\u6b63\u5e38\u73b0\u8c61\u4e0e\u8c03\u4f18\u8fb9\u754c<\/h2>\n<p>TIME_WAIT \u662f TCP \u534f\u8bae\u7684\u8bbe\u8ba1\u884c\u4e3a\uff1a\u4e3b\u52a8\u5173\u95ed\u8fde\u63a5\u7684\u4e00\u65b9\u8981\u7b49 60 \u79d2\uff08Linux \u9ed8\u8ba4 2\u00d7MSL\uff09\u624d\u5f7b\u5e95\u91ca\u653e\uff0c\u786e\u4fdd\u5bf9\u65b9\u6536\u5230\u6700\u540e\u7684\u786e\u8ba4\u5305\u3002\u722c\u866b\u6293\u53d6\u3001CDN\uff08\u5185\u5bb9\u5206\u53d1\u7f51\u7edc\uff09\u56de\u6e90\u3001\u5065\u5eb7\u68c0\u67e5\u63a2\u9488\u90fd\u5728\u9891\u7e41\u5efa\u7acb\u77ed\u8fde\u63a5\uff0cTIME_WAIT \u51fa\u73b0\u51e0\u767e\u4e2a\u5c5e\u4e8e\u6b63\u5e38\u73b0\u8c61\u3002\u5224\u65ad\u6807\u51c6\u662f\u6570\u91cf\u7ea7\uff1a\u5355\u673a\u8d85\u8fc7 1 \u4e07\u5e76\u6301\u7eed\u589e\u957f\uff0c\u624d\u8bf4\u660e\u77ed\u8fde\u63a5\u9891\u7387\u8d85\u51fa\u5185\u6838\u56de\u6536\u80fd\u529b\uff0c\u9700\u8981\u4ecb\u5165\u3002<\/p>\n<p>\u786e\u8ba4\u5806\u79ef\u540e\uff0c\u5148\u770b\u4e24\u4e2a\u5185\u6838\u53c2\u6570\u7684\u5f53\u524d\u503c\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-linenumbers=\"false\">\nsysctl net.ipv4.tcp_max_tw_buckets net.ipv4.tcp_tw_reuse\n<\/pre>\n<p><code>tcp_max_tw_buckets<\/code> \u662f TIME_WAIT \u603b\u91cf\u4e0a\u9650\uff0c\u9ed8\u8ba4 262144 \u4e00\u822c\u591f\u7528\uff0c\u4f46 1-2GB \u5185\u5b58\u7684\u670d\u52a1\u5668\u88ab\u5360\u6ee1\u540e\u4f1a\u5f3a\u5236\u4e22\u5f03\u5e76\u6253\u5370\u5185\u6838\u65e5\u5fd7\u3002<code>tcp_tw_reuse<\/code> \u8bbe\u4e3a 1 \u540e\uff0c\u5185\u6838\u5141\u8bb8\u590d\u7528\u8d85\u8fc7 1 \u79d2\u7684 TIME_WAIT \u8fde\u63a5\u7aef\u53e3\u7ed9\u65b0\u7684\u51fa\u7ad9\u8fde\u63a5\uff0c\u5bf9 MySQL\u3001cURL \u8fd9\u7c7b\u5ba2\u6237\u7aef\u6548\u679c\u660e\u663e\u3002\u7f16\u8f91 <code>\/etc\/sysctl.conf<\/code> \u52a0\u5165 <code>net.ipv4.tcp_tw_reuse = 1<\/code>\uff0c\u6267\u884c <code>sysctl -p<\/code> \u751f\u6548\u3002<\/p>\n<p>\u4e00\u4e2a\u5e38\u89c1\u8bef\u533a\uff1a<code>tcp_tw_recycle<\/code> \u53c2\u6570\u5728 Linux 4.12 \u4e4b\u540e\u5df2\u79fb\u9664\uff0c\u4efb\u4f55\u6559\u7a0b\u8ba9\u4f60\u5f00\u542f\u5b83\u90fd\u8bf4\u660e\u8d44\u6599\u8fc7\u65f6\u4e86\uff0c\u7167\u505a\u53cd\u800c\u4f1a\u5bfc\u81f4 NAT \u73af\u5883\u4e0b\u7528\u6237\u65e0\u6cd5\u8bbf\u95ee\u3002\u6211\u4eec\u7684\u5efa\u8bae\u662f\u4f18\u5148\u4ece\u5e94\u7528\u5c42\u51cf\u5c11\u77ed\u8fde\u63a5\uff08\u4e0b\u6587\u8bb2\u6301\u4e45\u5316\u8fde\u63a5\u65f6\u5177\u4f53\u8bf4\uff09\uff0c\u5185\u6838\u53c2\u6570\u53ea\u662f\u7f13\u89e3\u624b\u6bb5\u3002\u6d89\u53ca<a href=\"https:\/\/cn.hostease.com\/blog\/server\/\">\u670d\u52a1\u5668\u914d\u7f6e\u4e0e\u6027\u80fd\u4f18\u5316\u7684\u66f4\u591a\u4e3b\u9898<\/a>\uff0c\u53ef\u4ee5\u7ed3\u5408\u8fd9\u7bc7\u5206\u7c7b\u6587\u7ae0\u7ee7\u7eed\u6df1\u5165\u3002<\/p>\n<h2>\u6570\u636e\u5e93\u8fde\u63a5\u8fc7\u591a\uff1aWordPress \u4e0e MySQL \u4e4b\u95f4\u7684\u8fde\u63a5\u6cc4\u6f0f\u6392\u67e5<\/h2>\n<p>TIME_WAIT \u4e4b\u5916\uff0c\u7b2c\u4e8c\u7c7b\u5e38\u89c1\u6839\u56e0\u662f\u6570\u636e\u5e93\u8fde\u63a5\u5806\u79ef\u3002WordPress \u6bcf\u6b21\u9875\u9762\u8bf7\u6c42\u4f1a\u7531 PHP \u5efa\u7acb\u5230 MySQL \u7684\u8fde\u63a5\uff0c\u5982\u679c\u63d2\u4ef6\u6216\u4e3b\u9898\u4ee3\u7801\u91cc\u5b58\u5728\u672a\u5173\u95ed\u7684\u67e5\u8be2\u3001\u6162\u67e5\u8be2\u957f\u65f6\u95f4\u5360\u7528\u8fde\u63a5\uff0c\u6216\u8005 <code>max_connections<\/code> \u914d\u7f6e\u8fc7\u4f4e\uff0c\u5c31\u4f1a\u62a5 <code>Too many connections<\/code> \u9519\u8bef\u3002\u6392\u67e5\u4ece MySQL \u4fa7\u5f00\u59cb\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-linenumbers=\"false\">\nmysql -e \"SHOW GLOBAL STATUS LIKE 'Threads_connected'; SHOW GLOBAL STATUS LIKE 'Max_used_connections'; SHOW VARIABLES LIKE 'max_connections';\"\n<\/pre>\n<p>\u4e09\u4e2a\u503c\u5206\u522b\u662f\u5f53\u524d\u8fde\u63a5\u6570\u3001\u5386\u53f2\u5cf0\u503c\u3001\u914d\u7f6e\u4e0a\u9650\u3002\u5386\u53f2\u5cf0\u503c\u8d34\u7740\u4e0a\u9650\uff0c\u8bf4\u660e\u53d1\u751f\u8fc7\u8fde\u63a5\u8017\u5c3d\uff1b\u5f53\u524d\u8fde\u63a5\u6570\u8fdc\u8d85\u6b63\u5e38\u6c34\u5e73\uff08\u4e2d\u5c0f\u7ad9\u70b9\u5cf0\u503c\u4e00\u822c\u5728 20-50\uff09\uff0c\u5c31\u8981\u627e\u51fa\u662f\u8c01\u5360\u7528\u4e86\u8fde\u63a5\u3002\u6267\u884c <code>SHOW FULL PROCESSLIST;<\/code>\uff0c\u91cd\u70b9\u770b Time \u8d85\u8fc7 60 \u79d2\u7684 Sleep \u8fde\u63a5\u2014\u2014\u5927\u91cf\u957f\u65f6\u95f4\u4f11\u7720\u610f\u5473\u7740 PHP \u5efa\u7acb\u4e86\u8fde\u63a5\u5374\u6ca1\u91ca\u653e\uff0c\u591a\u89c1\u4e8e\u63d2\u4ef6\u81ea\u5df1\u5199\u4e86 <code>mysqli_connect<\/code> \u53c8\u6ca1\u5173\u95ed\uff0c\u6216\u7528\u4e86 <code>p:<\/code> \u524d\u7f00\u7684\u6301\u4e45\u5316\u8fde\u63a5\u4f46\u8fdb\u7a0b\u590d\u7528\u5f02\u5e38\u3002<\/p>\n<p>\u89e3\u51b3\u8def\u5f84\u6709\u4e09\u6761\uff0c\u6309\u4f18\u5148\u7ea7\u6392\u5217\uff1a<\/p>\n<ul>\n<li>\u4f18\u5148\u590d\u7528\u8fde\u63a5\uff1a\u786e\u8ba4\u4f7f\u7528 <code>mysqli<\/code>\uff0c\u8ba9\u540c\u4e00 PHP \u8fdb\u7a0b\u590d\u7528\u8fde\u63a5\uff0c\u77ed\u8fde\u63a5\u521b\u5efa\u91cf\u53ef\u4e0b\u964d 60% \u4ee5\u4e0a<\/li>\n<li>\u6536\u7d27\u7b49\u5f85\u8d85\u65f6\uff1a\u628a <code>wait_timeout<\/code> \u4ece\u9ed8\u8ba4 28800 \u79d2\u964d\u5230 300-600 \u79d2\uff0cSQL \u4e3a <code>SET GLOBAL wait_timeout = 600;<\/code>\uff08\u5199\u5165 my.cnf \u624d\u80fd\u91cd\u542f\u540e\u751f\u6548\uff09<\/li>\n<li>\u5b9a\u4f4d\u6cc4\u6f0f\u6e90\uff1a\u5148\u5728\u6d4b\u8bd5\u73af\u5883\u590d\u73b0\uff0c\u7528 <code>SHOW PROCESSLIST<\/code> \u5bf9\u6bd4\u542f\u7528\u63d2\u4ef6\u524d\u540e\u7684\u8fde\u63a5\u6570\u5dee\u503c\uff0c\u9501\u5b9a\u540e\u5bfb\u627e\u66ff\u4ee3\u54c1<\/li>\n<\/ul>\n<p>\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f Hostease \u7684 WordPress \u4e3b\u673a\uff0c\u6570\u636e\u5e93\u53c2\u6570\u8c03\u6574\u53ef\u4ee5\u76f4\u63a5\u5728\u63a7\u5236\u9762\u677f\u7684 phpMyAdmin \u548c\u4e3b\u673a\u914d\u7f6e\u91cc\u5b8c\u6210\uff0c\u4e0d\u9700\u8981\u767b\u5f55\u670d\u52a1\u5668\u6539\u914d\u7f6e\u6587\u4ef6\uff1b\u5982\u679c\u662f VPS \u6216\u72ec\u7acb\u670d\u52a1\u5668\u73af\u5883\uff0c\u6539\u5b8c my.cnf \u540e\u8bb0\u5f97 <code>systemctl restart mysqld<\/code> \u8ba9\u53c2\u6570\u6301\u4e45\u5316\u3002\u6570\u636e\u5e93\u8fde\u63a5\u538b\u529b\u548c\u9875\u9762\u52a0\u8f7d\u901f\u5ea6\u76f4\u63a5\u76f8\u5173\uff0c<a href=\"https:\/\/cn.hostease.com\/blog\/guides\/ttfb-hosting-optimization\/\">TTFB \u4e0e\u4e3b\u673a\u6027\u80fd\u4f18\u5316\u6307\u5357<\/a>\u91cc\u6709\u914d\u5957\u5206\u6790\u65b9\u6cd5\uff0c\u53ef\u4e0e\u672c\u6587\u7684\u8fde\u63a5\u6392\u67e5\u914d\u5408\u4f7f\u7528\u3002<\/p>\n<h2>\u670d\u52a1\u5668\u5185\u6838\u53c2\u6570\uff1a\u7ed9\u8fde\u63a5\u56de\u6536\u548c\u7aef\u53e3\u8d44\u6e90\u7559\u51fa\u4f59\u91cf<\/h2>\n<p>\u6570\u636e\u5e93\u548c TIME_WAIT \u90fd\u67e5\u8fc7\u4e4b\u540e\uff0c\u5982\u679c\u8fde\u63a5\u6570\u4f9d\u7136\u5468\u671f\u6027\u51b2\u9ad8\uff0c\u5c31\u8981\u68c0\u67e5\u5185\u6838\u7f51\u7edc\u53c2\u6570\u662f\u5426\u7559\u8db3\u4f59\u91cf\u3002\u91cd\u70b9\u662f\u786e\u8ba4\u4e09\u4e2a\u5173\u952e\u503c\uff1a\u53ef\u7528\u7aef\u53e3\u8303\u56f4\u3001\u8fde\u63a5\u8ddf\u8e2a\u8868\u5bb9\u91cf\u548c\u76d1\u542c\u961f\u5217\u957f\u5ea6\u3002\u4efb\u4f55\u4e00\u9879\u89e6\u9876\uff0c\u8868\u73b0\u90fd\u662f\u65b0\u8fde\u63a5\u5efa\u7acb\u5931\u8d25\u3001\u7528\u6237\u4fa7\u770b\u5230\u8fde\u63a5\u8d85\u65f6\u3002<\/p>\n<p>\u5148\u7528\u4e00\u6761\u547d\u4ee4\u786e\u8ba4\u5f53\u524d\u72b6\u6001\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-linenumbers=\"false\">\nsysctl net.ipv4.ip_local_port_range nf_conntrack_max somaxconn\n<\/pre>\n<p>\u9010\u9879\u6807\u51c6\uff1a<code>ip_local_port_range<\/code> \u5efa\u8bae\u6269\u5230 <code>10240 65000<\/code>\uff0c\u9ed8\u8ba4 <code>32768 60999<\/code> \u5728\u9ad8\u9891\u51fa\u7ad9\u573a\u666f\u4e0b\u53ef\u7528\u7aef\u53e3\u53ea\u6709\u7ea6 2.8 \u4e07\u4e2a\uff1b<code>nf_conntrack_max<\/code> \u5728\u542f\u7528\u9632\u706b\u5899\u8fde\u63a5\u8ddf\u8e2a\uff08<code>iptables<\/code>\/<code>firewalld<\/code>\uff09\u65f6\uff0c\u8868\u6ee1\u4f1a\u76f4\u63a5\u4e22\u5305\uff0c\u53ef\u7528 <code>dmesg | grep \"nf_conntrack: table full\"<\/code> \u786e\u8ba4\uff1b<code>somaxconn<\/code> \u4e0d\u4f4e\u4e8e 1024\uff0c\u7ed9 Nginx\u3001PHP-FPM \u7684\u5e76\u53d1\u63e1\u624b\u7559\u7f13\u51b2\u3002\u786e\u8ba4\u540e\u628a\u8c03\u6574\u9879\u5199\u5165 <code>\/etc\/sysctl.conf<\/code>\uff0c\u4e00\u6b21 <code>sysctl -p<\/code> \u7edf\u4e00\u751f\u6548\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-linenumbers=\"false\">\ncat >> \/etc\/sysctl.conf <<'EOF'\nnet.ipv4.ip_local_port_range = 10240 65000\nnet.core.somaxconn = 1024\nEOF\nsysctl -p\n<\/pre>\n<p>\u4e00\u4e2a\u5b9e\u9645\u6848\u4f8b\uff1a\u67d0\u5916\u8d38\u7ad9\u70b9\u7684 WordPress \u8dd1\u5728 2 \u6838 4GB <a href=\"https:\/\/cn.hostease.com\/vps\/\">\u4e91\u4e3b\u673a<\/a>\u4e0a\uff0c\u6bcf\u5929\u4e0a\u5348 9-11 \u70b9\u8fde\u63a5\u6570\u4ece 800 \u51b2\u5230 12000\uff0c\u9875\u9762\u62a5 502\u3002\u6392\u67e5\u53d1\u73b0\u662f\u5b9a\u65f6\u722c\u866b\u56fa\u5b9a\u65f6\u6bb5\u5168\u7ad9\u6293\u53d6\uff0cTIME_WAIT \u6bcf\u8f6e\u5806\u79ef 8000+\uff0c\u5f00\u542f <code>tcp_tw_reuse = 1<\/code> \u5e76\u628a\u722c\u866b\u9891\u7387\u534f\u5546\u5230\u6bcf 5 \u5206\u949f\u4e00\u6279\u540e\uff0c\u5cf0\u503c\u56de\u843d\u5230 3000 \u4ee5\u5185\uff0c502 \u4e0d\u518d\u590d\u73b0\u3002\u5185\u6838\u53c2\u6570\u548c\u5e94\u7528\u5c42\u6cbb\u7406\u8981\u914d\u5408\u4f7f\u7528\uff0c\u5355\u9760\u4e00\u4fa7\u53ea\u80fd\u7f13\u89e3\u4e00\u534a\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/11\/wordpress-time-wait-database-server-kernel.webp\" alt=\"\u670d\u52a1\u5668\u5185\u6838\u7f51\u7edc\u53c2\u6570\u8c03\u4f18\u793a\u610f\u56fe\" loading=\"lazy\" \/><\/p>\n<h2>\u4e09\u4e2a\u6570\u5b57\u770b\u61c2\u6392\u67e5\u4f18\u5148\u7ea7\uff1a\u4e00\u5f20\u5bf9\u6bd4\u8868<\/h2>\n<p>\u4e09\u7c7b\u6839\u56e0\u75c7\u72b6\u5bb9\u6613\u6df7\u6dc6\uff0c\u7528\u4e0b\u9762\u7684\u5bf9\u6bd4\u80fd\u5feb\u901f\u9501\u5b9a\u65b9\u5411\uff0c\u5404\u53d6\u4e00\u4e2a\u4ee3\u8868\u6027\u6307\u6807\uff0c\u534a\u5c0f\u65f6\u5185\u5c31\u80fd\u5b8c\u6210\u5206\u6d41\uff1a<\/p>\n<ul>\n<li>TIME_WAIT \u5806\u79ef\uff1a<code>ss -ant state time-wait<\/code> \u8d85 1 \u4e07\u4e14\u722c\u866b\u3001\u63a2\u9488\u65e5\u5fd7\u540c\u6b65\u589e\u591a\u2014\u2014\u5148\u5f00 <code>tcp_tw_reuse<\/code>\uff0c\u518d\u6cbb\u7406\u77ed\u8fde\u63a5\u6765\u6e90<\/li>\n<li>\u6570\u636e\u5e93\u6cc4\u6f0f\uff1a<code>Threads_connected<\/code> \u903c\u8fd1 <code>max_connections<\/code>\uff0cSleep \u8fde\u63a5 Time \u666e\u904d\u8d85 60 \u79d2\u2014\u2014\u5148\u964d <code>wait_timeout<\/code>\uff0c\u518d\u6392\u67e5\u63d2\u4ef6<\/li>\n<li>\u5185\u6838\u961f\u5217\u6253\u6ee1\uff1a\u51b2\u9ad8\u4f34\u968f <code>dmesg<\/code> \u91cc <code>nf_conntrack: table full<\/code> \u6216 <code>possible SYN flooding<\/code>\u2014\u2014\u6269 <code>nf_conntrack_max<\/code> \u548c backlog \u961f\u5217<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/11\/wordpress-time-wait-database-server-comparison.webp\" alt=\"\u8fde\u63a5\u6570\u5f02\u5e38\u4e09\u7c7b\u6839\u56e0\u5bf9\u6bd4\u793a\u610f\" loading=\"lazy\" \/><\/p>\n<p>\u8fd8\u6709\u4e2a\u7ec6\u8282\u662f\u65f6\u6bb5\u76f8\u5173\u6027\uff1a\u8fde\u63a5\u51b2\u9ad8\u603b\u51fa\u73b0\u5728\u56fa\u5b9a\u65f6\u95f4\u70b9\uff08\u6574\u70b9\u3001\u6bcf 5 \u5206\u949f\uff09\uff0c\u5927\u6982\u7387\u662f\u5b9a\u65f6\u4efb\u52a1\u6216\u5916\u90e8\u626b\u63cf\uff1b\u968f\u6d41\u91cf\u81ea\u7136\u6ce2\u52a8\u5219\u66f4\u53ef\u80fd\u662f\u5bb9\u91cf\u95ee\u9898\u3002\u524d\u8005\u6cbb\u7406\u6765\u6e90\uff0c\u540e\u8005\u6269\u5bb9\u8c03\u53c2\uff0c\u65b9\u5411\u5b8c\u5168\u4e0d\u540c\u3002\u628a <code>sar -n SOCK 5 3<\/code> \u7684\u8fde\u63a5\u66f2\u7ebf\u548c\u8bbf\u95ee\u65e5\u5fd7\u653e\u5728\u4e00\u8d77\u770b\uff0c\u7ed3\u8bba\u4f1a\u6e05\u6670\u5f88\u591a\u3002<\/p>\n<h2>\u603b\u7ed3\uff1a\u4e00\u5957\u53ef\u590d\u7528\u7684\u6392\u67e5\u52a8\u4f5c<\/h2>\n<p>\u56de\u987e\u6392\u67e5\u94fe\u8def\uff1a\u5148\u7528 <code>ss<\/code> \u548c <code>SHOW PROCESSLIST<\/code> \u628a\u8fde\u63a5\u6309\u4e09\u7c7b\u5206\u6d41\uff0c\u786e\u5b9a\u54ea\u7c7b\u5931\u63a7\uff1bTIME_WAIT \u8d85 1 \u4e07\u518d\u5f00 <code>tcp_tw_reuse<\/code>\uff0c\u6570\u636e\u5e93\u6cc4\u6f0f\u5148\u964d <code>wait_timeout<\/code> \u518d\u67e5\u63d2\u4ef6\uff1b\u5185\u6838\u53c2\u6570\u4f5c\u4e3a\u515c\u5e95\u7559\u8db3\u4f59\u91cf\u3002\u4e09\u4e2a\u52a8\u4f5c\u8986\u76d6\u7edd\u5927\u591a\u6570\u8fde\u63a5\u6570\u5f02\u5e38\u573a\u666f\uff0c\u5efa\u8bae\u4f60\u73b0\u5728\u5c31\u628a\u5206\u7c7b\u8ba1\u6570\u547d\u4ee4\u8dd1\u4e00\u904d\uff0c\u7559\u4e0b\u57fa\u7ebf\u6570\u636e\u3002<\/p>\n<p>\u603b\u7ed3\u51e0\u6761\u884c\u52a8\u5efa\u8bae\uff1a\u628a\u8ba1\u6570\u547d\u4ee4\u5199\u8fdb\u5b9a\u65f6\u811a\u672c\uff0c\u6bcf\u5929\u91c7\u6837\u5e76\u4fdd\u7559 30 \u5929\u8bb0\u5f55\uff0c\u5f02\u5e38\u8d8b\u52bf\u63d0\u524d\u4e00\u5468\u5c31\u80fd\u770b\u51fa\u6765\uff1b\u8c03\u53c2\u524d\u8bb0\u5f55\u65e7\u503c\uff0c\u89c2\u5bdf 24 \u5c0f\u65f6\u518d\u51b3\u5b9a\u4fdd\u7559\uff1b\u5982\u679c\u4f60\u9700\u8981\u66f4\u7701\u5fc3\u7684\u6258\u7ba1\u73af\u5883\uff0c\u53ef\u4ee5\u8003\u8651<a href=\"https:\/\/cn.hostease.com\/shared-hosting.html\">Hostease \u7684 WordPress \u4e3b\u673a<\/a>\uff0c\u5185\u6838\u53c2\u6570\u7531\u8fd0\u7ef4\u56e2\u961f\u7ef4\u62a4\uff0c\u4f60\u53ea\u9700\u4e13\u6ce8\u63d2\u4ef6\u6cbb\u7406\u548c\u5185\u5bb9\u8fd0\u8425\u3002\u5de5\u5177\u5df2\u7ecf\u7ed9\u4f60\u4e86\uff0c\u5269\u4e0b\u7684\u5c31\u662f\u8dd1\u8d77\u6765\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress \u8fde\u63a5\u6570\u5f02\u5e38\u5347\u9ad8\u600e\u4e48\u529e\uff1f\u672c\u6587\u6559\u4f60\u7528 netstat\u3001ss \u548c MySQL \u72b6\u6001\u547d\u4ee4\u5b9a\u4f4d TIME_WAIT \u5806\u79ef\u3001\u6570\u636e\u5e93\u8fde\u63a5\u6cc4\u6f0f\uff0c\u5e76\u8c03\u6574\u670d\u52a1\u5668\u5185\u6838\u53c2\u6570\u6062\u590d\u7a33\u5b9a\u3002<\/p>\n","protected":false},"author":2,"featured_media":34785,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4099],"tags":[5638,84,5639,4612,5306],"class_list":["post-34788","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-timewait","tag-wordpress","tag-5639","tag-4612","tag-5306"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/11\/wordpress-time-wait-database-server-cover.webp","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/posts\/34788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/comments?post=34788"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/posts\/34788\/revisions"}],"predecessor-version":[{"id":34794,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/posts\/34788\/revisions\/34794"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/media\/34785"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/media?parent=34788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/categories?post=34788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/tags?post=34788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}