{"id":204803,"date":"2020-11-18T08:17:56","date_gmt":"2020-11-18T00:17:56","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=204803"},"modified":"2020-11-05T16:18:40","modified_gmt":"2020-11-05T08:18:40","slug":"linux-average-load","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-average-load.html","title":{"rendered":"Linux\u5e73\u5747\u8d1f\u8f7d\u641e\u901a\u900f\uff01"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u5e73\u5747\u8d1f\u8f7d\u53ef\u4ee5\u5bf9\u4e8e\u6211\u4eec\u6765\u8bf4\u53ca\u719f\u6089\u53c8\u964c\u751f\uff0c\u4f46\u6211\u4eec\u95ee\u5e73\u5747\u8d1f\u8f7d\u662f\u4ec0\u4e48\uff0c\u4f46\u5927\u90e8\u5206\u4eba\u90fd\u56de\u7b54\u8bf4\u5e73\u5747\u8d1f\u8f7d\u4e0d\u5c31\u662f\u5355\u4f4d\u65f6\u95f4\u5185CPU\u4f7f\u7528\u7387\u5417\uff1f\u5176\u5b9e\u5e76\u4e0d\u662f\u8fd9\u6837\u7684\uff0c\u5982\u679c\u53ef\u4ee5\u7684\u8bdd\uff0c\u53ef\u4ee5 man uptime \u6765\u4e86\u89e3\u4e00\u4e0b\u5e73\u5747\u8d1f\u8f7d\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u4ec0\u4e48\u662f\u5e73\u5747\u8d1f\u8f7d<\/strong><\/div>\n \u5e73\u5747\u8d1f\u8f7d\u53ef\u4ee5\u5bf9\u4e8e\u6211\u4eec\u6765\u8bf4\u53ca\u719f\u6089\u53c8\u964c\u751f\uff0c\u4f46\u6211\u4eec\u95ee\u5e73\u5747\u8d1f\u8f7d\u662f\u4ec0\u4e48\uff0c\u4f46\u5927\u90e8\u5206\u4eba\u90fd\u56de\u7b54\u8bf4\u5e73\u5747\u8d1f\u8f7d\u4e0d\u5c31\u662f\u5355\u4f4d\u65f6\u95f4\u5185CPU\u4f7f\u7528\u7387\u5417\uff1f\u5176\u5b9e\u5e76\u4e0d\u662f\u8fd9\u6837\u7684\uff0c\u5982\u679c\u53ef\u4ee5\u7684\u8bdd\uff0c\u53ef\u4ee5 man uptime \u6765\u4e86\u89e3\u4e00\u4e0b\u5e73\u5747\u8d1f\u8f7d\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n \u7b80\u5355\u7684\u8bf4\u5e73\u5747\u8d1f\u8f7d\u662f\u6307\u5355\u4f4d\u65f6\u95f4\u5185\uff0c\u7cfb\u7edf\u5904\u4e8e\u53ef\u8fd0\u884c\u72b6\u6001\u548c\u4e0d\u53ef\u4e2d\u65ad\u72b6\u6001\u7684\u5e73\u5747\u8fdb\u7a0b\u6570\uff0c\u4e5f\u5c31\u662f\u8bf4\u5e73\u5747\u6d3b\u8dc3\u8fdb\u7a0b\u6570\uff0c\u5b83\u548cCPU\u4f7f\u7528\u7387\u5e76\u6ca1\u6709\u76f4\u63a5\u5173\u7cfb\u3002\u8fd9\u91cc\u89e3\u91ca\u4e00\u4e0b\u53ef\u8fd0\u884c\u72b6\u6001\u548c\u4e0d\u53ef\u4e2d\u65ad\u8fd9\u4e24\u4e2a\u8bcd\u3002<\/p>\n <\/p>\n \u53ef\u8fd0\u884c\u72b6\u6001\uff1a<\/strong><\/span><\/div>\n \u6307\u6b63\u5728\u4f7f\u7528CPU\u6216\u8005\u6b63\u5728\u7b49\u5f85CPU\u7684\u8fdb\u7a0b\uff0c\u6211\u4eec\u4f7f\u7528ps\u547d\u4ee4\u67e5\u770b\u5904\u4e8eR\u72b6\u6001\u7684\u8fdb\u7a0b<\/p>\n \u4e0d\u53ef\u4e2d\u65ad\u72b6\u6001\uff1a<\/strong><\/span><\/div>\n \u8fdb\u7a0b\u5219\u662f\u6b63\u5904\u4e8e\u5185\u6838\u6001\u5173\u952e\u6d41\u7a0b\u4e2d\u7684\u8fdb\u7a0b\uff0c\u5e76\u4e14\u8fd9\u4e9b\u6d41\u7a0b\u662f\u4e0d\u53ef\u4e2d\u65ad\u7684\u3002\u4f8b\u5982\uff1a\u5e38\u89c1\u7684\u7b49\u5f85\u786c\u4ef6\u8bbe\u5907I\/O\u7684\u54cd\u5e94\uff0c\u4e5f\u5c31\u662f\u6211\u4eec\u5728ps\u547d\u4ee4\u67e5\u770b\u5904\u4e8eD\u72b6\u6001\u7684\u8fdb\u7a0b<\/p>\n \u6bd4\u5982\uff0c\u5f53\u4e00\u4e2a\u8fdb\u7a0b\u5411\u78c1\u76d8\u8bfb\u5199\u6570\u636e\u65f6\uff0c\u4e3a\u4e86\u4fdd\u8bc1\u6570\u636e\u7684\u4e00\u81f4\u6027\uff0c\u5728\u5f97\u5230\u78c1\u76d8\u56de\u590d\u524d\uff0c\u5b83\u662f\u4e0d\u80fd\u88ab\u5176\u4ed6\u8fdb\u7a0b\u4e2d\u65ad\u6216\u8005\u6253\u65ad\u7684\uff0c\u8fd9\u4e2a\u65f6\u5019\u7684\u8fdb\u7a0b\u5904\u4e8e\u4e0d\u53ef\u4e2d\u65ad\u72b6\u6001\uff0c\u5982\u679c\u6b64\u65f6\u7684\u8fdb\u7a0b\u88ab\u6253\u65ad\u4e86\uff0c\u5c31\u5bb9\u6613\u51fa\u73b0\u78c1\u76d8\u6570\u636e\u548c\u8fdb\u7a0b\u6570\u636e\u4e0d\u4e00\u81f4\u7684\u95ee\u9898\u3002<\/p>\n \u6240\u4ee5\uff0c\u4e0d\u53ef\u4e2d\u65ad\u72b6\u6001\u5b9e\u9645\u4e0a\u662f\u7cfb\u7edf\u8fdb\u7a0b\u548c\u786c\u4ef6\u8bbe\u5907\u7684\u4e00\u79cd\u4fdd\u62a4\u673a\u5236\u3002<\/p>\n \u56e0\u6b64\uff0c\u4f60\u53ef\u4ee5\u7b80\u5355\u7406\u89e3\u4e3a\uff0c\u5e73\u5747\u8d1f\u8f7d\u5c31\u662f\u5e73\u5747\u6d3b\u8dc3\u8fdb\u7a0b\u6570\u3002\u5e73\u5747\u6d3b\u8dc3\u8fdb\u7a0b\u6570\uff0c\u76f4\u89c2\u4e0a\u7684\u7406\u89e3\u5c31\u662f\u5355\u4f4d\u65f6\u95f4\u5185\u7684\u6d3b\u8dc3\u8fdb\u7a0b\u6570\uff0c\u4f46\u5b83\u5b9e\u9645\u4e0a\u662f\u6d3b\u8dc3\u8fdb\u7a0b\u6570\u7684\u6307\u6570\u8870\u51cf\u5e73\u5747\u503c\u3002\u65e2\u7136\u662f\u5e73\u5747\u6d3b\u8dc3\u8fdb\u7a0b\u6570\uff0c\u90a3\u4e48\u7406\u60f3\u72b6\u6001\uff0c\u5c31\u662f\u6bcf\u4e2aCPU\u4e0a\u90fd\u521a\u597d\u8fd0\u884c\u7740\u4e00\u4e2a\u8fdb\u7a0b\uff0c\u8fd9\u6837\u6bcf\u4e2aCPU\u90fd\u4f1a\u5f97\u5230\u5145\u5206\u7684\u5229\u7528\u3002\u4f8b\u5982\u5e73\u5747\u8d1f\u8f7d\u4e3a2\u65f6\uff0c\u610f\u5473\u7740\u4ec0\u4e48\u5462\uff1f<\/p>\n \u5728\u53ea\u67092\u4e2aCPU\u7684\u7cfb\u7edf\u4e0a\uff0c\u610f\u5473\u7740\u6240\u6709\u7684CPU\u521a\u597d\u88ab\u5b8c\u5168\u5360\u7528<\/p>\n \u57284\u4e2aCPU\u7684\u7cfb\u7edf\u4e0a\uff0c\u610f\u5473\u7740CPU\u670950%\u7684\u7a7a\u95f2<\/p>\n \u800c\u5728\u53ea\u67091\u4e2aCPU\u7684\u7cfb\u7edf\u4e0a\uff0c\u5219\u610f\u5473\u7740\u6709\u4e00\u534a\u7684\u8fdb\u7a0b\u7ade\u4e89\u4e0d\u5230CPU<\/p>\n \u5e73\u5747\u8d1f\u8f7d\u548cCPU\u4f7f\u7528\u7387<\/strong><\/div>\n \u73b0\u5b9e\u5de5\u4f5c\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u5bb9\u6613\u628a\u5e73\u5747\u8d1f\u8f7d\u548cCPU\u4f7f\u7528\u7387\u6df7\u6dc6\uff0c\u6240\u4ee5\u5728\u8fd9\u91cc\uff0c\u6211\u4e5f\u505a\u4e00\u4e2a\u5206\u533a\u3002<\/p>\n \u53ef\u80fd\u4f60\u4f1a\u7591\u60d1\uff0c\u65e2\u7136\u5e73\u5747\u8d1f\u8f7d\u4ee3\u8868\u7684\u662f\u6d3b\u8dc3\u8fdb\u7a0b\u6570\uff0c\u90a3\u5e73\u5747\u8d1f\u8f7d\u9ad8\u4e86\uff0c\u4e0d\u5c31\u610f\u5473\u7740CPU\u4f7f\u7528\u7387\u9ad8\u5417\uff1f<\/p>\n \u6211\u4eec\u8fd8\u662f\u8981\u56de\u5230\u5e73\u5747\u8d1f\u8f7d\u7684\u542b\u4e49\u4e0a\u6765\uff0c\u5e73\u5747\u8d1f\u8f7d\u662f\u6307\u5355\u4f4d\u65f6\u95f4\u5185\uff0c\u5904\u4e8e\u53ef\u8fd0\u884c\u72b6\u6001\u548c\u4e0d\u53ef\u4e2d\u65ad\u72b6\u6001\u7684\u8fdb\u7a0b\u6570\uff0c\u6240\u4ee5\uff0c\u5b83\u4e0d\u4ec5\u5305\u62ec\u4e86\u6b63\u5e38\u4f7f\u7528CPU\u7684\u8fdb\u7a0b\uff0c\u8fd8\u5305\u62ec\u4e86\u7b49\u5f85CPU\u548c\u7b49\u5f85I\/O\u7684\u8fdb\u7a0b\u3002<\/p>\n \u800cCPU\u4f7f\u7528\u7387\uff0c\u662f\u5355\u4f4d\u65f6\u95f4\u5185CPU\u7684\u7e41\u5fd9\u60c5\u51b5\u7684\u7edf\u8ba1\uff0c\u8ddf\u5e73\u5747\u8d1f\u8f7d\u5e76\u4e0d\u4e00\u5b9a\u5b8c\u5168\u5bf9\u5e94\uff0c\u4f8b\u5982\uff1a<\/p>\n CPU\u5bc6\u96c6\u578b\u8fdb\u7a0b\uff0c\u4f7f\u7528\u5927\u91cfCPU\u4f1a\u5bfc\u81f4\u5e73\u5747\u8d1f\u8f7d\u5347\u9ad8\uff0c\u6b64\u65f6\u8fd9\u4e24\u8005\u662f\u4e00\u81f4\u7684<\/p>\n I\/O\u5bc6\u96c6\u578b\u8fdb\u7a0b\uff0c\u7b49\u5f85I\/O\u4e5f\u4f1a\u5bfc\u81f4\u5e73\u5747\u8d1f\u8f7d\u5347\u9ad8\uff0c\u4f46CPU\u4f7f\u7528\u7387\u4e0d\u4e00\u5b9a\u5f88\u9ad8<\/p>\n \u5927\u91cf\u7b49\u5f85CPU\u7684\u8fdb\u7a0b\u8c03\u5ea6\u4e5f\u4f1a\u5bfc\u81f4\u5e73\u5747\u8d1f\u8f7d\u5347\u9ad8\uff0c\u6b64\u65f6\u7684CPU\u4f7f\u7528\u7387\u4f1a\u5f88\u9ad8<\/p>\n \u5e73\u5747\u8d1f\u8f7d\u6848\u4f8b<\/strong><\/div>\n \u8fd9\u91cc\u6211\u4eec\u9700\u8981\u5b89\u88c5\u51e0\u4e2a\u5de5\u5177sysstat\u3001stress\u3001stress-ng<\/p>\n \u8fd9\u91ccCentos\u7684sysstat\u7248\u672c\u4f1a\u8001\u4e00\u70b9\uff0c\u6700\u597d\u5347\u7ea7\u5230\u6700\u65b0\u7248\u672c\u3002\u624b\u52a8rpm\u5b89\u88c5\u6216\u8005\u6e90\u7801\u5b89\u88c5<\/p>\n \u573a\u666f\u4e00\u3001CPU\u5bc6\u96c6\u578b<\/strong><\/span><\/div>\n 1\u3001\u8fd0\u884c\u4e00\u4e2astress\u547d\u4ee4\uff0c\u6a21\u62df\u4e00\u4e2aCPU\u4f7f\u7528\u7387100%\u573a\u666f<\/p>\n $ stress --cpu 1 --timeout 600 <\/pre>\n |