{"id":54460,"date":"2025-08-13T07:10:49","date_gmt":"2025-08-12T23:10:49","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/54460.html"},"modified":"2025-08-13T07:10:49","modified_gmt":"2025-08-12T23:10:49","slug":"2-1-3%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%99%be%e4%b8%87%e5%b9%b6%e5%8f%91","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/54460.html","title":{"rendered":"2.1.3\u670d\u52a1\u5668\u767e\u4e07\u5e76\u53d1"},"content":{"rendered":"<p>\u4f9d\u6258\u4e0a\u8282reactor\u5b9e\u73b0\u7684tcp server&#xff0c;\u518d\u901a\u8fc7\u865a\u62df\u673a\u521b\u5efa\u4e09\u4e2a\u5ba2\u6237\u7aef\u8fde\u63a5\u8fd9\u53f0tcp server\u3002<\/p>\n<p>\u5728\u8fd0\u884c\u65f6\u670d\u52a1\u5668\u51fa\u73b0\u95ee\u9898&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"190\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231046-689bc9f6b04c1.png\" width=\"442\" \/><\/p>\n<p>\u8fd9\u662f\u7531\u4e8e\u5728\u6267\u884caccept\u903b\u8f91\u65f6&#xff0c;accept\u8fd4\u56de\u7684clientfd\u503c\u4e3a-1&#xff0c;\u6b64\u65f6conn_list\u6570\u7ec4\u4e0b\u6807\u8bbf\u95ee\u5931\u8d25&#xff0c;\u56e0\u6b64\u9700\u8981\u5148\u5224\u65adclientfd\u662f\u5426\u5408\u7406&#xff1a;<\/p>\n<p>int clientfd&#061;accept(fd,(struct sockaddr*)&amp;clientaddr,&amp;len);<br \/>\n    \/\/\/printf(&#034;accept finshed:%d\\\\n&#034;,clientfd);<br \/>\n    if(clientfd&lt;0){<br \/>\n        printf(&#034;accpet errno:%d&#8212;-&gt; %s\\\\n&#034;,errno,strerror(errno));<br \/>\n        return -1;<br \/>\n    } <\/p>\n<\/p>\n<p>\u800c\u5ba2\u6237\u7aef\u51fa\u73b0\u5982\u4e0b\u95ee\u9898&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"61\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231046-689bc9f6c8948.png\" width=\"427\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"80\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231046-689bc9f6d604c.png\" width=\"477\" \/><\/p>\n<\/p>\n<p>\u8fd9\u4e2a\u95ee\u9898\u53ef\u901a\u8fc7ulimt -a \u6307\u4ee4\u67e5\u770bopen files\u6570\u91cf&#xff0c;\u5e76\u901a\u8fc7\u6307\u4ee4ulimit -n 1048576<\/p>\n<p>\u4fee\u6539\u6570\u91cf&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"328\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231046-689bc9f6e2cbb.png\" width=\"498\" \/><\/p>\n<p>\u4fee\u6539\u5b8c\u540e&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"27\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231047-689bc9f70bb31.png\" width=\"422\" \/><\/p>\n<p>\u4e5f\u53ef\u4ee5\u901a\u8fc7 sudo vim \/etc\/security\/limits.conf&#xff0c;\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"92\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231047-689bc9f71c3ac.png\" width=\"409\" \/><\/p>\n<\/p>\n<p>\u4fee\u6539\u5b8c\u540e\u53d1\u73b0\u670d\u52a1\u5668\u4e5f\u5b58\u5728\u76f8\u540c\u7684\u95ee\u9898&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"205\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231047-689bc9f72d515.png\" width=\"416\" \/><\/p>\n<p>\u540c\u6837\u4f7f\u7528\u6307\u4ee4ulimit -n 1048576\u8fdb\u884c\u4fee\u6539<\/p>\n<p>\u5982\u679c\u901a\u8fc7\u4e0a\u8ff0\u64cd\u4f5c\u5ba2\u6237\u7aef\u8fd8\u51fa\u73b0\u4e0a\u8ff0\u95ee\u9898&#xff0c;\u662f\u7531\u4e8eubuntu&#xff08;16&#xff0c;\u5ba2\u6237\u7aef\u7248\u672c&#xff09;\u7248\u672c\u5bfc\u81f4:\u53ef\u80fd\u9700\u8981\u5728vim \/etc\/sysctl.conf \u5f53\u4e2d\u4fee\u6539\u8fd9\u4e00\u6bb5&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"25\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231047-689bc9f747b53.png\" width=\"339\" \/><\/p>\n<p>\u518d\u6267\u884csudo sysctl -p\u5373\u53ef<\/p>\n<\/p>\n<\/p>\n<\/p>\n<p>\u4ee3\u7801\u5728\u8fd0\u884c\u4e00\u6bb5\u65f6\u95f4\u540e&#xff0c;\u51fa\u73b0\u95ee\u9898&#xff1a;<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"52\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231047-689bc9f76adef.png\" width=\"509\" \/><\/p>\n<p>\u8fd9\u662f\u56e0\u4e3a\u6bcf\u4e2atcp\u8fde\u63a5\u662f\u7531\u4e00\u4e2a\u4e94\u5143\u7ec4\u552f\u4e00\u786e\u5b9a\u7684[\u6e90ip&#xff0c;\u6e90\u7aef\u53e3&#xff0c;\u76ee\u7684ip&#xff0c;\u76ee\u7684\u7aef\u53e3&#xff0c;\u4f20\u8f93\u5c42\u534f\u8bae]<\/p>\n<p>\u6b64\u65f6\u6e90\u7aef\u53e3\u4e0d\u591f&#xff0c;\u5bfc\u81f4\u51fa\u73b0\u95ee\u9898&#xff0c;\u56e0\u6b64&#xff0c;\u53ef\u4ee5\u540c\u65f6\u76d1\u542c\u591a\u4e2a\u7aef\u53e3&#xff08;\u4ece\u4e00\u4e2a\u7aef\u53e3\u523020\u4e2a\u7aef\u53e3&#xff09;&#xff1a;<\/p>\n<p>for(i&#061;0;i&lt;MAX_PORTS;i&#043;&#043;){<br \/>\n        int sockfd&#061;Init_server(port&#043;i);<br \/>\n        conn_list[sockfd].fd&#061;sockfd;<br \/>\n        conn_list[sockfd].r_action.recv_callback&#061;accept_cb;<\/p>\n<p>        set_event(sockfd,EPOLLIN,1);<br \/>\n    } <\/p>\n<\/p>\n<p>\u4e3a\u4e86\u907f\u514d\u6253\u5370\u4fe1\u606f\u964d\u4f4e\u901f\u7387&#xff0c;\u53ef\u4ee5\u6bcf\u4e00\u5343\u6b21\u8fde\u63a5\u624d\u6253\u5370\u4e00\u6761\u4fe1\u606f&#xff0c;\u5e76\u83b7\u53d6\u8fd9\u4e00\u5343\u6761\u8fde\u63a5\u8017\u8d39\u7684\u65f6\u95f4&#xff1a;<\/p>\n<p>if((clientfd%1000)&#061;&#061;0){<\/p>\n<p>        struct timeval current;<\/p>\n<p>        gettimeofday(&amp;current,NULL);<\/p>\n<p>        printf(&#034;accept finshed:%d\\\\n&#034;,clientfd);<br \/>\n        int time_used &#061; TIME_SUB_MS(current,begin);<br \/>\n        memcpy(&amp;begin,&amp;current,sizeof(struct timeval));<\/p>\n<p>        printf(&#034;accept finshed:%d,time_used:%d\\\\n&#034;,clientfd,time_used);<br \/>\n    } <\/p>\n<p>gettimeofday(&amp;current,NULL)&#xff1a;\u83b7\u53d6\u7cfb\u7edf\u65f6\u95f4\u3002<\/p>\n<p>TIME_SUB_MS(current,begin)&#xff1a;\u4e24\u4e2a\u65f6\u95f4\u7684\u5dee\u503c\u3002<\/p>\n<p>memcy&#xff1a;\u5c06\u672c\u6b21current\u65f6\u95f4\u62f7\u8d1d\u5230begin\u5f53\u4e2d&#xff0c;\u8986\u76d6\u65e7\u503c\u3002<\/p>\n<\/p>\n<p>\u5982\u679c\u5ba2\u6237\u7aef\u51fa\u73b0&#xff1a;<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"59\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231047-689bc9f785546.png\" width=\"296\" \/><\/p>\n<p>\u5176\u5b9e\u662f\u6b63\u5e38\u7684&#xff0c;\u5728recv\u903b\u8f91\u4e2d\u6dfb\u52a0EAGANIN\u65e0\u89c6\u8be5\u9519\u8bef&#xff1a;<\/p>\n<p>if (errno &#061;&#061; EINTR||errno &#061;&#061; EAGAIN) continue; <\/p>\n<\/p>\n<p>\u5ba2\u6237\u7aef\u51fa\u73b0killed\u9519\u8bef&#xff1a;\u8fd9\u662f\u7531\u4e8ecpu\u5360\u7528\u8fc7\u9ad8&#xff0c;\u7cfb\u7edf\u5c06\u8fdb\u7a0b\u7ec8\u6b62\u3002<\/p>\n<\/p>\n<\/p>\n<p>\u670d\u52a1\u5668\u51fa\u73b0killed\u9519\u8bef&#xff1a;\u5f53cpu\u5360\u7528\u8fc7\u9ad8&#xff0c;\u7269\u7406\u5185\u5b58 &#043; SWAP \u5168\u90e8\u8017\u5c3d\u65f6&#xff0c;\u5185\u6838\u9009\u62e9\u8bc4\u5206\u6700\u9ad8\u7684\u8fdb\u7a0b\u7ec8\u6b62\u3002<\/p>\n<\/p>\n<p>\u5982\u679c\u5185\u5b58\u4e0d\u8db3&#xff0c;\u53ef\u4ee5\u901a\u8fc7\u8c03\u9ad8\u865a\u62df\u673a\u5185\u5b58\u6216\u8005\u4fee\u6539swap\u7a7a\u95f4&#xff1b;<\/p>\n<p>Swap \u7a7a\u95f4\u53ef\u4ee5\u662f\u786c\u76d8\u4e0a\u7684\u4e00\u4e2a\u5206\u533a&#xff0c;\u4e5f\u53ef\u4ee5\u662f\u6587\u4ef6\u5f62\u5f0f\u5b58\u5728\u4e8e\u786c\u76d8\u4e0a\u3002\u5b83\u672c\u8d28\u4e0a\u662f\u4e00\u5757\u5b58\u50a8\u533a\u57df&#xff0c;\u7528\u6765\u6a21\u62df\u5185\u5b58&#xff0c; \u4ee5\u4fbf\u5728\u7269\u7406\u5185\u5b58&#xff08;RAM&#xff09;\u4e0d\u591f\u7528\u65f6&#xff0c;\u534f\u52a9\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u5185\u5b58\u7ba1\u7406\u3002<\/p>\n<p>\u89e3\u6cd5&#xff1a;\u53ef\u4ee5\u8c03\u5927\u865a\u62df\u673a\u5185\u5b58&#xff0c;\u4f46\u662f\u4e5f\u53ef\u4ee5\u901a\u8fc7\u6269\u5145swap\u7a7a\u95f4\u4e5f\u80fd\u8fbe\u5230\u76ee\u7684\u3002<\/p>\n<p>\u4f8b\u5982\u5c06swap\u6269\u51454g&#xff1a;<\/p>\n<p>sudo dd if&#061;\/dev\/zero of&#061;\/extraswap bs&#061;1G count&#061;4<\/p>\n<p>sudo mkswap \/extraswap<\/p>\n<p>sudo swapon \/extraswap<\/p>\n<p>\u8fd9\u6837\u5728\u7269\u7406\u5185\u5b58\u4e0d\u591f\u7528\u7684\u60c5\u51b5\u4e0b\u53ef\u4ee5\u7ee7\u7eed\u4f7f\u7528swap\u7a7a\u95f4\u3002<\/p>\n<\/p>\n<\/p>\n<p>\u5728\u8c03\u8bd5\u8fd0\u884c\u670d\u52a1\u5668\u7684\u65f6\u5019\u51fa\u73b0\u5982\u4e0b\u60c5\u51b5&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"421\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231047-689bc9f795bf8.png\" width=\"758\" \/><\/p>\n<p>\u800c\u5185\u5b58\u60c5\u51b5\u4f3c\u4e4e\u6b63\u5e38&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"565\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231047-689bc9f7b7768.png\" width=\"1149\" \/><\/p>\n<p>\u4f46\u662faccept finshed\u8f93\u51fa\u505c\u6b62&#xff0c;\u5927\u7ea6\u4e00\u5206\u949f\u5de6\u53f3\u540e\u670d\u52a1\u5668\u7a81\u7136\u65ad\u5f00\u8fde\u63a5\u4e86&#xff0c;\u5bfc\u81f4\u5ba2\u6237\u7aef\u8fde\u63a5\u8d85\u65f6\u3002<\/p>\n<p>\u6838\u5fc3\u95ee\u9898\u662f\u8fde\u63a5\u8ddf\u8e2a\u8868\u8017\u5c3d\u200b\u200b\u5f15\u53d1\u5185\u6838\u4e22\u5305&#xff0c;\u5bfc\u81f4TCP\u8fde\u63a5\u88ab\u8feb\u91cd\u7f6e\u3002<\/p>\n<p>\u9700\u8981\u4fee\u6539\u8fde\u63a5\u8ddf\u8e2a\u8868\u5927\u5c0f&#xff08;\u5176\u5b9e\u8ddf16\u7248\u672c\u4fee\u6539net.nf_conntrack_max\u4e00\u6837&#xff09;&#xff1a;<\/p>\n<p>1.\u901a\u8fc7\u6307\u4ee4sysctl net.nf_conntrack_max\u67e5\u770b\u8fde\u63a5\u8ddf\u8e2a\u8868\u5927\u5c0f\u3002<\/p>\n<p>2.\u518d\u901a\u8fc7sudo sysctl -w net.nf_conntrack_max&#061;1048576\u8fdb\u884c\u4fee\u6539\u3002<\/p>\n<\/p>\n<p>\u901a\u8fc7\u89e3\u51b3\u4ee5\u4e0a\u95ee\u9898&#xff0c;\u6210\u529f\u5b9e\u73b0\u4e86\u767e\u4e07\u5e76\u53d1\u7684\u8fde\u63a5&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"314\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231048-689bc9f8455c1.png\" width=\"638\" \/><\/p>\n<\/p>\n<p>\u5e76\u53d1\u91cf\u4e3b\u8981\u770b&#xff1a;<\/p>\n<p>\u7f51\u7edcio&#xff0c;qps&#xff08;\u4e00\u79d2\u949f\u53ef\u4ee5\u5904\u7406\u591a\u5c11\u8bf7\u6c42&#xff09;&#xff0c;\u65f6\u5ef6\u3002<\/p>\n<\/p>\n<\/p>\n<p>\u672c\u5c0f\u8282\u4e3b\u8981\u662f\u8fd0\u884c\u8c03\u8bd5\u767e\u4e07\u5e76\u53d1\u670d\u52a1\u5668&#xff0c;\u5e76\u8fdb\u884c\u9519\u8bef\u6392\u67e5\u3002<\/p>\n<\/p>\n<p>https:\/\/github.com\/0voice<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb805\u6b21\uff0c\u70b9\u8d5e19\u6b21\uff0c\u6536\u85cf8\u6b21\u3002\u5982\u679c\u901a\u8fc7\u4e0a\u8ff0\u64cd\u4f5c\u5ba2\u6237\u7aef\u8fd8\u51fa\u73b0\u4e0a\u8ff0\u95ee\u9898\uff0c\u662f\u7531\u4e8eubuntu\uff0816\uff0c\u5ba2\u6237\u7aef\u7248\u672c\uff09\u7248\u672c\u5bfc\u81f4:\u53ef\u80fd\u9700\u8981\u5728vim \/etc\/sysctl.conf\u3002\u5b83\u672c\u8d28\u4e0a\u662f\u4e00\u5757\u5b58\u50a8\u533a\u57df\uff0c\u7528\u6765\u6a21\u62df\u5185\u5b58\uff0c \u4ee5\u4fbf\u5728\u7269\u7406\u5185\u5b58\uff08RAM\uff09\u4e0d\u591f\u7528\u65f6\uff0c\u534f\u52a9\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u5185\u5b58\u7ba1\u7406\u3002\u670d\u52a1\u5668\u51fa\u73b0killed\u9519\u8bef\uff1a\u5f53cpu\u5360\u7528\u8fc7\u9ad8\uff0c\u7269\u7406\u5185\u5b58 + SWAP \u5168\u90e8\u8017\u5c3d\u65f6\uff0c\u5185\u6838\u9009\u62e9\u8bc4\u5206\u6700\u9ad8\u7684\u8fdb\u7a0b\u7ec8\u6b62\u3002\u8fd9\u662f\u56e0\u4e3a\u6bcf\u4e2atcp\u8fde\u63a5\u662f\u7531\u4e00\u4e2a\u4e94\u5143\u7ec4\u552f\u4e00\u786e\u5b9a\u7684[\u6e90ip\uff0c\u6e90\u7aef\u53e3\uff0c\u76ee\u7684ip\uff0c\u76ee\u7684\u7aef\u53e3\uff0c\u4f20\u8f93\u5c42\u534f\u8bae]gettimeofday(\u00a4t,NULL)\uff1a\u83b7\u53d6\u7cfb\u7edf\u65f6\u95f4\u3002<\/p>\n","protected":false},"author":2,"featured_media":54447,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,43,44],"topic":[],"class_list":["post-54460","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>2.1.3\u670d\u52a1\u5668\u767e\u4e07\u5e76\u53d1 - \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\/54460.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"2.1.3\u670d\u52a1\u5668\u767e\u4e07\u5e76\u53d1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb805\u6b21\uff0c\u70b9\u8d5e19\u6b21\uff0c\u6536\u85cf8\u6b21\u3002\u5982\u679c\u901a\u8fc7\u4e0a\u8ff0\u64cd\u4f5c\u5ba2\u6237\u7aef\u8fd8\u51fa\u73b0\u4e0a\u8ff0\u95ee\u9898\uff0c\u662f\u7531\u4e8eubuntu\uff0816\uff0c\u5ba2\u6237\u7aef\u7248\u672c\uff09\u7248\u672c\u5bfc\u81f4:\u53ef\u80fd\u9700\u8981\u5728vim \/etc\/sysctl.conf\u3002\u5b83\u672c\u8d28\u4e0a\u662f\u4e00\u5757\u5b58\u50a8\u533a\u57df\uff0c\u7528\u6765\u6a21\u62df\u5185\u5b58\uff0c \u4ee5\u4fbf\u5728\u7269\u7406\u5185\u5b58\uff08RAM\uff09\u4e0d\u591f\u7528\u65f6\uff0c\u534f\u52a9\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u5185\u5b58\u7ba1\u7406\u3002\u670d\u52a1\u5668\u51fa\u73b0killed\u9519\u8bef\uff1a\u5f53cpu\u5360\u7528\u8fc7\u9ad8\uff0c\u7269\u7406\u5185\u5b58 + SWAP \u5168\u90e8\u8017\u5c3d\u65f6\uff0c\u5185\u6838\u9009\u62e9\u8bc4\u5206\u6700\u9ad8\u7684\u8fdb\u7a0b\u7ec8\u6b62\u3002\u8fd9\u662f\u56e0\u4e3a\u6bcf\u4e2atcp\u8fde\u63a5\u662f\u7531\u4e00\u4e2a\u4e94\u5143\u7ec4\u552f\u4e00\u786e\u5b9a\u7684[\u6e90ip\uff0c\u6e90\u7aef\u53e3\uff0c\u76ee\u7684ip\uff0c\u76ee\u7684\u7aef\u53e3\uff0c\u4f20\u8f93\u5c42\u534f\u8bae]gettimeofday(\u00a4t,NULL)\uff1a\u83b7\u53d6\u7cfb\u7edf\u65f6\u95f4\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/54460.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-12T23:10:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231046-689bc9f6b04c1.png\" \/>\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=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/54460.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/54460.html\",\"name\":\"2.1.3\u670d\u52a1\u5668\u767e\u4e07\u5e76\u53d1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-12T23:10:49+00:00\",\"dateModified\":\"2025-08-12T23:10:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/54460.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/54460.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/54460.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"2.1.3\u670d\u52a1\u5668\u767e\u4e07\u5e76\u53d1\"}]},{\"@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":"2.1.3\u670d\u52a1\u5668\u767e\u4e07\u5e76\u53d1 - \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\/54460.html","og_locale":"zh_CN","og_type":"article","og_title":"2.1.3\u670d\u52a1\u5668\u767e\u4e07\u5e76\u53d1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb805\u6b21\uff0c\u70b9\u8d5e19\u6b21\uff0c\u6536\u85cf8\u6b21\u3002\u5982\u679c\u901a\u8fc7\u4e0a\u8ff0\u64cd\u4f5c\u5ba2\u6237\u7aef\u8fd8\u51fa\u73b0\u4e0a\u8ff0\u95ee\u9898\uff0c\u662f\u7531\u4e8eubuntu\uff0816\uff0c\u5ba2\u6237\u7aef\u7248\u672c\uff09\u7248\u672c\u5bfc\u81f4:\u53ef\u80fd\u9700\u8981\u5728vim \/etc\/sysctl.conf\u3002\u5b83\u672c\u8d28\u4e0a\u662f\u4e00\u5757\u5b58\u50a8\u533a\u57df\uff0c\u7528\u6765\u6a21\u62df\u5185\u5b58\uff0c \u4ee5\u4fbf\u5728\u7269\u7406\u5185\u5b58\uff08RAM\uff09\u4e0d\u591f\u7528\u65f6\uff0c\u534f\u52a9\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u5185\u5b58\u7ba1\u7406\u3002\u670d\u52a1\u5668\u51fa\u73b0killed\u9519\u8bef\uff1a\u5f53cpu\u5360\u7528\u8fc7\u9ad8\uff0c\u7269\u7406\u5185\u5b58 + SWAP \u5168\u90e8\u8017\u5c3d\u65f6\uff0c\u5185\u6838\u9009\u62e9\u8bc4\u5206\u6700\u9ad8\u7684\u8fdb\u7a0b\u7ec8\u6b62\u3002\u8fd9\u662f\u56e0\u4e3a\u6bcf\u4e2atcp\u8fde\u63a5\u662f\u7531\u4e00\u4e2a\u4e94\u5143\u7ec4\u552f\u4e00\u786e\u5b9a\u7684[\u6e90ip\uff0c\u6e90\u7aef\u53e3\uff0c\u76ee\u7684ip\uff0c\u76ee\u7684\u7aef\u53e3\uff0c\u4f20\u8f93\u5c42\u534f\u8bae]gettimeofday(\u00a4t,NULL)\uff1a\u83b7\u53d6\u7cfb\u7edf\u65f6\u95f4\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/54460.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-12T23:10:49+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812231046-689bc9f6b04c1.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/54460.html","url":"https:\/\/www.wsisp.com\/helps\/54460.html","name":"2.1.3\u670d\u52a1\u5668\u767e\u4e07\u5e76\u53d1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-12T23:10:49+00:00","dateModified":"2025-08-12T23:10:49+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/54460.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/54460.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/54460.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"2.1.3\u670d\u52a1\u5668\u767e\u4e07\u5e76\u53d1"}]},{"@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\/54460","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=54460"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/54460\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/54447"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=54460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=54460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=54460"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=54460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}