<br />
<b>Warning</b>:  Use of undefined constant WP_ALLOW_REPAIR - assumed 'WP_ALLOW_REPAIR' (this will throw an Error in a future version of PHP) in <b>/var/www/wordpress/wp-config.php</b> on line <b>17</b><br />
{"id":731,"date":"2016-12-03T02:07:28","date_gmt":"2016-12-03T02:07:28","guid":{"rendered":"https:\/\/peloo.net\/?p=731"},"modified":"2016-12-03T02:07:28","modified_gmt":"2016-12-03T02:07:28","slug":"nginx%e9%85%8d%e7%bd%ae%e9%ab%98%e5%b9%b6%e5%8f%91%ef%bc%88%e8%bd%ac%ef%bc%89","status":"publish","type":"post","link":"https:\/\/peloo.net\/?p=731","title":{"rendered":"NGINX\u914d\u7f6e\u9ad8\u5e76\u53d1\uff08\u8f6c\uff09"},"content":{"rendered":"<p>\n\t<strong>\u4e00\u3001\u4e00\u822c\u6765\u8bf4nginx \u914d\u7f6e\u6587\u4ef6\u4e2d\u5bf9\u4f18\u5316\u6bd4\u8f83\u6709\u4f5c\u7528\u7684\u4e3a\u4ee5\u4e0b\u51e0\u9879\uff1a<\/strong>\n<\/p>\n<p>\n\t<strong>1. &nbsp;worker_processes 8;<\/strong>\n<\/p>\n<p>\n\tnginx \u8fdb\u7a0b\u6570\uff0c\u5efa\u8bae\u6309\u7167cpu \u6570\u76ee\u6765\u6307\u5b9a\uff0c\u4e00\u822c\u4e3a\u5b83\u7684\u500d\u6570 (\u5982,2\u4e2a\u56db\u6838\u7684cpu\u8ba1\u4e3a8)\u3002\n<\/p>\n<p>\n\t<strong>2. &nbsp;worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;<\/strong>\n<\/p>\n<p>\n\t\u4e3a\u6bcf\u4e2a\u8fdb\u7a0b\u5206\u914dcpu\uff0c\u4e0a\u4f8b\u4e2d\u5c068 \u4e2a\u8fdb\u7a0b\u5206\u914d\u52308 \u4e2acpu\uff0c\u5f53\u7136\u53ef\u4ee5\u5199\u591a\u4e2a\uff0c\u6216\u8005\u5c06\u4e00<br \/>\n\t\u4e2a\u8fdb\u7a0b\u5206\u914d\u5230\u591a\u4e2acpu\u3002\n<\/p>\n<p>\n\t<strong>3.&nbsp;&nbsp;worker_rlimit_nofile 65535;<\/strong>\n<\/p>\n<p>\n\t\u8fd9\u4e2a\u6307\u4ee4\u662f\u6307\u5f53\u4e00\u4e2anginx \u8fdb\u7a0b\u6253\u5f00\u7684\u6700\u591a\u6587\u4ef6\u63cf\u8ff0\u7b26\u6570\u76ee\uff0c\u7406\u8bba\u503c\u5e94\u8be5\u662f\u6700\u591a\u6253\u5f00\u6587<br \/>\n\t\u4ef6\u6570\uff08ulimit -n\uff09\u4e0enginx \u8fdb\u7a0b\u6570\u76f8\u9664\uff0c\u4f46\u662fnginx \u5206\u914d\u8bf7\u6c42\u5e76\u4e0d\u662f\u90a3\u4e48\u5747\u5300\uff0c\u6240\u4ee5\u6700\u597d\u4e0eulimit -n \u7684\u503c\u4fdd\u6301\u4e00\u81f4\u3002\n<\/p>\n<p>\n\t\u73b0\u5728\u5728<a class=\"replace_word\" href=\"http:\/\/lib.csdn.net\/base\/linux\" target=\"_blank\" title=\"Linux\u77e5\u8bc6\u5e93\">Linux<\/a><span>&nbsp;<\/span>2.6\u5185\u6838\u4e0b\u5f00\u542f\u6587\u4ef6\u6253\u5f00\u6570\u4e3a65535\uff0cworker_rlimit_nofile\u5c31\u76f8\u5e94\u5e94\u8be5\u586b\u519965535\u3002<\/p>\n<p>\t\u8fd9\u662f\u56e0\u4e3anginx\u8c03\u5ea6\u65f6\u5206\u914d\u8bf7\u6c42\u5230\u8fdb\u7a0b\u5e76\u4e0d\u662f\u90a3\u4e48\u7684\u5747\u8861\uff0c\u6240\u4ee5\u5047\u5982\u586b\u519910240\uff0c\u603b\u5e76\u53d1\u91cf\u8fbe\u52303-4\u4e07\u65f6\u5c31\u6709\u8fdb\u7a0b\u53ef\u80fd\u8d85\u8fc710240\u4e86\uff0c\u8fd9\u65f6\u4f1a\u8fd4\u56de502\u9519\u8bef\u3002\n<\/p>\n<p>\n\t\u67e5\u770blinux\u7cfb\u7edf\u6587\u4ef6\u63cf\u8ff0\u7b26\u7684\u65b9\u6cd5\uff1a\n<\/p>\n<p>\n\t[root@web001 ~]# sysctl -a | grep fs.file\n<\/p>\n<p>\n\tfs.file-max = 789972\n<\/p>\n<p>\n\tfs.file-nr = 510 0 789972\n<\/p>\n<p>\n\t<span>4.&nbsp;&nbsp;use epoll;<\/span>\n<\/p>\n<p>\n\t\u4f7f\u7528epoll \u7684I\/O \u6a21\u578b\n<\/p>\n<p>\n\t(\n<\/p>\n<p>\n\t\u8865\u5145\u8bf4\u660e:\n<\/p>\n<p>\n\t\u4e0eapache\u76f8\u7c7b\uff0cnginx\u9488\u5bf9\u4e0d\u540c\u7684<a class=\"replace_word\" href=\"http:\/\/lib.csdn.net\/base\/operatingsystem\" target=\"_blank\" title=\"\u64cd\u4f5c\u7cfb\u7edf\u77e5\u8bc6\u5e93\">\u64cd\u4f5c\u7cfb\u7edf<\/a>\uff0c\u6709\u4e0d\u540c\u7684\u4e8b\u4ef6\u6a21\u578b\n<\/p>\n<p>\n\t&nbsp; &nbsp;&nbsp; &nbsp;A\uff09\u6807\u51c6\u4e8b\u4ef6\u6a21\u578b<br \/>\n\t&nbsp; &nbsp;&nbsp; &nbsp; Select\u3001poll\u5c5e\u4e8e\u6807\u51c6\u4e8b\u4ef6\u6a21\u578b\uff0c\u5982\u679c\u5f53\u524d\u7cfb\u7edf\u4e0d\u5b58\u5728\u66f4\u6709\u6548\u7684\u65b9\u6cd5\uff0cnginx\u4f1a\u9009\u62e9select\u6216poll<br \/>\n\t&nbsp; &nbsp;&nbsp; &nbsp;B\uff09\u9ad8\u6548\u4e8b\u4ef6\u6a21\u578b&nbsp; &nbsp;<br \/>\n\t<strong>Kqueue\uff1a<\/strong>\u4f7f\u7528\u4e8e FreeBSD 4.1+, OpenBSD 2.9+, NetBSD 2.0 \u548c MacOS X. \u4f7f\u7528\u53cc\u5904\u7406\u5668\u7684MacOS X\u7cfb\u7edf\u4f7f\u7528kqueue\u53ef\u80fd\u4f1a\u9020\u6210\u5185\u6838\u5d29\u6e83\u3002<br \/>\n\t<strong>Epoll:<\/strong>&nbsp;\u4f7f\u7528\u4e8eLinux\u5185\u68382.6\u7248\u672c\u53ca\u4ee5\u540e\u7684\u7cfb\u7edf\u3002<br \/>\n\t&nbsp;\n<\/p>\n<p>\n\t<span>\/dev\/poll\uff1a\u4f7f\u7528\u4e8e Solaris 7 11\/99+, HP\/UX 11.22+ (eventport), IRIX 6.5.15+ \u548c Tru64 UNIX 5.1A+\u3002<\/span>\n<\/p>\n<p>\n\t&nbsp; &nbsp; &nbsp; &nbsp; Eventport\uff1a\u4f7f\u7528\u4e8e Solaris 10. \u4e3a\u4e86\u9632\u6b62\u51fa\u73b0\u5185\u6838\u5d29\u6e83\u7684\u95ee\u9898\uff0c \u6709\u5fc5\u8981\u5b89\u88c5\u5b89\u5168\u8865\u4e01\u3002\n<\/p>\n<p>\n\t)\n<\/p>\n<p>\n\t<strong>5.&nbsp;&nbsp;worker_connections 65535;<\/strong>\n<\/p>\n<p>\n\t\u6bcf\u4e2a\u8fdb\u7a0b\u5141\u8bb8\u7684\u6700\u591a\u8fde\u63a5\u6570\uff0c \u7406\u8bba\u4e0a\u6bcf\u53f0nginx \u670d\u52a1\u5668\u7684\u6700\u5927\u8fde\u63a5\u6570\u4e3aworker_processes*worker_connections\u3002\n<\/p>\n<p>\n\t<strong>6.&nbsp;&nbsp;keepalive_timeout 60;<\/strong>\n<\/p>\n<p>\n\tkeepalive \u8d85\u65f6\u65f6\u95f4\u3002\n<\/p>\n<p>\n\t<strong>7.&nbsp;&nbsp;client_header_buffer_size 4k;<\/strong>\n<\/p>\n<p>\n\t\u5ba2\u6237\u7aef\u8bf7\u6c42\u5934\u90e8\u7684\u7f13\u51b2\u533a\u5927\u5c0f\uff0c\u8fd9\u4e2a\u53ef\u4ee5\u6839\u636e\u4f60\u7684\u7cfb\u7edf\u5206\u9875\u5927\u5c0f\u6765\u8bbe\u7f6e\uff0c\u4e00\u822c\u4e00\u4e2a\u8bf7\u6c42\u5934\u7684\u5927\u5c0f\u4e0d\u4f1a\u8d85\u8fc71k\uff0c\u4e0d\u8fc7\u7531\u4e8e\u4e00\u822c\u7cfb\u7edf\u5206\u9875\u90fd\u8981\u5927\u4e8e1k\uff0c\u6240\u4ee5\u8fd9\u91cc\u8bbe\u7f6e\u4e3a\u5206\u9875\u5927\u5c0f\u3002&nbsp;\n<\/p>\n<p>\n\t\u5206\u9875\u5927\u5c0f\u53ef\u4ee5\u7528\u547d\u4ee4<strong>getconf PAGESIZE<\/strong>&nbsp;\u53d6\u5f97\u3002\n<\/p>\n<p>\n\t[root@web001 ~]# getconf PAGESIZE&nbsp;\n<\/p>\n<p>\n\t4096\n<\/p>\n<p>\n\t\u4f46\u4e5f\u6709client_header_buffer_size\u8d85\u8fc74k\u7684\u60c5\u51b5\uff0c\u4f46\u662fclient_header_buffer_size\u8be5\u503c\u5fc5\u987b\u8bbe\u7f6e\u4e3a<strong>&ldquo;\u7cfb\u7edf\u5206\u9875\u5927\u5c0f&rdquo;\u7684\u6574\u500d\u6570\u3002<\/strong>\n<\/p>\n<p>\n\t<strong>8.&nbsp;&nbsp;open_file_cache max=65535 inactive=60s;<\/strong>\n<\/p>\n<p>\n\t\u8fd9\u4e2a\u5c06\u4e3a\u6253\u5f00\u6587\u4ef6\u6307\u5b9a\u7f13\u5b58\uff0c\u9ed8\u8ba4\u662f\u6ca1\u6709\u542f\u7528\u7684\uff0cmax \u6307\u5b9a\u7f13\u5b58\u6570\u91cf\uff0c\u5efa\u8bae\u548c\u6253\u5f00\u6587\u4ef6\u6570\u4e00\u81f4\uff0cinactive \u662f\u6307\u7ecf\u8fc7\u591a\u957f\u65f6\u95f4\u6587\u4ef6\u6ca1\u88ab\u8bf7\u6c42\u540e\u5220\u9664\u7f13\u5b58\u3002\n<\/p>\n<p>\n\t<strong>9.&nbsp;&nbsp;open_file_cache_valid 80s;<\/strong>\n<\/p>\n<p>\n\t\u8fd9\u4e2a\u662f\u6307\u591a\u957f\u65f6\u95f4\u68c0\u67e5\u4e00\u6b21\u7f13\u5b58\u7684\u6709\u6548\u4fe1\u606f\u3002\n<\/p>\n<p>\n\t<strong>10.&nbsp;&nbsp;open_file_cache_min_uses 1;<\/strong>\n<\/p>\n<p>\n\topen_file_cache \u6307\u4ee4\u4e2d\u7684inactive \u53c2\u6570\u65f6\u95f4\u5185\u6587\u4ef6\u7684\u6700\u5c11\u4f7f\u7528\u6b21\u6570\uff0c\u5982\u679c\u8d85\u8fc7\u8fd9\u4e2a\u6570\u5b57\uff0c\u6587\u4ef6\u63cf\u8ff0\u7b26\u4e00\u76f4\u662f\u5728\u7f13\u5b58\u4e2d\u6253\u5f00\u7684\uff0c\u5982\u4e0a\u4f8b\uff0c\u5982\u679c\u6709\u4e00\u4e2a\u6587\u4ef6\u5728inactive \u65f6\u95f4\u5185\u4e00\u6b21\u6ca1\u88ab\u4f7f\u7528\uff0c\u5b83\u5c06\u88ab\u79fb\u9664\u3002\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t<strong>\u4e8c\u3001\u5173\u4e8e\u5185\u6838\u53c2\u6570\u7684\u4f18\u5316\uff1a<\/strong>\n<\/p>\n<p>\n\t<strong>net.ipv4.tcp_max_tw_buckets = 6000<\/strong>\n<\/p>\n<p>\n\ttimewait \u7684\u6570\u91cf\uff0c\u9ed8\u8ba4\u662f180000\u3002\n<\/p>\n<p>\n\t<strong>net.ipv4.ip_local_port_range = 1024 65000<\/strong>\n<\/p>\n<p>\n\t\u5141\u8bb8\u7cfb\u7edf\u6253\u5f00\u7684\u7aef\u53e3\u8303\u56f4\u3002\n<\/p>\n<p>\n\t<strong>net.ipv4.tcp_tw_recycle = 1<\/strong>\n<\/p>\n<p>\n\t\u542f\u7528timewait \u5feb\u901f\u56de\u6536\u3002\n<\/p>\n<p>\n\t<strong>net.ipv4.tcp_tw_reuse = 1<\/strong>\n<\/p>\n<p>\n\t\u5f00\u542f\u91cd\u7528\u3002\u5141\u8bb8\u5c06TIME-WAIT sockets \u91cd\u65b0\u7528\u4e8e\u65b0\u7684TCP \u8fde\u63a5\u3002\n<\/p>\n<p>\n\t<strong>net.ipv4.tcp_syncookies = 1<\/strong>\n<\/p>\n<p>\n\t\u5f00\u542fSYN Cookies\uff0c\u5f53\u51fa\u73b0SYN \u7b49\u5f85\u961f\u5217\u6ea2\u51fa\u65f6\uff0c\u542f\u7528cookies \u6765\u5904\u7406\u3002\n<\/p>\n<p>\n\t<strong>net.core.somaxconn = 262144<\/strong>\n<\/p>\n<p>\n\tweb \u5e94\u7528\u4e2dlisten \u51fd\u6570\u7684backlog \u9ed8\u8ba4\u4f1a\u7ed9\u6211\u4eec\u5185\u6838\u53c2\u6570\u7684net.core.somaxconn \u9650\u5236\u5230128\uff0c\u800cnginx \u5b9a\u4e49\u7684NGX_LISTEN_BACKLOG \u9ed8\u8ba4\u4e3a511\uff0c\u6240\u4ee5\u6709\u5fc5\u8981\u8c03\u6574\u8fd9\u4e2a\u503c\u3002\n<\/p>\n<p>\n\t<strong>net.core.netdev_max_backlog = 262144<\/strong>\n<\/p>\n<p>\n\t\u6bcf\u4e2a\u7f51\u7edc\u63a5\u53e3\u63a5\u6536\u6570\u636e\u5305\u7684\u901f\u7387\u6bd4\u5185\u6838\u5904\u7406\u8fd9\u4e9b\u5305\u7684\u901f\u7387\u5feb\u65f6\uff0c\u5141\u8bb8\u9001\u5230\u961f\u5217\u7684\u6570\u636e\u5305\u7684\u6700\u5927\u6570\u76ee\u3002\n<\/p>\n<p>\n\t<strong>net.ipv4.tcp_max_orphans = 262144<\/strong>\n<\/p>\n<p>\n\t\u7cfb\u7edf\u4e2d\u6700\u591a\u6709\u591a\u5c11\u4e2aTCP \u5957\u63a5\u5b57\u4e0d\u88ab\u5173\u8054\u5230\u4efb\u4f55\u4e00\u4e2a\u7528\u6237\u6587\u4ef6\u53e5\u67c4\u4e0a\u3002\u5982\u679c\u8d85\u8fc7\u8fd9\u4e2a\u6570\u5b57\uff0c\u5b64\u513f\u8fde\u63a5\u5c06\u5373\u523b\u88ab\u590d\u4f4d\u5e76\u6253\u5370\u51fa\u8b66\u544a\u4fe1\u606f\u3002\u8fd9\u4e2a\u9650\u5236\u4ec5\u4ec5\u662f\u4e3a\u4e86\u9632\u6b62\u7b80\u5355\u7684DoS \u653b\u51fb\uff0c\u4e0d\u80fd\u8fc7\u5206\u4f9d\u9760\u5b83\u6216\u8005\u4eba\u4e3a\u5730\u51cf\u5c0f\u8fd9\u4e2a\u503c\uff0c\u66f4\u5e94\u8be5\u589e\u52a0\u8fd9\u4e2a\u503c(\u5982\u679c\u589e\u52a0\u4e86\u5185\u5b58\u4e4b\u540e)\u3002\n<\/p>\n<p>\n\t<strong>net.ipv4.tcp_max_syn_backlog = 262144<\/strong>\n<\/p>\n<p>\n\t\u8bb0\u5f55\u7684\u90a3\u4e9b\u5c1a\u672a\u6536\u5230\u5ba2\u6237\u7aef\u786e\u8ba4\u4fe1\u606f\u7684\u8fde\u63a5\u8bf7\u6c42\u7684\u6700\u5927\u503c\u3002\u5bf9\u4e8e\u6709128M \u5185\u5b58\u7684\u7cfb\u7edf\u800c\u8a00\uff0c\u7f3a\u7701\u503c\u662f1024\uff0c\u5c0f\u5185\u5b58\u7684\u7cfb\u7edf\u5219\u662f128\u3002\n<\/p>\n<p>\n\t<strong>net.ipv4.tcp_timestamps = 0<\/strong>\n<\/p>\n<p>\n\t\u65f6\u95f4\u6233\u53ef\u4ee5\u907f\u514d\u5e8f\u5217\u53f7\u7684\u5377\u7ed5\u3002\u4e00\u4e2a1Gbps \u7684\u94fe\u8def\u80af\u5b9a\u4f1a\u9047\u5230\u4ee5\u524d\u7528\u8fc7\u7684\u5e8f\u5217\u53f7\u3002\u65f6\u95f4\u6233\u80fd\u591f\u8ba9\u5185\u6838\u63a5\u53d7\u8fd9\u79cd&ldquo;\u5f02\u5e38&rdquo;\u7684\u6570\u636e\u5305\u3002\u8fd9\u91cc\u9700\u8981\u5c06\u5176\u5173\u6389\u3002\n<\/p>\n<p>\n\t<strong>net.ipv4.tcp_synack_retries = 1<\/strong>\n<\/p>\n<p>\n\t\u4e3a\u4e86\u6253\u5f00\u5bf9\u7aef\u7684\u8fde\u63a5\uff0c\u5185\u6838\u9700\u8981\u53d1\u9001\u4e00\u4e2aSYN \u5e76\u9644\u5e26\u4e00\u4e2a\u56de\u5e94\u524d\u9762\u4e00\u4e2aSYN \u7684ACK\u3002\u4e5f\u5c31\u662f\u6240\u8c13\u4e09\u6b21\u63e1\u624b\u4e2d\u7684\u7b2c\u4e8c\u6b21\u63e1\u624b\u3002\u8fd9\u4e2a\u8bbe\u7f6e\u51b3\u5b9a\u4e86\u5185\u6838\u653e\u5f03\u8fde\u63a5\u4e4b\u524d\u53d1\u9001SYN+ACK \u5305\u7684\u6570\u91cf\u3002\n<\/p>\n<p>\n\t<strong>net.ipv4.tcp_syn_retries = 1<\/strong>\n<\/p>\n<p>\n\t\u5728\u5185\u6838\u653e\u5f03\u5efa\u7acb\u8fde\u63a5\u4e4b\u524d\u53d1\u9001SYN \u5305\u7684\u6570\u91cf\u3002\n<\/p>\n<p>\n\t<strong>net.ipv4.tcp_fin_timeout = 1<\/strong>\n<\/p>\n<p>\n\t\u5982\u679c\u5957\u63a5\u5b57\u7531\u672c\u7aef\u8981\u6c42\u5173\u95ed\uff0c\u8fd9\u4e2a\u53c2\u6570\u51b3\u5b9a\u4e86\u5b83\u4fdd\u6301\u5728FIN-WAIT-2 \u72b6\u6001\u7684\u65f6\u95f4\u3002\u5bf9\u7aef\u53ef\u4ee5\u51fa\u9519\u5e76\u6c38\u8fdc\u4e0d\u5173\u95ed\u8fde\u63a5\uff0c\u751a\u81f3\u610f\u5916\u5f53\u673a\u3002\u7f3a\u7701\u503c\u662f60 \u79d2\u30022.2 \u5185\u6838\u7684\u901a\u5e38\u503c\u662f180 \u79d2\uff0c3\u4f60\u53ef\u4ee5\u6309\u8fd9\u4e2a\u8bbe\u7f6e\uff0c\u4f46\u8981\u8bb0\u4f4f\u7684\u662f\uff0c\u5373\u4f7f\u4f60\u7684\u673a\u5668\u662f\u4e00\u4e2a\u8f7b\u8f7d\u7684WEB \u670d\u52a1\u5668\uff0c\u4e5f\u6709\u56e0\u4e3a\u5927\u91cf\u7684\u6b7b\u5957\u63a5\u5b57\u800c\u5185\u5b58\u6ea2\u51fa\u7684\u98ce\u9669\uff0cFIN- WAIT-2 \u7684\u5371\u9669\u6027\u6bd4FIN-WAIT-1 \u8981\u5c0f\uff0c\u56e0\u4e3a\u5b83\u6700\u591a\u53ea\u80fd\u5403\u63891.5K \u5185\u5b58\uff0c\u4f46\u662f\u5b83\u4eec\u7684\u751f\u5b58\u671f\u957f\u4e9b\u3002\n<\/p>\n<p>\n\t<strong>net.ipv4.tcp_keepalive_time = 30<\/strong>\n<\/p>\n<p>\n\t\u5f53keepalive \u8d77\u7528\u7684\u65f6\u5019\uff0cTCP \u53d1\u9001keepalive \u6d88\u606f\u7684\u9891\u5ea6\u3002\u7f3a\u7701\u662f2 \u5c0f\u65f6\u3002\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t<strong>\u4e09\u3001\u4e0b\u9762\u8d34\u4e00\u4e2a\u5b8c\u6574\u7684\u5185\u6838\u4f18\u5316\u8bbe\u7f6e:<\/strong>\n<\/p>\n<p>\n\t<strong>vi \/etc\/sysctl.conf<\/strong>&nbsp; CentOS5.5\u4e2d\u53ef\u4ee5\u5c06\u6240\u6709\u5185\u5bb9\u6e05\u7a7a\u76f4\u63a5\u66ff\u6362\u4e3a\u5982\u4e0b\u5185\u5bb9:\n<\/p>\n<p>\n\tnet.ipv4.ip_forward = 0<br \/>\n\tnet.ipv4.conf.default.rp_filter = 1<br \/>\n\tnet.ipv4.conf.default.accept_source_route = 0<br \/>\n\tkernel.sysrq = 0<br \/>\n\tkernel.core_uses_pid = 1<br \/>\n\tnet.ipv4.tcp_syncookies = 1<br \/>\n\tkernel.msgmnb = 65536<br \/>\n\tkernel.msgmax = 65536<br \/>\n\tkernel.shmmax = 68719476736<br \/>\n\tkernel.shmall = 4294967296<br \/>\n\tnet.ipv4.tcp_max_tw_buckets = 6000<br \/>\n\tnet.ipv4.tcp_sack = 1<br \/>\n\tnet.ipv4.tcp_window_scaling = 1<br \/>\n\tnet.ipv4.tcp_rmem = 4096 87380 4194304<br \/>\n\tnet.ipv4.tcp_wmem = 4096 16384 4194304<br \/>\n\tnet.core.wmem_default = 8388608<br \/>\n\tnet.core.rmem_default = 8388608<br \/>\n\tnet.core.rmem_max = 16777216<br \/>\n\tnet.core.wmem_max = 16777216<br \/>\n\tnet.core.netdev_max_backlog = 262144<br \/>\n\tnet.core.somaxconn = 262144<br \/>\n\tnet.ipv4.tcp_max_orphans = 3276800<br \/>\n\tnet.ipv4.tcp_max_syn_backlog = 262144<br \/>\n\tnet.ipv4.tcp_timestamps = 0<br \/>\n\tnet.ipv4.tcp_synack_retries = 1<br \/>\n\tnet.ipv4.tcp_syn_retries = 1<br \/>\n\tnet.ipv4.tcp_tw_recycle = 1<br \/>\n\tnet.ipv4.tcp_tw_reuse = 1<br \/>\n\tnet.ipv4.tcp_mem = 94500000 915000000 927000000<br \/>\n\tnet.ipv4.tcp_fin_timeout = 1<br \/>\n\tnet.ipv4.tcp_keepalive_time = 30<br \/>\n\tnet.ipv4.ip_local_port_range = 1024 65000\n<\/p>\n<p>\n\t\u4f7f\u914d\u7f6e\u7acb\u5373\u751f\u6548\u53ef\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a<br \/>\n\t<strong>\/sbin\/sysctl -p<\/strong>\n<\/p>\n<p>\n\t<strong>\u56db\u3001\u4e0b\u9762\u662f\u5173\u4e8e\u7cfb\u7edf\u8fde\u63a5\u6570\u7684\u4f18\u5316<\/strong>\n<\/p>\n<p>\n\t<strong>linux \u9ed8\u8ba4\u503c open files \u548c max user processes \u4e3a 1024<\/strong>\n<\/p>\n<p>\n\t#ulimit -n\n<\/p>\n<p>\n\t1024\n<\/p>\n<p>\n\t#ulimit &ndash;u\n<\/p>\n<p>\n\t1024\n<\/p>\n<p>\n\t<strong>\u95ee\u9898\u63cf\u8ff0\uff1a<\/strong>&nbsp;\u8bf4\u660e server \u53ea\u5141\u8bb8\u540c\u65f6\u6253\u5f00 1024 \u4e2a\u6587\u4ef6\uff0c\u5904\u7406 1024 \u4e2a\u7528\u6237\u8fdb\u7a0b\n<\/p>\n<p>\n\t\u4f7f\u7528ulimit -a \u53ef\u4ee5\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u7684\u6240\u6709\u9650\u5236\u503c\uff0c\u4f7f\u7528ulimit -n \u53ef\u4ee5\u67e5\u770b\u5f53\u524d\u7684\u6700\u5927\u6253\u5f00\u6587\u4ef6\u6570\u3002\n<\/p>\n<p>\n\t\u65b0\u88c5\u7684linux \u9ed8\u8ba4\u53ea\u67091024 \uff0c\u5f53\u4f5c\u8d1f\u8f7d\u8f83\u5927\u7684\u670d\u52a1\u5668\u65f6\uff0c\u5f88\u5bb9\u6613\u9047\u5230error: too many open files \u3002\u56e0\u6b64\uff0c\u9700\u8981\u5c06\u5176\u6539\u5927\u3002\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t<strong>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong>\n<\/p>\n<p>\n\t\u4f7f\u7528 ulimit &ndash;n 65535 \u53ef\u5373\u65f6\u4fee\u6539\uff0c\u4f46\u91cd\u542f\u540e\u5c31\u65e0\u6548\u4e86\u3002\uff08\u6ce8ulimit -SHn 65535 \u7b49\u6548 ulimit -n 65535 \uff0c-S \u6307soft \uff0c-H \u6307hard)\n<\/p>\n<p>\n\t\u6709\u5982\u4e0b\u4e09\u79cd\u4fee\u6539\u65b9\u5f0f\uff1a\n<\/p>\n<p>\n\t1. \u5728\/etc\/rc.local \u4e2d\u589e\u52a0\u4e00\u884c ulimit -SHn 65535<br \/>\n\t2. \u5728\/etc\/profile \u4e2d\u589e\u52a0\u4e00\u884c ulimit -SHn 65535<br \/>\n\t3.&nbsp;\u5728<strong>\/etc\/security\/limits.conf<\/strong>&nbsp;\u6700\u540e\u589e\u52a0\uff1a\n<\/p>\n<p>\n\t<strong>* soft nofile 65535<br \/>\n\t* hard nofile 65535<br \/>\n\t* soft nproc 65535<br \/>\n\t* hard nproc 65535<\/strong>\n<\/p>\n<p>\n\t\u5177\u4f53\u4f7f\u7528\u54ea\u79cd\uff0c<strong>\u5728 CentOS \u4e2d\u4f7f\u7528\u7b2c1 \u79cd\u65b9\u5f0f\u65e0\u6548\u679c\uff0c\u4f7f\u7528\u7b2c3 \u79cd\u65b9\u5f0f\u6709\u6548\u679c<\/strong>\uff0c\u800c\u5728Debian \u4e2d\u4f7f\u7528\u7b2c2 \u79cd\u6709\u6548\u679c\n<\/p>\n<p>\n\t&nbsp;# ulimit -n\n<\/p>\n<p>\n\t65535\n<\/p>\n<p>\n\t# ulimit -u\n<\/p>\n<p>\n\t65535\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t\u5907\u6ce8\uff1aulimit \u547d\u4ee4\u672c\u8eab\u5c31\u6709\u5206\u8f6f\u786c\u8bbe\u7f6e\uff0c\u52a0-H \u5c31\u662f\u786c\uff0c\u52a0-S \u5c31\u662f\u8f6f\u9ed8\u8ba4\u663e\u793a\u7684\u662f\u8f6f\u9650\u5236\n<\/p>\n<p>\n\tsoft \u9650\u5236\u6307\u7684\u662f\u5f53\u524d\u7cfb\u7edf\u751f\u6548\u7684\u8bbe\u7f6e\u503c\u3002 hard \u9650\u5236\u503c\u53ef\u4ee5\u88ab\u666e\u901a\u7528\u6237\u964d\u4f4e\u3002\u4f46\u662f\u4e0d\u80fd\u589e\u52a0\u3002 soft \u9650\u5236\u4e0d\u80fd\u8bbe\u7f6e\u7684\u6bd4 hard \u9650\u5236\u66f4\u9ad8\u3002 \u53ea\u6709 root \u7528\u6237\u624d\u80fd\u591f\u589e\u52a0 hard \u9650\u5236\u503c\u3002\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t<strong>\u4e94\u3001\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684nginx \u914d\u7f6e\u6587\u4ef6\uff1a<\/strong>\n<\/p>\n<p>\n\tuser www www;<br \/>\n\tworker_processes 8;<br \/>\n\tworker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000<br \/>\n\t01000000;<br \/>\n\terror_log \/www\/log\/nginx_error.log crit;<br \/>\n\tpid \/usr\/local\/nginx\/nginx.pid;<br \/>\n\tworker_rlimit_nofile 204800;<br \/>\n\tevents<br \/>\n\t{<br \/>\n\tuse epoll;<br \/>\n\tworker_connections 204800;<br \/>\n\t}<br \/>\n\thttp<br \/>\n\t{<br \/>\n\tinclude mime.types;<br \/>\n\tdefault_type application\/octet-stream;<br \/>\n\tcharset utf-8;<br \/>\n\tserver_names_hash_bucket_size 128;<br \/>\n\tclient_header_buffer_size 2k;<br \/>\n\tlarge_client_header_buffers 4 4k;<br \/>\n\tclient_max_body_size 8m;<br \/>\n\tsendfile on;<br \/>\n\ttcp_nopush on;<br \/>\n\tkeepalive_timeout 60;<br \/>\n\tfastcgi_cache_path \/usr\/local\/nginx\/fastcgi_cache levels=1:2<br \/>\n\tkeys_zone=TEST:10m<br \/>\n\tinactive=5m;<br \/>\n\tfastcgi_connect_timeout 300;<br \/>\n\tfastcgi_send_timeout 300;<br \/>\n\tfastcgi_read_timeout 300;<br \/>\n\tfastcgi_buffer_size 4k;<br \/>\n\tfastcgi_buffers 8 4k;<br \/>\n\tfastcgi_busy_buffers_size 8k;<br \/>\n\tfastcgi_temp_file_write_size 8k;<br \/>\n\tfastcgi_cache TEST;<br \/>\n\tfastcgi_cache_valid 200 302 1h;<br \/>\n\tfastcgi_cache_valid 301 1d;<br \/>\n\tfastcgi_cache_valid any 1m;<br \/>\n\tfastcgi_cache_min_uses 1;<br \/>\n\tfastcgi_cache_use_stale error timeout invalid_header http_500;<br \/>\n\topen_file_cache max=204800 inactive=20s;<br \/>\n\topen_file_cache_min_uses 1;<br \/>\n\topen_file_cache_valid 30s;<br \/>\n\ttcp_nodelay on;<br \/>\n\tgzip on;<br \/>\n\tgzip_min_length 1k;<br \/>\n\tgzip_buffers 4 16k;<br \/>\n\tgzip_http_version 1.0;<br \/>\n\tgzip_comp_level 2;<br \/>\n\tgzip_types text\/plain application\/x-<a class=\"replace_word\" href=\"http:\/\/lib.csdn.net\/base\/javascript\" target=\"_blank\" title=\"JavaScript\u77e5\u8bc6\u5e93\">JavaScript<\/a><span>&nbsp;<\/span>text\/css application\/xml;<br \/>\n\tgzip_vary on;<br \/>\n\tserver<br \/>\n\t{<br \/>\n\tlisten 8080;<br \/>\n\tserver_name backup.aiju.com;<br \/>\n\tindex index.<a class=\"replace_word\" href=\"http:\/\/lib.csdn.net\/base\/php\" target=\"_blank\" title=\"PHP\u77e5\u8bc6\u5e93\">PHP<\/a><span>&nbsp;<\/span>index.htm;<br \/>\n\troot \/www\/html\/;<br \/>\n\tlocation \/status<br \/>\n\t{<br \/>\n\tstub_status on;<br \/>\n\t}<br \/>\n\tlocation ~ .*\\.(php|php5)?$<br \/>\n\t{<br \/>\n\tfastcgi_pass 127.0.0.1:9000;<br \/>\n\tfastcgi_index index.php;<br \/>\n\tinclude fcgi.conf;<br \/>\n\t}<br \/>\n\tlocation ~ .*\\.(gif|jpg|jpeg|png|bmp|swf|js|css)$<br \/>\n\t{<br \/>\n\texpires 30d;<br \/>\n\t}<br \/>\n\tlog_format access &#039;$remote_addr -- $remote_user [$time_local] &quot;$request&quot; &#039;<br \/>\n\t&#039;$status $body_bytes_sent &quot;$http_referer&quot; &#039;<br \/>\n\t&#039;&quot;$http_user_agent&quot; $http_x_forwarded_for&#039;;<br \/>\n\taccess_log \/www\/log\/access.log access;<br \/>\n\t}<br \/>\n\t}\n<\/p>\n<p>\n\t<strong>\u516d\u3001\u5173\u4e8eFastCGI \u7684\u51e0\u4e2a\u6307\u4ee4\uff1a<\/strong>\n<\/p>\n<p>\n\tfastcgi_cache_path \/usr\/local\/nginx\/fastcgi_cache levels=1:2 keys_zone=TEST:10minactive=5m;\n<\/p>\n<p>\n\t\u8fd9\u4e2a\u6307\u4ee4\u4e3aFastCGI \u7f13\u5b58\u6307\u5b9a\u4e00\u4e2a\u8def\u5f84\uff0c\u76ee\u5f55\u7ed3\u6784\u7b49\u7ea7\uff0c\u5173\u952e\u5b57\u533a\u57df\u5b58\u50a8\u65f6\u95f4\u548c\u975e\u6d3b\u52a8\u5220\u9664\u65f6\u95f4\u3002\n<\/p>\n<p>\n\t<strong>fastcgi_connect_timeout 300;<\/strong>\n<\/p>\n<p>\n\t\u6307\u5b9a\u8fde\u63a5\u5230\u540e\u7aefFastCGI \u7684\u8d85\u65f6\u65f6\u95f4\u3002\n<\/p>\n<p>\n\t<strong>fastcgi_send_timeout 300;<\/strong>\n<\/p>\n<p>\n\t\u5411FastCGI \u4f20\u9001\u8bf7\u6c42\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u8fd9\u4e2a\u503c\u662f\u6307\u5df2\u7ecf\u5b8c\u6210\u4e24\u6b21\u63e1\u624b\u540e\u5411FastCGI \u4f20\u9001\u8bf7\u6c42\u7684\u8d85\u65f6\u65f6\u95f4\u3002\n<\/p>\n<p>\n\t<strong>fastcgi_read_timeout 300;<\/strong>\n<\/p>\n<p>\n\t\u63a5\u6536FastCGI \u5e94\u7b54\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u8fd9\u4e2a\u503c\u662f\u6307\u5df2\u7ecf\u5b8c\u6210\u4e24\u6b21\u63e1\u624b\u540e\u63a5\u6536FastCGI \u5e94\u7b54\u7684\u8d85\u65f6\u65f6\u95f4\u3002\n<\/p>\n<p>\n\t<strong>fastcgi_buffer_size 4k;<\/strong>\n<\/p>\n<p>\n\t\u6307\u5b9a\u8bfb\u53d6FastCGI \u5e94\u7b54\u7b2c\u4e00\u90e8\u5206\u9700\u8981\u7528\u591a\u5927\u7684\u7f13\u51b2\u533a\uff0c\u4e00\u822c\u7b2c\u4e00\u90e8\u5206\u5e94\u7b54\u4e0d\u4f1a\u8d85\u8fc71k\uff0c\u7531\u4e8e\u9875\u9762\u5927\u5c0f\u4e3a4k\uff0c\u6240\u4ee5\u8fd9\u91cc\u8bbe\u7f6e\u4e3a4k\u3002\n<\/p>\n<p>\n\t<strong>fastcgi_buffers 8 4k;<\/strong>\n<\/p>\n<p>\n\t\u6307\u5b9a\u672c\u5730\u9700\u8981\u7528\u591a\u5c11\u548c\u591a\u5927\u7684\u7f13\u51b2\u533a\u6765\u7f13\u51b2FastCGI \u7684\u5e94\u7b54\u3002\n<\/p>\n<p>\n\t<strong>fastcgi_busy_buffers_size 8k;<\/strong>\n<\/p>\n<p>\n\t\u8fd9\u4e2a\u6307\u4ee4\u6211\u4e5f\u4e0d\u77e5\u9053\u662f\u505a\u4ec0\u4e48\u7528\uff0c\u53ea\u77e5\u9053\u9ed8\u8ba4\u503c\u662ffastcgi_buffers \u7684\u4e24\u500d\u3002\n<\/p>\n<p>\n\t<strong>fastcgi_temp_file_write_size 8k;<\/strong>\n<\/p>\n<p>\n\t\u5728\u5199\u5165fastcgi_temp_path \u65f6\u5c06\u7528\u591a\u5927\u7684\u6570\u636e\u5757\uff0c\u9ed8\u8ba4\u503c\u662ffastcgi_buffers \u7684\u4e24\u500d\u3002\n<\/p>\n<p>\n\t<strong>fastcgi_cache TEST<\/strong>\n<\/p>\n<p>\n\t\u5f00\u542fFastCGI \u7f13\u5b58\u5e76\u4e14\u4e3a\u5176\u5236\u5b9a\u4e00\u4e2a\u540d\u79f0\u3002\u4e2a\u4eba\u611f\u89c9\u5f00\u542f\u7f13\u5b58\u975e\u5e38\u6709\u7528\uff0c\u53ef\u4ee5\u6709\u6548\u964d\u4f4eCPU \u8d1f\u8f7d\uff0c\u5e76\u4e14\u9632\u6b62502 \u9519\u8bef\u3002\n<\/p>\n<p>\n\t<strong>fastcgi_cache_valid 200 302 1h;<br \/>\n\tfastcgi_cache_valid 301 1d;<br \/>\n\tfastcgi_cache_valid any 1m;<\/strong>\n<\/p>\n<p>\n\t\u4e3a\u6307\u5b9a\u7684\u5e94\u7b54\u4ee3\u7801\u6307\u5b9a\u7f13\u5b58\u65f6\u95f4\uff0c\u5982\u4e0a\u4f8b\u4e2d\u5c06200\uff0c302 \u5e94\u7b54\u7f13\u5b58\u4e00\u5c0f\u65f6\uff0c301 \u5e94\u7b54\u7f13\u5b581 \u5929\uff0c\u5176\u4ed6\u4e3a1 \u5206\u949f\u3002\n<\/p>\n<p>\n\t<strong>fastcgi_cache_min_uses 1;<\/strong>\n<\/p>\n<p>\n\t\u7f13\u5b58\u5728fastcgi_cache_path \u6307\u4ee4inactive \u53c2\u6570\u503c\u65f6\u95f4\u5185\u7684\u6700\u5c11\u4f7f\u7528\u6b21\u6570\uff0c\u5982\u4e0a\u4f8b\uff0c\u5982\u679c\u57285 \u5206\u949f\u5185\u67d0\u6587\u4ef61 \u6b21\u4e5f\u6ca1\u6709\u88ab\u4f7f\u7528\uff0c\u90a3\u4e48\u8fd9\u4e2a\u6587\u4ef6\u5c06\u88ab\u79fb\u9664\u3002\n<\/p>\n<p>\n\t<strong>fastcgi_cache_use_stale error timeout invalid_header http_500;<\/strong>\n<\/p>\n<p>\n\t\u4e0d\u77e5\u9053\u8fd9\u4e2a\u53c2\u6570\u7684\u4f5c\u7528\uff0c\u731c\u60f3\u5e94\u8be5\u662f\u8ba9nginx \u77e5\u9053\u54ea\u4e9b\u7c7b\u578b\u7684\u7f13\u5b58\u662f\u6ca1\u7528\u7684\u3002\u4ee5\u4e0a\u4e3anginx \u4e2dFastCGI \u76f8\u5173\u53c2\u6570\uff0c\u53e6\u5916\uff0cFastCGI \u81ea\u8eab\u4e5f\u6709\u4e00\u4e9b\u914d\u7f6e\u9700\u8981\u8fdb\u884c\u4f18\u5316\uff0c\u5982\u679c\u4f60\u4f7f\u7528php-fpm \u6765\u7ba1\u7406FastCGI\uff0c\u53ef\u4ee5\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u4ee5\u4e0b\u503c\uff1a\n<\/p>\n<p>\n\t<strong>&lt;value name=&quot;max_children&quot;&gt;60&lt;\/value&gt;<\/strong>\n<\/p>\n<p>\n\t\u540c\u65f6\u5904\u7406\u7684\u5e76\u53d1\u8bf7\u6c42\u6570\uff0c\u5373\u5b83\u5c06\u5f00\u542f\u6700\u591a60 \u4e2a\u5b50\u7ebf\u7a0b\u6765\u5904\u7406\u5e76\u53d1\u8fde\u63a5\u3002\n<\/p>\n<p>\n\t<strong>&lt;value name=&quot;rlimit_files&quot;&gt;102400&lt;\/value&gt;<\/strong>\n<\/p>\n<p>\n\t\u6700\u591a\u6253\u5f00\u6587\u4ef6\u6570\u3002\n<\/p>\n<p>\n\t<strong>&lt;value name=&quot;max_requests&quot;&gt;204800&lt;\/value&gt;<\/strong>\n<\/p>\n<p>\n\t\u6bcf\u4e2a\u8fdb\u7a0b\u5728\u91cd\u7f6e\u4e4b\u524d\u80fd\u591f\u6267\u884c\u7684\u6700\u591a\u8bf7\u6c42\u6570\u3002\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<div style=\"margin: 0px;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 15px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;line-height: 24px;text-align: start;text-indent: 0px;color: gray\">\n\t<small>\u6765\u6e90\uff1a&nbsp;<a href=\"http:\/\/blog.csdn.net\/gzh0222\/article\/details\/7996835\">http:\/\/blog.csdn.net\/gzh0222\/article\/details\/7996835<\/a><\/small>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u4e00\u822c\u6765\u8bf4nginx \u914d\u7f6e\u6587\u4ef6\u4e2d\u5bf9\u4f18\u5316\u6bd4\u8f83\u6709\u4f5c\u7528\u7684\u4e3a\u4ee5\u4e0b\u51e0\u9879\uff1a 1. &nbsp;worker_processes 8; nginx \u8fdb\u7a0b\u6570\uff0c\u5efa\u8bae\u6309\u7167cpu \u6570\u76ee\u6765\u6307\u5b9a\uff0c\u4e00\u822c\u4e3a\u5b83\u7684\u500d\u6570 (\u5982,2\u4e2a\u56db\u6838\u7684cpu\u8ba1\u4e3a8)\u3002 2. &nbsp;worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000; \u4e3a\u6bcf\u4e2a\u8fdb\u7a0b\u5206\u914dcpu\uff0c\u4e0a\u4f8b\u4e2d\u5c068 \u4e2a\u8fdb\u7a0b\u5206\u914d\u52308 \u4e2acpu\uff0c\u5f53\u7136\u53ef\u4ee5\u5199\u591a\u4e2a\uff0c\u6216\u8005\u5c06\u4e00 \u4e2a\u8fdb\u7a0b\u5206\u914d\u5230\u591a\u4e2acpu\u3002 3.&nbsp;&nbsp;worker_rlimit_nofile 65535; \u8fd9\u4e2a\u6307\u4ee4\u662f\u6307\u5f53\u4e00\u4e2anginx \u8fdb\u7a0b\u6253\u5f00\u7684\u6700\u591a\u6587\u4ef6\u63cf\u8ff0\u7b26\u6570\u76ee\uff0c\u7406\u8bba\u503c\u5e94\u8be5\u662f\u6700\u591a\u6253\u5f00\u6587 \u4ef6\u6570\uff08ulimit -n\uff09\u4e0enginx \u8fdb\u7a0b\u6570\u76f8\u9664\uff0c\u4f46\u662fnginx \u5206\u914d\u8bf7\u6c42\u5e76\u4e0d\u662f\u90a3\u4e48\u5747\u5300\uff0c\u6240\u4ee5\u6700\u597d\u4e0eulimit -n \u7684\u503c\u4fdd\u6301\u4e00\u81f4\u3002 \u73b0\u5728\u5728Linux&nbsp;2.6\u5185\u6838\u4e0b\u5f00\u542f\u6587\u4ef6\u6253\u5f00\u6570\u4e3a65535\uff0cworker_rlimit_nofile\u5c31\u76f8\u5e94\u5e94\u8be5\u586b\u519965535\u3002 \u8fd9\u662f\u56e0\u4e3anginx\u8c03\u5ea6\u65f6\u5206\u914d\u8bf7\u6c42\u5230\u8fdb\u7a0b\u5e76\u4e0d\u662f\u90a3\u4e48\u7684\u5747\u8861\uff0c\u6240\u4ee5\u5047\u5982\u586b\u519910240\uff0c\u603b\u5e76\u53d1\u91cf\u8fbe\u52303-4\u4e07\u65f6\u5c31\u6709\u8fdb\u7a0b\u53ef\u80fd\u8d85\u8fc710240\u4e86\uff0c\u8fd9\u65f6\u4f1a\u8fd4\u56de502\u9519\u8bef\u3002 \u67e5\u770blinux\u7cfb\u7edf\u6587\u4ef6\u63cf\u8ff0\u7b26\u7684\u65b9\u6cd5\uff1a [root@web001 ~]# sysctl -a | grep fs.file fs.file-max = 789972 fs.file-nr = 510 0 789972 4.&nbsp;&nbsp;use epoll; \u4f7f\u7528epoll \u7684I\/O&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-731","post","type-post","status-publish","format-standard","hentry","category-linux"],"aioseo_notices":[],"brizy_media":[],"_links":{"self":[{"href":"https:\/\/peloo.net\/index.php?rest_route=\/wp\/v2\/posts\/731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peloo.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peloo.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peloo.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/peloo.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=731"}],"version-history":[{"count":1,"href":"https:\/\/peloo.net\/index.php?rest_route=\/wp\/v2\/posts\/731\/revisions"}],"predecessor-version":[{"id":732,"href":"https:\/\/peloo.net\/index.php?rest_route=\/wp\/v2\/posts\/731\/revisions\/732"}],"wp:attachment":[{"href":"https:\/\/peloo.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peloo.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peloo.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}