<script type="application/ld+json">{"@context":"http://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://www.simcentric.com/tc/"},{"@type":"ListItem","position":2,"name":"當達到檔案描述符限制時該怎麼辦","item":"https://www.simcentric.com/tc/america-dedicated-server-tc/what-to-do-when-the-file-descriptor-limit-is-reached/"}]}</script> {"id":33498,"date":"2026-07-20T12:13:34","date_gmt":"2026-07-20T04:13:34","guid":{"rendered":"https:\/\/www.simcentric.com\/uncategorized-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/"},"modified":"2026-07-20T12:16:16","modified_gmt":"2026-07-20T04:16:16","slug":"what-to-do-when-the-file-descriptor-limit-is-reached","status":"publish","type":"post","link":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/","title":{"rendered":"\u7576\u9054\u5230\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\u8a72\u600e\u9ebc\u8fa6"},"content":{"rendered":"<p>\u7576\u4f3a\u670d\u5668\u9054\u5230\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\uff0c\u4f60\u7684\u7cfb\u7d71\u5f80\u5f80\u6703\u7acb\u523b\u51fa\u73fe\u554f\u984c\u3002\u4f60\u53ef\u80fd\u6703\u6ce8\u610f\u5230 <a href=\"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-troubleshoot-high-cpu-usage-on-us-hosting-servers\/\" target=\"_blank\" rel=\"noopener\">CPU \u4f7f\u7528\u7387<\/a>\u5347\u9ad8\u3001\u9023\u7dda\u5931\u6557\uff0c\u6216\u8005\u51fa\u73fe\u4e00\u4e9b\u96e3\u4ee5\u76f4\u63a5\u5b9a\u4f4d\u539f\u56e0\u7684\u7570\u5e38\u73fe\u8c61\u3002\u9019\u4e9b\u75c7\u72c0\u6703\u6253\u4e82\u4f60\u7684\u5de5\u4f5c\u6d41\u7a0b\uff0c\u4e5f\u6703\u5f71\u97ff\u4f7f\u7528\u8005\u9ad4\u9a57\u3002\u53ca\u6642\u8655\u7406\u6709\u52a9\u65bc\u4f60\u6062\u5fa9<a href=\"https:\/\/www.simcentric.com\/tc\/products\/dedicated-server-us\/\" target=\"_blank\" rel=\"noopener\">\u4f3a\u670d\u5668<\/a>\u7684\u6b63\u5e38\u904b\u4f5c\uff0c\u4e26\u9632\u6b62\u8cc7\u6599\u907a\u5931\u3002<\/p>\n<ul>\n<li>CPU \u4f7f\u7528\u7387\u9ad8<\/li>\n<li>\u9023\u7dda\u5931\u6557<\/li>\n<li>\u96e3\u4ee5\u8ffd\u8e64\u7684\u554f\u984c\u75c7\u72c0<\/li>\n<\/ul>\n<p>\u53ea\u8981\u63a1\u53d6\u6b63\u78ba\u7684\u6b65\u9a5f\uff0c\u4f60\u5c31\u53ef\u4ee5\u89e3\u6c7a\u9019\u4e9b\u554f\u984c\uff0c\u4e26\u8b93\u4f3a\u670d\u5668\u6301\u7e8c\u5e73\u7a69\u904b\u4f5c\u3002<\/p>\n<h2><strong>\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u554f\u984c\u7684\u7dca\u6025\u8655\u7406\u6b65\u9a5f<\/strong><\/h2>\n<h3>\u5e38\u898b\u75c7\u72c0\u8207\u932f\u8aa4\u8a0a\u606f<\/h3>\n<p>\u7576\u4f3a\u670d\u5668\u89f8\u53ca\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\uff0c\u4f60\u53ef\u80fd\u6703\u767c\u73fe\u7cfb\u7d71\u884c\u70ba\u7570\u5e38\u3002\u61c9\u7528\u7a0b\u5f0f\u53ef\u80fd\u505c\u6b62\u56de\u61c9\uff0c\u4f7f\u7528\u8005\u53ef\u80fd\u6703\u9047\u5230\u9023\u7dda\u5931\u6557\u3002\u6709\u6642\uff0c\u4f60\u9084\u6703\u5728\u65e5\u8a8c\u4e2d\u770b\u5230\u4e00\u4e9b\u6307\u5411\u8cc7\u6e90\u554f\u984c\u7684\u932f\u8aa4\u8a0a\u606f\u3002\u4ee5\u4e0b\u662f\u6700\u5e38\u898b\u7684\u4e00\u4e9b\u932f\u8aa4\uff1a<\/p>\n<div class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 50px;\">\n<colgroup>\n<col style=\"min-width: 25px;\" \/>\n<col style=\"min-width: 25px;\" \/> <\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\u932f\u8aa4\u8a0a\u606f<\/th>\n<th colspan=\"1\" rowspan=\"1\">\u8aaa\u660e<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">ERROR: lib_htresponse: htresponseGetContentBlock: Failed to allocate the content block<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u8655\u7406\u5167\u5bb9\u6642\u767c\u751f\u8a18\u61b6\u9ad4\u914d\u7f6e\u5931\u6557\u3002<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">ERROR: lib_htresponse: htresponseGetChunk: Failed to allocate the chunk<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u5206\u584a\u8655\u7406\u6642\u767c\u751f\u8a18\u61b6\u9ad4\u914d\u7f6e\u5931\u6557\u3002<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">ERROR: lib_htrequest: htrequestWrite: Failed to allocate memory<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u4e00\u822c\u8a18\u61b6\u9ad4\u914d\u7f6e\u5931\u6557\u3002<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">ERROR: as_handler: failed to create pool<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u5efa\u7acb\u8cc7\u6e90\u6c60\u6642\u56e0\u8d85\u51fa\u8cc7\u6e90\u9650\u5236\u800c\u5931\u6557\u3002<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">[alert] (11)Resource temporarily unavailable: apr_thread_create: unable to create worker thread<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u7531\u65bc\u8cc7\u6e90\u9650\u5236\uff0c\u7121\u6cd5\u5efa\u7acb\u5de5\u4f5c\u57f7\u884c\u7dd2\u3002<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">[alert] (12)Cannot allocate memory: apr_thread_create: unable to create worker thread<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u5efa\u7acb\u5de5\u4f5c\u57f7\u884c\u7dd2\u6642\u767c\u751f\u8a18\u61b6\u9ad4\u914d\u7f6e\u5931\u6557\u3002<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">[error] server reached MaxClients setting, consider raising the MaxClients setting<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u8868\u793a\u4f3a\u670d\u5668\u5df2\u9054\u5230\u6700\u5927\u7528\u6236\u7aef\u9023\u7dda\u6578\u9650\u5236\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u4f60\u61c9\u7576\u6aa2\u67e5\u65e5\u8a8c\u4e2d\u662f\u5426\u51fa\u73fe\u9019\u4e9b\u8a0a\u606f\u3002\u5b83\u5011\u80fd\u5920\u5e6b\u52a9\u4f60\u78ba\u8a8d\uff1a\u5df2\u958b\u555f\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf\u5df2\u7d93\u9054\u5230\u4e86\u7cfb\u7d71\u7bc4\u570d\u5167\u7684\u9650\u5236\u3002<\/p>\n<h3>\u5feb\u901f\u91cb\u653e\u6a94\u6848\u63cf\u8ff0\u7b26<\/h3>\n<p>\u9762\u5c0d\u9019\u7a2e\u554f\u984c\u6642\uff0c\u4f60\u9700\u8981\u76e1\u5feb\u63a1\u53d6\u884c\u52d5\u3002\u9996\u5148\uff0c\u627e\u51fa\u54ea\u4e9b\u884c\u7a0b\u5360\u7528\u4e86\u6700\u591a\u7684\u5df2\u958b\u555f\u6a94\u6848\u63cf\u8ff0\u7b26\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u5217\u51fa\u6240\u6709\u5df2\u958b\u555f\u7684\u6a94\u6848\uff1a<\/p>\n<pre><code>lsof | less<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u60f3\u67e5\u770b\u54ea\u500b\u884c\u7a0b\u5360\u7528\u6700\u591a\uff0c\u53ef\u4ee5\u5617\u8a66\uff1a<\/p>\n<pre><code>lsof | awk '{print $2}' | sort | uniq -c | sort -nr | head<\/code><\/pre>\n<p>\u9019\u689d\u547d\u4ee4\u6703\u986f\u793a\u6a94\u6848\u63cf\u8ff0\u7b26\u8a08\u6578\u6700\u9ad8\u7684\u884c\u7a0b ID\u3002\u5982\u679c\u4f60\u767c\u73fe\u67d0\u500b\u884c\u7a0b\u672c\u4e0d\u61c9\u5360\u7528\u5982\u6b64\u591a\u7684\u6a94\u6848\uff0c\u53ef\u4ee5\u505c\u6b62\u5b83\u6216\u91cd\u65b0\u555f\u52d5\u5b83\u3002\u4f60\u4e5f\u53ef\u4ee5\u95dc\u9589\u672a\u4f7f\u7528\u7684\u61c9\u7528\u7a0b\u5f0f\u6216\u9023\u7dda\u3002\u9019\u6a23\u53ef\u4ee5\u91cb\u653e\u8cc7\u6e90\uff0c\u5e6b\u52a9\u4f3a\u670d\u5668\u6062\u5fa9\u6b63\u5e38\u3002<\/p>\n<blockquote><p><strong>\u63d0\u793a\uff1a<\/strong>\u6709\u6642\uff0c\u55ae\u4e00\u61c9\u7528\u7a0b\u5f0f\u53ef\u80fd\u6703\u767c\u751f\u6a94\u6848\u63cf\u8ff0\u7b26\u6d29\u6f0f\u3002\u8acb\u6aa2\u67e5\u662f\u5426\u5b58\u5728\u5931\u63a7\u6210\u9577\u7684\u65e5\u8a8c\u6a94\uff0c\u6216\u5361\u4f4f\u7684\u7db2\u8def\u9023\u7dda\u3002<\/p><\/blockquote>\n<h3>\u91cd\u65b0\u555f\u52d5\u670d\u52d9\u6216\u884c\u7a0b<\/h3>\n<p>\u5982\u679c\u91cb\u653e\u8cc7\u6e90\u5f8c\u554f\u984c\u4ecd\u672a\u89e3\u6c7a\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u91cd\u65b0\u555f\u52d5\u76f8\u95dc\u670d\u52d9\u3002\u91cd\u65b0\u555f\u52d5\u670d\u52d9\u6703\u91cb\u653e\u5b83\u76ee\u524d\u6301\u6709\u7684\u5168\u90e8\u6a94\u6848\u63cf\u8ff0\u7b26\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u91cd\u65b0\u555f\u52d5\u670d\u52d9\uff08\u5c07 <code>service_name<\/code> \u66ff\u63db\u70ba\u5be6\u969b\u670d\u52d9\u540d\u7a31\uff09\uff1a<\/p>\n<pre><code>sudo systemctl restart service_name<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u4e0d\u77e5\u9053\u662f\u54ea\u4e00\u500b\u670d\u52d9\u5f15\u767c\u4e86\u554f\u984c\uff0c\u53ef\u4ee5\u5148\u91cd\u65b0\u555f\u52d5\u6700\u5e38\u898b\u7684\u95dc\u9375\u670d\u52d9\uff0c\u4f8b\u5982 Web \u4f3a\u670d\u5668\u6216\u8cc7\u6599\u5eab\u4f3a\u670d\u5668\u3002\u5728\u67d0\u4e9b\u60c5\u6cc1\u4e0b\uff0c\u4f60\u53ef\u80fd\u9084\u9700\u8981\u91cd\u65b0\u555f\u52d5\u6574\u53f0\u4f3a\u670d\u5668\u3002\u4e0d\u904e\uff0c\u9019\u61c9\u7576\u4f5c\u70ba\u6700\u5f8c\u624b\u6bb5\u3002<\/p>\n<p>\u4f60\u4e5f\u53ef\u4ee5\u900f\u904e\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u76ee\u524d shell \u5de5\u4f5c\u968e\u6bb5\u5141\u8a31\u958b\u555f\u7684\u6700\u5927\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf\uff1a<\/p>\n<pre><code>ulimit -n<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u9700\u8981\u66ab\u6642\u63d0\u9ad8\u9650\u5236\uff0c\u53ef\u4ee5\u4f7f\u7528\uff1a<\/p>\n<pre><code>ulimit -n 4096<\/code><\/pre>\n<p>\u9019\u689d\u547d\u4ee4\u6703\u70ba\u76ee\u524d\u5de5\u4f5c\u968e\u6bb5\u8a2d\u5b9a\u65b0\u7684\u9650\u5236\u3002\u8acb\u8a18\u4f4f\uff0c\u9019\u9805\u8b8a\u66f4\u4e0d\u6703\u5f71\u97ff\u5176\u4ed6\u4f7f\u7528\u8005\uff0c\u4e5f\u4e0d\u6703\u6539\u8b8a\u7cfb\u7d71\u7bc4\u570d\u7684\u9650\u5236\u3002<\/p>\n<p>\u4f9d\u7167\u9019\u4e9b\u6b65\u9a5f\u64cd\u4f5c\u5f8c\uff0c\u4f60\u53ef\u4ee5\u5feb\u901f\u6062\u5fa9\u6b63\u5e38\u904b\u4f5c\u3002\u540c\u6642\uff0c\u5728\u9032\u4e00\u6b65\u6392\u67e5\u6839\u672c\u539f\u56e0\u7684\u904e\u7a0b\u4e2d\uff0c\u4e5f\u80fd\u907f\u514d\u554f\u984c\u6301\u7e8c\u64f4\u5927\u3002<\/p>\n<h2><strong>\u6aa2\u67e5\u5df2\u958b\u555f\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf<\/strong><\/h2>\n<h3>\u4f7f\u7528 lsof \u548c\u5176\u4ed6\u5de5\u5177<\/h3>\n<p>\u4f60\u9700\u8981\u77e5\u9053\u4f3a\u670d\u5668\u76ee\u524d\u4f7f\u7528\u4e86\u591a\u5c11\u5df2\u958b\u555f\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u3002<code>lsof<\/code> \u547d\u4ee4\u53ef\u4ee5\u6e05\u695a\u5c55\u793a\u6240\u6709\u5df2\u958b\u555f\u7684\u6a94\u6848\uff0c\u4e26\u5e6b\u52a9\u4f60\u8fc5\u901f\u5b9a\u4f4d\u554f\u984c\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u6aa2\u67e5\u8207\u76e3\u63a7\uff1a<\/p>\n<ul>\n<li><code>lsof<\/code>\uff1a\u5217\u51fa\u6240\u6709\u5df2\u958b\u555f\u7684\u6a94\u6848\uff0c\u5305\u62ec socket \u548c pipe\u3002<\/li>\n<li><code>sudo lsof | head -20<\/code>\uff1a\u986f\u793a\u524d 20 \u500b\u5df2\u958b\u555f\u7684\u6a94\u6848\u3002\u4f7f\u7528 <code>sudo<\/code> \u53ef\u53d6\u5f97\u5b8c\u6574\u7d50\u679c\u3002<\/li>\n<li><code>sudo lsof | awk 'NR&gt;1 {print $1, $2}' | sort | uniq -c | sort -rn | head -20<\/code>\uff1a\u7d71\u8a08\u6bcf\u500b\u884c\u7a0b\u7684\u5df2\u958b\u555f\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf\u4e26\u4f9d\u964d\u51aa\u6392\u5e8f\u3002<\/li>\n<li><code>lsof -p $(pgrep myapp) | wc -l<\/code>\uff1a\u7d71\u8a08\u6307\u5b9a\u884c\u7a0b\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf\u3002<\/li>\n<li><code>watch -n 2 \"lsof -p $(pgrep myapp) | wc -l\"<\/code>\uff1a\u6bcf\u5169\u79d2\u76e3\u63a7\u4e00\u6b21\u67d0\u500b\u884c\u7a0b\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf\u3002<\/li>\n<\/ul>\n<p><code>lsof<\/code> \u5de5\u5177\u80fd\u5e6b\u52a9\u4f60\u627e\u51fa\u54ea\u4e9b\u884c\u7a0b\u6d88\u8017\u4e86\u6700\u591a\u8cc7\u6e90\u3002\u4f60\u4e5f\u53ef\u4ee5\u85c9\u6b64\u767c\u73fe\u88ab\u9396\u5b9a\u6216\u672a\u91cb\u653e\u7684\u6a94\u6848\uff0c\u9019\u4e9b\u90fd\u53ef\u80fd\u662f\u554f\u984c\u6839\u6e90\u3002\u5982\u679c\u4f60\u767c\u73fe\u67d0\u500b\u884c\u7a0b\u7684\u8a08\u6578\u7570\u5e38\u504f\u9ad8\uff0c\u90a3\u9ebc\u4f60\u5f88\u53ef\u80fd\u5df2\u7d93\u627e\u5230\u4e86\u554f\u984c\u6240\u5728\u3002<\/p>\n<h3>\u4f7f\u7528 ulimit \u548c\u7cfb\u7d71\u6a94\u6848\u67e5\u770b\u9650\u5236<\/h3>\n<p>\u4f60\u9084\u61c9\u7576\u6aa2\u67e5\u76ee\u524d\u5de5\u4f5c\u968e\u6bb5\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u3002<code>ulimit -n<\/code> \u547d\u4ee4\u6703\u986f\u793a\u5141\u8a31\u958b\u555f\u7684\u6700\u5927\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf\u3002\u5982\u679c\u4f60\u60f3\u8abf\u6574\u76ee\u524d\u5de5\u4f5c\u968e\u6bb5\u7684\u9650\u5236\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>ulimit -n &lt;number&gt;<\/code>\u3002\u5982\u679c\u9700\u8981\u66f4\u7d30\u7dfb\u7684\u63a7\u5236\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>ulimit -Sn &lt;number&gt;<\/code> \u8a2d\u5b9a\u8edf\u9650\u5236\uff0c\u6216\u4f7f\u7528 <code>ulimit -Hn &lt;number&gt;<\/code> \u8a2d\u5b9a\u786c\u9650\u5236\u3002<\/p>\n<p>\u5982\u679c\u4f60\u5e0c\u671b\u6c38\u4e45\u751f\u6548\uff0c\u5c31\u9700\u8981\u7de8\u8f2f\u7cfb\u7d71\u6a94\u6848\u3002\u8acb\u66f4\u65b0 <code>\/etc\/security\/limits.conf<\/code> \u4f86\u8a2d\u5b9a\u4f7f\u7528\u8005\u5c64\u7d1a\u9650\u5236\uff0c\u6216\u66f4\u65b0 <code>\/etc\/systemd\/system.conf<\/code> \u4f86\u8a2d\u5b9a\u670d\u52d9\u5c64\u7d1a\u9650\u5236\u3002\u5728\u4fee\u6539\u7cfb\u7d71\u670d\u52d9\u9650\u5236\u5f8c\uff0c\u8acb\u57f7\u884c <code>systemctl daemon-reload<\/code>\uff0c\u7136\u5f8c\u91cd\u65b0\u555f\u52d5\u5c0d\u61c9\u670d\u52d9\u3002<\/p>\n<p>\u4e0b\u8868\u5c55\u793a\u4e86\u5e38\u898b Linux \u7cfb\u7d71\u4e0a\u7684\u9810\u8a2d\u9650\u5236\uff1a<\/p>\n<div class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 75px;\">\n<colgroup>\n<col style=\"min-width: 25px;\" \/>\n<col style=\"min-width: 25px;\" \/>\n<col style=\"min-width: 25px;\" \/> <\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\u767c\u884c\u7248 \/ \u7cfb\u7d71<\/th>\n<th colspan=\"1\" rowspan=\"1\">\u8edf\u9650\u5236<\/th>\n<th colspan=\"1\" rowspan=\"1\">\u786c\u9650\u5236<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">Home Assistant OS<\/td>\n<td colspan=\"1\" rowspan=\"1\">1024<\/td>\n<td colspan=\"1\" rowspan=\"1\">524288<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">Linux \u7cfb\u7d71<\/td>\n<td colspan=\"1\" rowspan=\"1\">1024<\/td>\n<td colspan=\"1\" rowspan=\"1\">N\/A<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">systemd 240 \u6216\u66f4\u65b0\u7248\u672c<\/td>\n<td colspan=\"1\" rowspan=\"1\">1024<\/td>\n<td colspan=\"1\" rowspan=\"1\">524288<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u5982\u679c\u4f60\u57f7\u884c\u7684\u662f\u5927\u578b\u61c9\u7528\u6216\u591a\u500b\u670d\u52d9\uff0c\u5c31\u61c9\u7576\u6aa2\u67e5\u4e26\u4fee\u6539\u7cfb\u7d71\u9650\u5236\u3002\u9019\u4e00\u6b65\u80fd\u5e6b\u52a9\u4f60\u907f\u514d\u518d\u6b21\u89f8\u53ca\u6a94\u6848\u63cf\u8ff0\u7b26\u4e0a\u9650\u3002<\/p>\n<h2><strong>\u63d0\u9ad8\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236<\/strong><\/h2>\n<p>\u7576\u4f60\u9054\u5230\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\uff0c\u9700\u8981\u8fc5\u901f\u8655\u7406\uff0c\u4ee5\u7dad\u6301\u4f3a\u670d\u5668\u7a69\u5b9a\u3002\u63d0\u9ad8\u9650\u5236\u4e3b\u8981\u6709\u5169\u7a2e\u65b9\u5f0f\uff1a\u4e00\u7a2e\u662f\u66ab\u6642\u63d0\u9ad8\u76ee\u524d\u5de5\u4f5c\u968e\u6bb5\u7684\u9650\u5236\uff0c\u53e6\u4e00\u7a2e\u662f\u6c38\u4e45\u63d0\u9ad8\u6574\u500b\u7cfb\u7d71\u7684\u9650\u5236\u3002\u4f60\u61c9\u6839\u64da\u81ea\u8eab\u9700\u6c42\u4ee5\u53ca\u6240\u57f7\u884c\u61c9\u7528\u7684\u985e\u578b\u9078\u64c7\u5408\u9069\u7684\u65b9\u6cd5\u3002<\/p>\n<h3>\u4f7f\u7528 ulimit \u9032\u884c\u66ab\u6642\u4fee\u6539<\/h3>\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528 <code>ulimit<\/code> \u547d\u4ee4\u4fee\u6539\u76ee\u524d shell \u5de5\u4f5c\u968e\u6bb5\u5141\u8a31\u958b\u555f\u7684\u6700\u5927\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf\u3002\u9019\u7a2e\u65b9\u5f0f\u9069\u5408\u5feb\u901f\u61c9\u6025\uff0c\u4e5f\u9069\u5408\u5728\u6c38\u4e45\u4fee\u6539\u524d\u5148\u505a\u6e2c\u8a66\u3002\u9ad8\u8ca0\u8f09\u74b0\u5883\uff0c\u4f8b\u5982\u7e41\u5fd9\u7684 Web \u4f3a\u670d\u5668\u6216\u8cc7\u6599\u5eab\u4f3a\u670d\u5668\uff0c\u5728\u6d41\u91cf\u9ad8\u5cf0\u6642\u901a\u5e38\u9700\u8981\u66f4\u9ad8\u7684\u9650\u5236\u3002\u5099\u4efd\u5de5\u5177\u3001\u6a94\u6848\u540c\u6b65\u7a0b\u5f0f\u4ee5\u53ca\u5b58\u5728\u6a94\u6848\u63cf\u8ff0\u7b26\u6d29\u6f0f\u7684\u61c9\u7528\uff0c\u4e5f\u90fd\u53ef\u80fd\u5f9e\u66ab\u6642\u63d0\u9ad8\u9650\u5236\u4e2d\u53d7\u76ca\u3002<\/p>\n<p>\u5e38\u898b\u9700\u8981\u63d0\u9ad8\u9650\u5236\u7684\u60c5\u5883\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u64c1\u6709\u5927\u91cf\u5de5\u4f5c\u57f7\u884c\u7dd2\u6216 goroutine \u7684\u61c9\u7528\u7a0b\u5f0f<\/li>\n<li>\u4e00\u6b21\u6027\u958b\u555f\u5927\u91cf socket \u6216\u6a94\u6848\u7684\u7a0b\u5f0f<\/li>\n<li>\u8655\u7406\u9ad8\u6d41\u91cf\u6216\u5927\u91cf\u9023\u7dda\u7684\u4f3a\u670d\u5668<\/li>\n<li>\u672a\u6b63\u78ba\u8f2a\u66ff\u6216\u95dc\u9589\u7684\u65e5\u8a8c\u6a94\u6848<\/li>\n<\/ul>\n<p>\u8981\u67e5\u770b\u76ee\u524d\u9650\u5236\uff0c\u8acb\u57f7\u884c\uff1a<\/p>\n<pre><code>ulimit -n<\/code><\/pre>\n<p>\u8981\u70ba\u76ee\u524d\u5de5\u4f5c\u968e\u6bb5\u8a2d\u5b9a\u65b0\u7684\u9650\u5236\uff0c\u8acb\u4f7f\u7528\uff1a<\/p>\n<pre><code>ulimit -n 65536<\/code><\/pre>\n<p>\u8a72\u547d\u4ee4\u6703\u5c07\u76ee\u524d shell \u7684\u5df2\u958b\u555f\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf\u9650\u5236\u8a2d\u5b9a\u70ba 65,536\u3002\u5982\u679c\u4f60\u95dc\u9589 shell \u6216\u91cd\u65b0\u555f\u52d5\u4f3a\u670d\u5668\uff0c\u9650\u5236\u6703\u6062\u5fa9\u70ba\u9810\u8a2d\u503c\u3002\u82e5\u8981\u8a2d\u5b9a\u975e\u5e38\u9ad8\u7684\u6578\u503c\uff0c\u53ef\u80fd\u9700\u8981\u8d85\u7d1a\u4f7f\u7528\u8005\u6b0a\u9650\u3002<\/p>\n<p>\u5982\u679c\u8a2d\u5b9a\u5f97\u904e\u4f4e\uff0c\u4f60\u53ef\u80fd\u6703\u770b\u5230\u8af8\u5982 Nginx \u62d2\u7d55\u65b0\u9023\u7dda\u3001MongoDB \u7121\u6cd5\u8b80\u5beb\u8cc7\u6599\u4e4b\u985e\u7684\u932f\u8aa4\u3002\u5176\u4ed6\u61c9\u7528\u7a0b\u5f0f\u4e5f\u53ef\u80fd\u56e0\u7121\u6cd5\u958b\u555f\u8db3\u5920\u591a\u7684\u6a94\u6848\u800c\u505c\u6b62\u904b\u4f5c\u3002<\/p>\n<h3>\u5728 sysctl.conf \u548c limits.conf \u4e2d\u9032\u884c\u6c38\u4e45\u4fee\u6539<\/h3>\n<p>\u82e5\u8981\u7372\u5f97\u9577\u671f\u89e3\u6c7a\u65b9\u6848\uff0c\u4f60\u61c9\u7576\u66f4\u65b0\u7cfb\u7d71\u8a2d\u5b9a\u6a94\u3002<code>sysctl.conf<\/code> \u6a94\u6848\u63a7\u5236\u7cfb\u7d71\u7bc4\u570d\u5167\u7684\u6a94\u6848\u63a7\u5236\u4ee3\u78bc\u9650\u5236\u3002\u53c3\u6578 <code>fs.file-max<\/code> \u7528\u65bc\u8a2d\u5b9a\u6838\u5fc3\u53ef\u4f7f\u7528\u7684\u6700\u5927\u6a94\u6848\u63a7\u5236\u4ee3\u78bc\u6578\u91cf\u3002\u5c0d\u65bc\u57f7\u884c\u5927\u91cf\u61c9\u7528\u7a0b\u5f0f\u6216\u540c\u6642\u8655\u7406\u5927\u91cf\u4f7f\u7528\u8005\u7684\u4f3a\u670d\u5668\u4f86\u8aaa\uff0c\u9019\u500b\u8a2d\u5b9a\u5c24\u5176\u91cd\u8981\u3002<\/p>\n<p>\u5982\u679c\u4f60\u4e0d\u63d0\u9ad8\u7cfb\u7d71\u7bc4\u570d\u7684\u9650\u5236\uff0c\u53ef\u80fd\u6703\u770b\u5230\u300cToo many open files\u300d\u4e4b\u985e\u7684\u932f\u8aa4\u3002\u9019\u4e9b\u932f\u8aa4\u53ef\u80fd\u5f15\u767c\u7a0b\u5f0f\u5d29\u6f70\u8207\u670d\u52d9\u4e2d\u65b7\u3002\u4f60\u9084\u61c9\u66f4\u65b0 <code>\/etc\/security\/limits.conf<\/code> \u4f86\u8a2d\u5b9a\u4f7f\u7528\u8005\u5c64\u7d1a\u9650\u5236\u3002\u9019\u500b\u6a94\u6848\u5141\u8a31\u4f60\u63a7\u5236\u6bcf\u500b\u4f7f\u7528\u8005\u6216\u7fa4\u7d44\u80fd\u5920\u958b\u555f\u591a\u5c11\u6a94\u6848\u3002<\/p>\n<p>\u8981\u4fee\u6539\u7cfb\u7d71\u7bc4\u570d\u9650\u5236\uff0c\u8acb\u5728 <code>\/etc\/sysctl.conf<\/code> \u4e2d\u52a0\u5165\u4ee5\u4e0b\u5167\u5bb9\uff1a<\/p>\n<pre><code>fs.file-max = 100000<\/code><\/pre>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5957\u7528\u8b8a\u66f4\uff1a<\/p>\n<pre><code>sudo sysctl -p<\/code><\/pre>\n<p>\u8981\u8a2d\u5b9a\u4f7f\u7528\u8005\u9650\u5236\uff0c\u8acb\u5728 <code>\/etc\/security\/limits.conf<\/code> \u4e2d\u52a0\u5165\u5982\u4e0b\u5167\u5bb9\uff1a<\/p>\n<pre><code>* soft nofile 65536\r\n* hard nofile 65536<\/code><\/pre>\n<p>\u661f\u865f\uff08<code>*<\/code>\uff09\u8868\u793a\u8a72\u898f\u5247\u9069\u7528\u65bc\u6240\u6709\u4f7f\u7528\u8005\u3002\u5982\u679c\u4f60\u9858\u610f\uff0c\u4e5f\u53ef\u4ee5\u5c07\u5176\u66ff\u63db\u70ba\u67d0\u500b\u5177\u9ad4\u4f7f\u7528\u8005\u540d\u7a31\u3002\u8edf\u9650\u5236\u662f shell \u9810\u8a2d\u4f7f\u7528\u7684\u503c\uff0c\u786c\u9650\u5236\u5247\u662f\u4f60\u53ef\u8a2d\u5b9a\u7684\u6700\u5927\u503c\u3002\u4fee\u6539\u5f8c\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u767b\u51fa\u4e26\u91cd\u65b0\u767b\u5165\uff0c\u624d\u80fd\u8b93\u9019\u4e9b\u8b8a\u66f4\u751f\u6548\u3002<\/p>\n<h3>\u70ba systemd \u670d\u52d9\u5957\u7528\u8b8a\u66f4<\/h3>\n<p>\u8a31\u591a\u73fe\u4ee3 Linux \u7cfb\u7d71\u4f7f\u7528 systemd \u4f86\u7ba1\u7406\u670d\u52d9\u3002\u8981\u66f4\u6539\u9019\u4e9b\u670d\u52d9\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\uff0c\u4f60\u5fc5\u9808\u66f4\u65b0\u670d\u52d9\u8a2d\u5b9a\u3002\u8acb\u4f9d\u7167\u4ee5\u4e0b\u6b65\u9a5f\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u70ba\u4f60\u7684\u670d\u52d9\u5efa\u7acb\u4e00\u500b\u8986\u5beb\u8a2d\u5b9a\u6a94\uff1a\n<pre><code>sudo systemctl edit your-service-name.service<\/code><\/pre>\n<\/li>\n<li>\u5728 <code>[Service]<\/code> \u5340\u6bb5\u4e0b\u52a0\u5165\u9019\u4e00\u884c\uff1a\n<pre><code>LimitNOFILE=65536<\/code><\/pre>\n<\/li>\n<li>\u91cd\u65b0\u8f09\u5165 systemd \u5e38\u99d0\u7a0b\u5f0f\uff1a\n<pre><code>sudo systemctl daemon-reload<\/code><\/pre>\n<\/li>\n<li>\u91cd\u65b0\u555f\u52d5\u4f60\u7684\u670d\u52d9\uff1a\n<pre><code>sudo systemctl restart your-service-name.service<\/code><\/pre>\n<\/li>\n<li>\u6aa2\u67e5\u65b0\u7684\u9650\u5236\u662f\u5426\u5df2\u7d93\u751f\u6548\u3002\u5148\u627e\u5230\u4e3b\u884c\u7a0b ID\uff1a\n<pre><code>systemctl status your-service-name.service<\/code><\/pre>\n<p>\u7136\u5f8c\u57f7\u884c\uff1a<\/p>\n<pre><code>cat \/proc\/[PID]\/limits | grep \"Max open files\"<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528 <code>systemd-delta --type=extended<\/code> \u4f86\u78ba\u8a8d\u8b8a\u66f4\u662f\u5426\u5df2\u751f\u6548\u3002\u547d\u4ee4 <code>systemctl status your-service-name.service<\/code> \u4e5f\u6703\u986f\u793a\u76ee\u524d\u8a2d\u5b9a\u3002<\/p>\n<blockquote><p><strong>\u63d0\u793a\uff1a<\/strong>\u6bcf\u6b21\u4fee\u6539\u5f8c\u90fd\u8981\u91cd\u65b0\u8f09\u5165 systemd \u5e38\u99d0\u7a0b\u5f0f\u3002\u4e26\u4e14\u8981\u91cd\u65b0\u555f\u52d5\u670d\u52d9\uff0c\u65b0\u7684\u8a2d\u5b9a\u624d\u6703\u771f\u6b63\u5957\u7528\u3002<\/p><\/blockquote>\n<p>\u900f\u904e\u9019\u4e9b\u6b65\u9a5f\uff0c\u4f60\u53ef\u4ee5\u63a7\u5236\u61c9\u7528\u7a0b\u5f0f\u80fd\u5920\u4f7f\u7528\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf\u3002\u9019\u6709\u52a9\u65bc\u907f\u514d\u670d\u52d9\u6545\u969c\uff0c\u4e26\u7dad\u6301\u4f3a\u670d\u5668\u5e73\u7a69\u904b\u4f5c\u3002<\/p>\n<h2><strong>\u9632\u6b62\u6a94\u6848\u63cf\u8ff0\u7b26\u8017\u76e1<\/strong><\/h2>\n<h3>\u4f7f\u7528 Netdata \u6216 Zabbix \u9032\u884c\u76e3\u63a7<\/h3>\n<p>\u4f60\u53ef\u4ee5\u900f\u904e\u4f7f\u7528\u5177\u5099\u5373\u6642\u8cc7\u6599\u548c\u8b66\u793a\u80fd\u529b\u7684\u76e3\u63a7\u5de5\u5177\uff0c\u4f86\u9632\u6b62\u6a94\u6848\u63cf\u8ff0\u7b26\u8017\u76e1\u3002Netdata \u548c Zabbix \u90fd\u53ef\u4ee5\u5e6b\u52a9\u4f60\u8ffd\u8e64\u5df2\u958b\u555f\u7684\u6a94\u6848\u548c socket\uff0c\u800c\u7121\u9700\u624b\u52d5\u53cd\u8986\u6aa2\u67e5\u3002\u9019\u4e9b\u5de5\u5177\u80fd\u8b93\u4f60\u5728\u554f\u984c\u5f71\u97ff\u4f7f\u7528\u8005\u4e4b\u524d\u5c31\u53ca\u6642\u767c\u73fe\u7570\u5e38\u3002<\/p>\n<div class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 50px;\">\n<colgroup>\n<col style=\"min-width: 25px;\" \/>\n<col style=\"min-width: 25px;\" \/> <\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\u5de5\u5177<\/th>\n<th colspan=\"1\" rowspan=\"1\">\u512a\u52e2<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">Netdata<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u96f6\u8a2d\u5b9a\u5373\u53ef\u7372\u5f97\u5373\u6642\u6d1e\u5bdf\uff0c\u4e26\u652f\u63f4\u6309\u79d2\u7d1a\u8490\u96c6\u8cc7\u6599\u3002<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">Zabbix<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u76e3\u63a7\u80fd\u529b\u5168\u9762\uff0c\u5177\u5099\u5f37\u5927\u7684\u6b77\u53f2\u8cc7\u6599\u5132\u5b58\u8207\u53ef\u81ea\u8a02\u8b66\u793a\u529f\u80fd\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Netdata \u63d0\u4f9b\u5373\u6642\u53ef\u8996\u6027\uff0c\u56e0\u6b64\u4f60\u53ef\u4ee5\u5728\u8b8a\u5316\u767c\u751f\u6642\u7acb\u5373\u770b\u5230\u3002Zabbix \u5247\u652f\u63f4\u76e3\u63a7\u5927\u91cf\u88dd\u7f6e\u8207\u61c9\u7528\uff0c\u4e26\u80fd\u4fdd\u5b58\u8cc7\u6599\u7528\u65bc\u9577\u671f\u5206\u6790\u3002\u5169\u8005\u90fd\u80fd\u6e1b\u5c11\u4f60\u5728\u624b\u52d5\u76e3\u63a7\u4e0a\u82b1\u8cbb\u7684\u6642\u9593\u8207\u7cbe\u529b\u3002\u4f60\u9084\u53ef\u4ee5\u8a2d\u5b9a\u8b66\u793a\uff0c\u5728\u4f7f\u7528\u91cf\u63a5\u8fd1\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\u63d0\u524d\u6536\u5230\u901a\u77e5\u3002<\/p>\n<blockquote><p><strong>\u63d0\u793a\uff1a<\/strong>\u81ea\u52d5\u5316\u76e3\u63a7\u80fd\u8b93\u4f60\u5728\u5c08\u6ce8\u5176\u4ed6\u5de5\u4f5c\u7684\u540c\u6642\uff0c\u4f9d\u7136\u6709\u4fe1\u5fc3\u53ca\u65e9\u767c\u73fe\u554f\u984c\u3002<\/p><\/blockquote>\n<h3>\u6700\u4f73\u5316\u65e5\u8a8c\u8207\u61c9\u7528\u7a0b\u5f0f\u8a2d\u5b9a<\/h3>\n<p>\u4f60\u61c9\u7576\u6aa2\u67e5\u61c9\u7528\u7a0b\u5f0f\u8a2d\u5b9a\uff0c\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u5360\u7528\u3002\u5f88\u591a\u61c9\u7528\u6703\u56e0\u70ba\u65e5\u8a8c\u8a18\u9304\u3001\u7db2\u8def\u9023\u7dda\u6216\u5feb\u53d6\u6a5f\u5236\u800c\u958b\u555f\u6a94\u6848\u6216 socket\u3002\u5982\u679c\u4e0d\u5c0d\u9019\u4e9b\u8a2d\u5b9a\u9032\u884c\u6700\u4f73\u5316\uff0c\u5c31\u53ef\u80fd\u9047\u5230\u300cToo many open files\u300d\u4e4b\u985e\u7684\u932f\u8aa4\u3002<\/p>\n<div class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 50px;\">\n<colgroup>\n<col style=\"min-width: 25px;\" \/>\n<col style=\"min-width: 25px;\" \/> <\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\u53c3\u6578<\/th>\n<th colspan=\"1\" rowspan=\"1\">\u8aaa\u660e<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\u6a94\u6848\u63cf\u8ff0\u7b26<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u6bcf\u500b socket \u9023\u7dda\u90fd\u6703\u5360\u7528\u4e00\u500b\u6a94\u6848\u63cf\u8ff0\u7b26\u3002\u5408\u7406\u8abf\u6821\u9019\u4e00\u6578\u503c\u53ef\u63d0\u5347\u53ef\u7528\u6027\u3002<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">Accept Backlog<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u63a7\u5236\u6709\u591a\u5c11\u500b TCP \u9023\u7dda\u53ef\u4ee5\u5728\u4f47\u5217\u4e2d\u7b49\u5f85\u8655\u7406\u3002\u8a2d\u5b9a\u8a72\u503c\u6709\u52a9\u65bc\u7ba1\u7406\u8ca0\u8f09\u3002<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">Socket Health Check<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u900f\u904e\u8abf\u6574\u5065\u5eb7\u6aa2\u67e5\u903e\u6642\uff0c\u53ea\u4fdd\u7559\u5065\u5eb7\u9023\u7dda\uff0c\u6e1b\u5c11\u8cc7\u6e90\u6d6a\u8cbb\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u4f60\u61c9\u7576\u5728\u8b80\u53d6\u6216\u5beb\u5165\u8a2d\u5b9a\u6a94\u5f8c\u7acb\u5373\u95dc\u9589\u6a94\u6848\u63cf\u8ff0\u7b26\u3002\u76e1\u91cf\u5c07\u5df2\u958b\u555f\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf\u4fdd\u6301\u5728 50 \u4ee5\u4e0b\u3002\u5b9a\u671f\u91cd\u65b0\u555f\u52d5\u61c9\u7528\u7a0b\u5f0f\uff0c\u6709\u52a9\u65bc\u6e05\u7406\u672a\u4f7f\u7528\u7684\u8cc7\u6e90\u3002\u9084\u8981\u59cb\u7d42\u6aa2\u67e5 <code>ulimit<\/code> \u8a2d\u5b9a\uff0c\u78ba\u4fdd\u61c9\u7528\u7a0b\u5f0f\u80fd\u5920\u627f\u53d7\u9810\u671f\u8ca0\u8f09\u3002<\/p>\n<h3>\u5b9a\u671f\u6aa2\u8996\u8207\u5718\u968a\u610f\u8b58\u5efa\u7acb<\/h3>\n<p>\u4f60\u53ef\u4ee5\u628a\u5b9a\u671f\u7a3d\u6838\u7d0d\u5165\u65e5\u5e38\u6d41\u7a0b\uff0c\u4ee5\u9632\u6b62\u672a\u4f86\u518d\u6b21\u51fa\u73fe\u554f\u984c\u3002\u7d93\u5e38\u6aa2\u67e5\u4f3a\u670d\u5668\u8cc7\u6e90\u4f7f\u7528\u60c5\u6cc1\u548c\u8a2d\u5b9a\u6a94\u3002\u5c0d\u4f3a\u670d\u5668\u9032\u884c\u58d3\u529b\u6e2c\u8a66\uff0c\u4e86\u89e3\u5176\u6975\u9650\u4e26\u70ba\u672a\u4f86\u6210\u9577\u505a\u597d\u898f\u5283\u3002\u4f7f\u7528\u9650\u6d41\u6a5f\u5236\u4f86\u63a7\u5236\u4f3a\u670d\u5668\u63a5\u53d7\u7684\u8acb\u6c42\u6578\u91cf\u3002<\/p>\n<ul>\n<li>\u8a13\u7df4\u5718\u968a\u638c\u63e1\u8cc7\u6e90\u7ba1\u7406\u6a21\u5f0f\u3002<\/li>\n<li>\u5206\u4eab\u8207\u8cc7\u6e90\u6d29\u6f0f\u76f8\u95dc\u4e8b\u6545\u7684\u4e8b\u5f8c\u6aa2\u8a0e\u8207\u5fa9\u76e4\u7e3d\u7d50\u3002<\/li>\n<li>\u5c07\u8cc7\u6e90\u7ba1\u7406\u7d0d\u5165\u7de8\u78bc\u898f\u7bc4\u3002<\/li>\n<li>\u70ba\u9ad8\u98a8\u96aa\u7a0b\u5f0f\u78bc\u5340\u57df\u5236\u5b9a\u6aa2\u67e5\u6e05\u55ae\u3002<\/li>\n<\/ul>\n<blockquote><p>\u5b9a\u671f\u6aa2\u8996\u548c\u5718\u968a\u8a13\u7df4\u80fd\u5e6b\u52a9\u6bcf\u500b\u4eba\u5728\u554f\u984c\u8b8a\u5f97\u56b4\u91cd\u4e4b\u524d\uff0c\u5c31\u53ca\u6642\u767c\u73fe\u4e26\u4fee\u5fa9\u5b83\u5011\u3002<\/p><\/blockquote>\n<div class=\"qc-divider-wrapper\">\n<div class=\"qc-divider\" style=\"border-top-style: solid; width: 100%; border-top-color: #d1d1d1;\"><\/div>\n<\/div>\n<p>\u4f60\u53ef\u4ee5\u900f\u904e\u4ee5\u4e0b\u6b65\u9a5f\u89e3\u6c7a\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u554f\u984c\uff1a<\/p>\n<ol>\n<li>\u4ee5\u9810\u671f\u5c16\u5cf0\u8ca0\u8f09\u7684\u5169\u500d\u5c0d\u4f3a\u670d\u5668\u9032\u884c\u6e2c\u8a66\u3002<\/li>\n<li>\u76e3\u63a7\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf\u548c TCP \u72c0\u614b\u3002<\/li>\n<li>\u5728\u4f3a\u670d\u5668\u521d\u59cb\u90e8\u7f72\u6642\u5c31\u8a2d\u5b9a\u597d <code>ulimits<\/code>\u3002<\/li>\n<\/ol>\n<p>\u5c0d\u65bc\u9ad8\u4f75\u767c\u4f3a\u670d\u5668\uff0c\u8acb\u6301\u7e8c\u95dc\u6ce8\u5404\u9805\u6307\u6a19\uff0c\u4e26\u8b39\u614e\u8abf\u6574\u9650\u5236\u3002\u5982\u679c\u8a2d\u5b9a\u904e\u9ad8\uff0c\u53ef\u80fd\u6703\u5e36\u4f86\u7cfb\u7d71\u4e0d\u7a69\u5b9a\u7684\u98a8\u96aa\u3002<\/p>\n<div class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 50px;\">\n<colgroup>\n<col style=\"min-width: 25px;\" \/>\n<col style=\"min-width: 25px;\" \/> <\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\u6700\u4f73\u5be6\u52d9<\/th>\n<th colspan=\"1\" rowspan=\"1\">\u547d\u4ee4\u7bc4\u4f8b<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\u63d0\u9ad8\u6a94\u6848\u63cf\u8ff0\u7b26\u6578\u91cf<\/td>\n<td colspan=\"1\" rowspan=\"1\"><code>echo \"* soft nofile 1000000\" &gt;&gt; \/etc\/security\/limits.conf<\/code><\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\u63d0\u9ad8\u7cfb\u7d71\u7bc4\u570d\u9650\u5236<\/td>\n<td colspan=\"1\" rowspan=\"1\"><code>echo \"fs.file-max = 2000000\" &gt;&gt; \/etc\/sysctl.conf<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u4fdd\u6301\u4e3b\u52d5\u9810\u9632\uff0c\u4e26\u6301\u7e8c\u5b78\u7fd2\uff0c\u624d\u80fd\u66f4\u597d\u5730\u5b88\u8b77\u4f3a\u670d\u5668\u7684\u5065\u5eb7\u904b\u4f5c\u3002<\/p>\n<h2><strong>\u5e38\u898b\u554f\u984c<\/strong><\/h2>\n<h3>\u4ec0\u9ebc\u662f\u6a94\u6848\u63cf\u8ff0\u7b26\uff1f<\/h3>\n<p>\u6a94\u6848\u63cf\u8ff0\u7b26\u662f\u4f5c\u696d\u7cfb\u7d71\u7528\u4f86\u8ffd\u8e64\u5df2\u958b\u555f\u6a94\u6848\u3001socket \u6216 pipe \u7684\u4e00\u500b\u6578\u5b57\u8b58\u5225\u3002\u6bcf\u500b\u57f7\u884c\u4e2d\u7684\u884c\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u4e00\u7d44\u6a94\u6848\u63cf\u8ff0\u7b26\u3002<\/p>\n<h3>\u6211\u8981\u600e\u9ebc\u77e5\u9053\u4f3a\u670d\u5668\u662f\u5426\u9054\u5230\u4e86\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\uff1f<\/h3>\n<p>\u4f60\u53ef\u80fd\u6703\u5728\u65e5\u8a8c\u4e2d\u770b\u5230\u300cToo many open files\u300d\u9019\u6a23\u7684\u932f\u8aa4\u3002\u4f7f\u7528 <code>lsof<\/code> \u6216 <code>ulimit -n<\/code> \u53ef\u4ee5\u6aa2\u67e5\u76ee\u524d\u4f7f\u7528\u60c5\u6cc1\u8207\u9650\u5236\u503c\u3002<\/p>\n<h3>\u6211\u53ef\u4ee5\u5728\u4e0d\u91cd\u65b0\u555f\u52d5\u4f3a\u670d\u5668\u7684\u60c5\u6cc1\u4e0b\u63d0\u9ad8\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u55ce\uff1f<\/h3>\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528 <code>ulimit -n &lt;number&gt;<\/code> \u63d0\u9ad8\u76ee\u524d\u5de5\u4f5c\u968e\u6bb5\u7684\u9650\u5236\u3002\u82e5\u8981\u6c38\u4e45\u751f\u6548\uff0c\u5247\u5fc5\u9808\u66f4\u65b0\u7cfb\u7d71\u6a94\u6848\uff0c\u4e26\u91cd\u65b0\u555f\u52d5\u53d7\u5f71\u97ff\u7684\u670d\u52d9\u3002<\/p>\n<h3>\u662f\u4ec0\u9ebc\u5c0e\u81f4\u6a94\u6848\u63cf\u8ff0\u7b26\u6d29\u6f0f\uff1f<\/h3>\n<p>\u61c9\u7528\u7a0b\u5f0f\u53ef\u80fd\u6c92\u6709\u6b63\u78ba\u95dc\u9589\u6a94\u6848\u6216 socket\u3002\u4e0d\u826f\u7684\u65e5\u8a8c\u8655\u7406\u65b9\u5f0f\u6216\u7a0b\u5f0f\u78bc\u4e2d\u7684\u7f3a\u9677\uff0c\u901a\u5e38\u90fd\u6703\u5c0e\u81f4\u6d29\u6f0f\u3002\u5b9a\u671f\u76e3\u63a7\u6709\u52a9\u65bc\u4f60\u53ca\u65e9\u767c\u73fe\u9019\u4e9b\u554f\u984c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7576\u4f3a\u670d\u5668\u9054\u5230\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\uff0c\u4f60\u7684\u7cfb\u7d71\u5f80\u5f80\u6703\u7acb\u523b\u51fa\u73fe\u554f\u984c\u3002\u4f60\u53ef\u80fd\u6703\u6ce8\u610f\u5230 CPU \u4f7f\u7528\u7387\u5347\u9ad8\u3001\u9023\u7dda\u5931\u6557\uff0c\u6216\u8005\u51fa [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":2,"featured_media":33495,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[4815],"tags":[12333,12334,8384,4849],"class_list":["post-33498","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-america-dedicated-server-tc","tag-file-descriptor-limit","tag-ulimit-configuration","tag-linux-server-optimization-tc","tag-us-hosting-tc"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u7576\u9054\u5230\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\u8a72\u600e\u9ebc\u8fa6<\/title>\n<meta name=\"description\" content=\"\u900f\u904e\u8b58\u5225\u5360\u7528\u8cc7\u6e90\u8f03\u591a\u7684\u884c\u7a0b\u3001\u91cb\u653e\u6a94\u6848\u63cf\u8ff0\u7b26\u4e26\u63d0\u9ad8\u9650\u5236\uff0c\u89e3\u6c7a\u4f3a\u670d\u5668\u4e0a\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u554f\u984c\uff0c\u4ee5\u7dad\u6301\u904b\u4f5c\u7a69\u5b9a\u3002\" \/>\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.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/33498\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"company\" \/>\n<meta property=\"og:title\" content=\"\u7576\u9054\u5230\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\u8a72\u600e\u9ebc\u8fa6\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/33498\" \/>\n<meta property=\"og:site_name\" content=\"\u65b0\u5929\u57df\u4e92\u806f\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-20T04:13:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-20T04:16:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.simcentric.com\/wp-content\/uploads\/2026\/07\/sim-blog-2026-07-20-blogB.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"613\" \/>\n\t<meta property=\"og:image:height\" content=\"331\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u7576\u9054\u5230\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\u8a72\u600e\u9ebc\u8fa6","description":"\u900f\u904e\u8b58\u5225\u5360\u7528\u8cc7\u6e90\u8f03\u591a\u7684\u884c\u7a0b\u3001\u91cb\u653e\u6a94\u6848\u63cf\u8ff0\u7b26\u4e26\u63d0\u9ad8\u9650\u5236\uff0c\u89e3\u6c7a\u4f3a\u670d\u5668\u4e0a\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u554f\u984c\uff0c\u4ee5\u7dad\u6301\u904b\u4f5c\u7a69\u5b9a\u3002","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.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/33498","og_locale":"zh_TW","og_type":"company","og_title":"\u7576\u9054\u5230\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\u8a72\u600e\u9ebc\u8fa6","og_url":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/33498","og_site_name":"\u65b0\u5929\u57df\u4e92\u806f","article_published_time":"2026-07-20T04:13:34+00:00","article_modified_time":"2026-07-20T04:16:16+00:00","og_image":[{"width":613,"height":331,"url":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2026\/07\/sim-blog-2026-07-20-blogB.jpg","type":"image\/jpeg"}],"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/#article","isPartOf":{"@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/"},"author":{"name":"Debbie Ng","@id":"https:\/\/simcentric.com\/tc\/#\/schema\/person\/0bfc8768eb7caacbfab4a0855d805626"},"headline":"\u7576\u9054\u5230\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\u8a72\u600e\u9ebc\u8fa6","datePublished":"2026-07-20T04:13:34+00:00","dateModified":"2026-07-20T04:16:16+00:00","mainEntityOfPage":{"@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/"},"wordCount":138,"publisher":{"@id":"https:\/\/simcentric.com\/tc\/#organization"},"image":{"@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/#primaryimage"},"thumbnailUrl":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2026\/07\/sim-blog-2026-07-20-blogB.jpg","keywords":["\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236","ulimit\u8a2d\u5b9a","Linux\u4f3a\u670d\u5668\u512a\u5316","\u7f8e\u570b\u4f3a\u670d\u5668\u79df\u7528"],"articleSection":["\u7f8e\u570b\u4f3a\u670d\u5668"],"inLanguage":"zh-HK"},{"@type":"WebPage","@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/","url":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/","name":"\u7576\u9054\u5230\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\u8a72\u600e\u9ebc\u8fa6","isPartOf":{"@id":"https:\/\/simcentric.com\/tc\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/#primaryimage"},"image":{"@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/#primaryimage"},"thumbnailUrl":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2026\/07\/sim-blog-2026-07-20-blogB.jpg","datePublished":"2026-07-20T04:13:34+00:00","dateModified":"2026-07-20T04:16:16+00:00","description":"\u900f\u904e\u8b58\u5225\u5360\u7528\u8cc7\u6e90\u8f03\u591a\u7684\u884c\u7a0b\u3001\u91cb\u653e\u6a94\u6848\u63cf\u8ff0\u7b26\u4e26\u63d0\u9ad8\u9650\u5236\uff0c\u89e3\u6c7a\u4f3a\u670d\u5668\u4e0a\u7684\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u554f\u984c\uff0c\u4ee5\u7dad\u6301\u904b\u4f5c\u7a69\u5b9a\u3002","breadcrumb":{"@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/#breadcrumb"},"inLanguage":"zh-HK","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/"]}]},{"@type":"ImageObject","inLanguage":"zh-HK","@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/#primaryimage","url":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2026\/07\/sim-blog-2026-07-20-blogB.jpg","contentUrl":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2026\/07\/sim-blog-2026-07-20-blogB.jpg","width":613,"height":331,"caption":"\u4f3a\u670d\u5668\u9054\u5230\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236"},{"@type":"BreadcrumbList","@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/what-to-do-when-the-file-descriptor-limit-is-reached\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.simcentric.com\/tc\/"},{"@type":"ListItem","position":2,"name":"\u7576\u9054\u5230\u6a94\u6848\u63cf\u8ff0\u7b26\u9650\u5236\u6642\u8a72\u600e\u9ebc\u8fa6"}]},{"@type":"WebSite","@id":"https:\/\/simcentric.com\/tc\/#website","url":"https:\/\/simcentric.com\/tc\/","name":"Simcentric Solutions","description":"","publisher":{"@id":"https:\/\/simcentric.com\/tc\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/simcentric.com\/tc\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-HK"},{"@type":"Organization","@id":"https:\/\/simcentric.com\/tc\/#organization","name":"Simcentric Solutions","url":"https:\/\/simcentric.com\/tc\/","logo":{"@type":"ImageObject","inLanguage":"zh-HK","@id":"https:\/\/simcentric.com\/tc\/#\/schema\/logo\/image\/","url":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2023\/06\/sim-logo-2023.png","contentUrl":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2023\/06\/sim-logo-2023.png","width":800,"height":222,"caption":"Simcentric Solutions"},"image":{"@id":"https:\/\/simcentric.com\/tc\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/simcentric.com\/tc\/#\/schema\/person\/0bfc8768eb7caacbfab4a0855d805626","name":"Debbie Ng","image":{"@type":"ImageObject","inLanguage":"zh-HK","@id":"https:\/\/secure.gravatar.com\/avatar\/9f3420f60d27329ed6e921ddaae5206353d0a7414d1abb6f1f0b32b4fd849965?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9f3420f60d27329ed6e921ddaae5206353d0a7414d1abb6f1f0b32b4fd849965?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9f3420f60d27329ed6e921ddaae5206353d0a7414d1abb6f1f0b32b4fd849965?s=96&d=mm&r=g","caption":"Debbie Ng"}}]}},"_links":{"self":[{"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/33498","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/comments?post=33498"}],"version-history":[{"count":2,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/33498\/revisions"}],"predecessor-version":[{"id":33501,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/33498\/revisions\/33501"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/media\/33495"}],"wp:attachment":[{"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/media?parent=33498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/categories?post=33498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/tags?post=33498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}