{"id":62143,"date":"2025-04-29T08:46:05","date_gmt":"2025-04-29T00:46:05","guid":{"rendered":"https:\/\/fwq.ai\/blog\/62143\/"},"modified":"2025-04-29T08:46:05","modified_gmt":"2025-04-29T00:46:05","slug":"%e8%b6%85%e5%85%a8%e6%95%b4%e7%90%86-linux%e6%80%a7%e8%83%bd%e5%88%86%e6%9e%90%e5%b7%a5%e5%85%b7%e6%b1%87%e6%80%bb%e5%90%88%e9%9b%86-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/62143\/","title":{"rendered":"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6"},"content":{"rendered":"<p> <\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u51fa\u4e8e\u5bf9Linux\u64cd\u4f5c\u7cfb\u7edf\u7684\u5174\u8da3\uff0c\u4ee5\u53ca\u5bf9\u5e95\u5c42\u77e5\u8bc6\u7684\u5f3a\u70c8\u6b32\u671b\uff0c\u56e0\u6b64\u6574\u7406\u4e86\u8fd9\u7bc7\u6587\u7ae0\u3002\u672c\u6587\u4e5f\u53ef\u4ee5\u4f5c\u4e3a\u68c0\u9a8c\u57fa\u7840\u77e5\u8bc6\u7684\u6307\u6807\uff0c\u53e6\u5916\u6587\u7ae0\u6db5\u76d6\u4e86\u4e00\u4e2a\u7cfb\u7edf\u7684\u65b9\u65b9\u9762\u9762\u3002\u5982\u679c\u6ca1\u6709\u5b8c\u5584\u7684\u8ba1\u7b97\u673a\u7cfb\u7edf\u77e5\u8bc6\uff0c\u7f51\u7edc\u77e5\u8bc6\u548c\u64cd\u4f5c\u7cfb\u7edf\u77e5\u8bc6\uff0c\u6587\u6863\u4e2d\u7684\u5de5\u5177\uff0c\u662f\u4e0d\u53ef\u80fd\u5b8c\u5168\u638c\u63e1\u7684\uff0c\u53e6\u5916\u5bf9\u7cfb\u7edf\u6027\u80fd\u5206\u6790\u548c\u4f18\u5316\u662f\u4e00\u4e2a\u957f\u671f\u7684\u7cfb\u5217\u3002<\/span><\/p>\n<p style=\"letter-spacing: 0.544px;font-size: 14px;font-family:\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u672c\u6587\u6863\u4e3b\u8981\u662f\u7ed3\u5408Linux \u5927\u725b\uff0cNetflix \u9ad8\u7ea7\u6027\u80fd\u67b6\u6784\u5e08 Brendan Gregg \u66f4\u65b0 Linux \u6027\u80fd\u8c03\u4f18\u5de5\u5177\u7684\u535a\u6587\uff0c\u641c\u96c6Linux\u7cfb\u7edf\u6027\u80fd\u4f18\u5316\u76f8\u5173\u6587\u7ae0\u6574\u7406\u540e\u7684\u4e00\u7bc7\u7efc\u5408\u6027\u6587\u7ae0\uff0c\u4e3b\u8981\u662f\u7ed3\u5408\u535a\u6587\u5bf9\u6d89\u53ca\u5230\u7684\u539f\u7406\u548c\u6027\u80fd\u6d4b\u8bd5\u7684\u5de5\u5177\u5c55\u5f00\u8bf4\u660e\u3002<\/span><\/p>\n<p style=\"letter-spacing: 0.544px;font-size: 14px;font-family:\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u80cc\u666f\u77e5\u8bc6\uff1a\u5177\u5907\u80cc\u666f\u77e5\u8bc6\u662f\u5206\u6790\u6027\u80fd\u95ee\u9898\u65f6\u9700\u8981\u4e86\u89e3\u7684\u3002\u6bd4\u5982\u786c\u4ef6 cache\uff1b\u518d\u6bd4\u5982\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\u3002\u5e94\u7528\u7a0b\u5e8f\u7684\u884c\u4e3a\u7ec6\u8282\u5f80\u5f80\u662f\u548c\u8fd9\u4e9b\u4e1c\u897f\u4e92\u76f8\u7275\u626f\u7684\uff0c\u8fd9\u4e9b\u5e95\u5c42\u7684\u4e1c\u897f\u4f1a\u4ee5\u610f\u60f3\u4e0d\u5230\u7684\u65b9\u5f0f\u5f71\u54cd\u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\uff0c\u6bd4\u5982\u67d0\u4e9b\u7a0b\u5e8f\u65e0\u6cd5\u5145\u5206\u5229\u7528 cache\uff0c\u4ece\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002\u6bd4\u5982\u4e0d\u5fc5\u8981\u5730\u8c03\u7528\u8fc7\u591a\u7684\u7cfb\u7edf\u8c03\u7528\uff0c\u9020\u6210\u9891\u7e41\u7684\u5185\u6838 \/ \u7528\u6237\u5207\u6362\u7b49\u3002\u8fd9\u91cc\u53ea\u662f\u4e3a\u672c\u6587\u7684\u540e\u7eed\u5185\u5bb9\u505a\u4e00\u4e9b\u94fa\u57ab\uff0c\u5173\u4e8e\u8c03\u4f18\u8fd8\u6709\u5f88\u591a\u4e1c\u897f\uff0c\u6211\u6240\u4e0d\u77e5\u9053\u7684\u6bd4\u77e5\u9053\u7684\u8981\u591a\u7684\u591a\uff0c\u5e0c\u671b\u5927\u5bb6\u80fd\u5171\u540c\u5b66\u4e60\u8fdb\u6b65\u3002<\/span><\/p>\n<p style=\"letter-spacing: 0.544px;font-size: 14px;font-family:\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-family: -apple-system-font, BlinkMacSystemFont,\"><span style=\"line-height: 2;font-weight: 700;font-size: 18px\">\u3010\u6027\u80fd\u5206\u6790\u5de5\u5177\u3011<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u9996\u5148\u6765\u770b\u4e00\u5f20\u56fe\uff1a<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/275\/013\/b041f69a594462623be329857ec4848b-1.jpg\" class=\"aligncenter\" title=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe\" alt=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe\" \/><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u4e0a\u56fe\u662fBrendan Gregg \u7684\u4e00\u6b21\u6027\u80fd\u5206\u6790\u7684\u5206\u4eab\uff0c\u8fd9\u91cc\u9762\u7684\u6240\u6709\u5de5\u5177\u90fd\u53ef\u4ee5\u901a\u8fc7man\u6765\u83b7\u5f97\u5b83\u7684\u5e2e\u52a9\u6587\u6863\uff0c\u4e0b\u95ee\u7b80\u5355\u4ecb\u7ecd\u4ecb\u7ecd\u4e00\u4e0b\u5e38\u89c4\u7684\u7528\u6cd5\uff1a<\/span><\/p>\n<p style=\"letter-spacing: 0.544px;font-size: 14px;font-family:\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-weight: 700;line-height: 2;font-size: 15px\">\u25b2 vmstat&#8211;\u865a\u62df\u5185\u5b58\u7edf\u8ba1<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">vmstat(VirtualMeomoryStatistics,\u865a\u62df\u5185\u5b58\u7edf\u8ba1) \u662fLinux\u4e2d\u76d1\u63a7\u5185\u5b58\u7684\u5e38\u7528\u5de5\u5177,\u53ef\u5bf9\u64cd\u4f5c\u7cfb\u7edf\u7684\u865a\u62df\u5185\u5b58\u3001\u8fdb\u7a0b\u3001CPU\u7b49\u7684\u6574\u4f53\u60c5\u51b5\u8fdb\u884c\u76d1\u89c6\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">vmstat\u7684\u5e38\u89c4\u7528\u6cd5\uff1avmstat interval times\u5373\u6bcf\u9694interval\u79d2\u91c7\u6837\u4e00\u6b21\uff0c\u5171\u91c7\u6837times\u6b21\uff0c\u5982\u679c\u7701\u7565times,\u5219\u4e00\u76f4\u91c7\u96c6\u6570\u636e\uff0c\u76f4\u5230\u7528\u6237\u624b\u52a8\u505c\u6b62\u4e3a\u6b62\u3002<\/span><br \/><span style=\"line-height: 2\">\u7b80\u5355\u4e3e\u4e2a\u4f8b\u5b50\uff1a<\/span><\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/275\/013\/06fdeb918d776bbf7c3079185510df68-2.png\" class=\"aligncenter\" title=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe1\" alt=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe1\" \/><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u53ef\u4ee5\u4f7f\u7528ctrl+c\u505c\u6b62vmstat\u91c7\u96c6\u6570\u636e\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u7b2c\u4e00\u884c\u663e\u793a\u4e86\u7cfb\u7edf\u81ea\u542f\u52a8\u4ee5\u6765\u7684\u5e73\u5747\u503c\uff0c\u7b2c\u4e8c\u884c\u5f00\u59cb\u663e\u793a\u73b0\u5728\u6b63\u5728\u53d1\u751f\u7684\u60c5\u51b5\uff0c\u63a5\u4e0b\u6765\u7684\u884c\u4f1a\u663e\u793a\u6bcf5\u79d2\u95f4\u9694\u53d1\u751f\u4e86\u4ec0\u4e48\uff0c\u6bcf\u4e00\u5217\u7684\u542b\u4e49\u5728\u5934\u90e8\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aa procs\uff1ar\u8fd9\u4e00\u5217\u663e\u793a\u4e86\u591a\u5c11\u8fdb\u7a0b\u5728\u7b49\u5f85cpu\uff0cb\u5217\u663e\u793a\u591a\u5c11\u8fdb\u7a0b\u6b63\u5728\u4e0d\u53ef\u4e2d\u65ad\u7684\u4f11\u7720\uff08\u7b49\u5f85IO\uff09\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">\u25aa&nbsp;<\/span>memory\uff1aswapd\u5217\u663e\u793a\u4e86\u591a\u5c11\u5757\u88ab\u6362\u51fa\u4e86\u78c1\u76d8\uff08\u9875\u9762\u4ea4\u6362\uff09\uff0c\u5269\u4e0b\u7684\u5217\u663e\u793a\u4e86\u591a\u5c11\u5757\u662f\u7a7a\u95f2\u7684\uff08\u672a\u88ab\u4f7f\u7528\uff09\uff0c\u591a\u5c11\u5757\u6b63\u5728\u88ab\u7528\u4f5c\u7f13\u51b2\u533a\uff0c\u4ee5\u53ca\u591a\u5c11\u6b63\u5728\u88ab\u7528\u4f5c\u64cd\u4f5c\u7cfb\u7edf\u7684\u7f13\u5b58\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">\u25aa&nbsp;<\/span>swap\uff1a\u663e\u793a\u4ea4\u6362\u6d3b\u52a8\uff1a\u6bcf\u79d2\u6709\u591a\u5c11\u5757\u6b63\u5728\u88ab\u6362\u5165\uff08\u4ece\u78c1\u76d8\uff09\u548c\u6362\u51fa\uff08\u5230\u78c1\u76d8\uff09\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">\u25aa&nbsp;<\/span>io\uff1a\u663e\u793a\u4e86\u591a\u5c11\u5757\u4ece\u5757\u8bbe\u5907\u8bfb\u53d6\uff08bi\uff09\u548c\u5199\u51fa\uff08bo\uff09,\u901a\u5e38\u53cd\u6620\u4e86\u786c\u76d8I\/O\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aa system\uff1a\u663e\u793a\u6bcf\u79d2\u4e2d\u65ad(in)\u548c\u4e0a\u4e0b\u6587\u5207\u6362\uff08cs\uff09\u7684\u6570\u91cf\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aa cpu\uff1a\u663e\u793a\u6240\u6709\u7684cpu\u65f6\u95f4\u82b1\u8d39\u5728\u5404\u7c7b\u64cd\u4f5c\u7684\u767e\u5206\u6bd4\uff0c\u5305\u62ec\u6267\u884c\u7528\u6237\u4ee3\u7801\uff08\u975e\u5185\u6838\uff09\uff0c\u6267\u884c\u7cfb\u7edf\u4ee3\u7801\uff08\u5185\u6838\uff09\uff0c\u7a7a\u95f2\u4ee5\u53ca\u7b49\u5f85IO\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u5185\u5b58\u4e0d\u8db3\u7684\u8868\u73b0\uff1afree &nbsp;memory\u6025\u5267\u51cf\u5c11\uff0c\u56de\u6536buffer\u548ccacher\u4e5f\u65e0\u6d4e\u4e8e\u4e8b\uff0c\u5927\u91cf\u4f7f\u7528\u4ea4\u6362\u5206\u533a\uff08swpd\uff09,\u9875\u9762\u4ea4\u6362\uff08swap\uff09\u9891\u7e41\uff0c\u8bfb\u5199\u78c1\u76d8\u6570\u91cf\uff08io\uff09\u589e\u591a\uff0c\u7f3a\u9875\u4e2d\u65ad\uff08in\uff09\u589e\u591a\uff0c\u4e0a\u4e0b\u6587\u5207\u6362\uff08cs\uff09\u6b21\u6570\u589e\u591a\uff0c\u7b49\u5f85IO\u7684\u8fdb\u7a0b\u6570\uff08b\uff09\u589e\u591a\uff0c\u5927\u91cfCPU\u65f6\u95f4\u7528\u4e8e\u7b49\u5f85IO\uff08wa\uff09<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-weight: 700;font-size: 15px\">\u25b2iostat&#8211;\u7528\u4e8e\u62a5\u544a\u4e2d\u592e\u5904\u7406\u5668\u7edf\u8ba1\u4fe1\u606f<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">iostat\u7528\u4e8e\u62a5\u544a\u4e2d\u592e\u5904\u7406\u5668\uff08CPU\uff09\u7edf\u8ba1\u4fe1\u606f\u548c\u6574\u4e2a\u7cfb\u7edf\u3001\u9002\u914d\u5668\u3001tty \u8bbe\u5907\u3001\u78c1\u76d8\u548c CD-ROM \u7684\u8f93\u5165\/\u8f93\u51fa\u7edf\u8ba1\u4fe1\u606f\uff0c\u9ed8\u8ba4\u663e\u793a\u4e86\u4e0evmstat\u76f8\u540c\u7684cpu\u4f7f\u7528\u4fe1\u606f\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u663e\u793a\u6269\u5c55\u7684\u8bbe\u5907\u7edf\u8ba1\uff1a<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/275\/013\/06fdeb918d776bbf7c3079185510df68-3.png\" class=\"aligncenter\" title=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe2\" alt=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe2\" \/><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u7b2c\u4e00\u884c\u663e\u793a\u7684\u662f\u81ea\u7cfb\u7edf\u542f\u52a8\u4ee5\u6765\u7684\u5e73\u5747\u503c\uff0c\u7136\u540e\u663e\u793a\u589e\u91cf\u7684\u5e73\u5747\u503c\uff0c\u6bcf\u4e2a\u8bbe\u5907\u4e00\u884c\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u5e38\u89c1\u7684\u78c1\u76d8IO\u6307\u6807\u7684\u7f29\u5199\u4e60\u60ef\uff1arq\u662frequest,r\u662fread,w\u662fwrite,qu\u662fqueue\uff0csz\u662fsize,a\u662fverage,tm\u662ftime,svc\u662fservice\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aarrqm\/s\u548cwrqm\/s\uff1a\u6bcf\u79d2\u5408\u5e76\u7684\u8bfb\u548c\u5199\u8bf7\u6c42\uff0c\u201c\u5408\u5e76\u7684\u201d\u610f\u5473\u7740\u64cd\u4f5c\u7cfb\u7edf\u4ece\u961f\u5217\u4e2d\u62ff\u51fa\u591a\u4e2a\u903b\u8f91\u8bf7\u6c42\u5408\u5e76\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u5230\u5b9e\u9645\u78c1\u76d8\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aar\/s\u548cw\/s\uff1a\u6bcf\u79d2\u53d1\u9001\u5230\u8bbe\u5907\u7684\u8bfb\u548c\u5199\u8bf7\u6c42\u6570\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aarsec\/s\u548cwsec\/s\uff1a\u6bcf\u79d2\u8bfb\u548c\u5199\u7684\u6247\u533a\u6570\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aaavgrq \u2013sz\uff1a\u8bf7\u6c42\u7684\u6247\u533a\u6570\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aaavgqu \u2013sz\uff1a\u5728\u8bbe\u5907\u961f\u5217\u4e2d\u7b49\u5f85\u7684\u8bf7\u6c42\u6570\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aaawait\uff1a\u6bcf\u4e2aIO\u8bf7\u6c42\u82b1\u8d39\u7684\u65f6\u95f4\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aasvctm\uff1a\u5b9e\u9645\u8bf7\u6c42\uff08\u670d\u52a1\uff09\u65f6\u95f4\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aa%util\uff1a\u81f3\u5c11\u6709\u4e00\u4e2a\u6d3b\u8dc3\u8bf7\u6c42\u6240\u5360\u65f6\u95f4\u7684\u767e\u5206\u6bd4\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-weight: 700;line-height: 2;font-size: 15px\">\u25b2dstat&#8211;\u7cfb\u7edf\u76d1\u63a7\u5de5\u5177<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">dstat\u663e\u793a\u4e86cpu\u4f7f\u7528\u60c5\u51b5\uff0c\u78c1\u76d8io\u60c5\u51b5\uff0c\u7f51\u7edc\u53d1\u5305\u60c5\u51b5\u548c\u6362\u9875\u60c5\u51b5\uff0c\u8f93\u51fa\u662f\u5f69\u8272\u7684\uff0c\u53ef\u8bfb\u6027\u8f83\u5f3a\uff0c\u76f8\u5bf9\u4e8evmstat\u548ciostat\u7684\u8f93\u5165\u66f4\u52a0\u8be6\u7ec6\u4e14\u8f83\u4e3a\u76f4\u89c2\u3002\u5728\u4f7f\u7528\u65f6\uff0c\u76f4\u63a5\u8f93\u5165\u547d\u4ee4\u5373\u53ef\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u4f7f\u7528\u7279\u5b9a\u53c2\u6570\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u5982\u4e0b\uff1adstat \u2013cdlmnpsy<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/275\/013\/06fdeb918d776bbf7c3079185510df68-4.jpg\" class=\"aligncenter\" title=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe3\" alt=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe3\" \/><\/p>\n<p style=\"letter-spacing: 0.544px;font-size: 14px;font-family:\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-weight: 700;font-size: 15px\">\u25b2iotop&#8211;LINUX\u8fdb\u7a0b\u5b9e\u65f6\u76d1\u63a7\u5de5\u5177<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">iotop\u547d\u4ee4\u662f\u4e13\u95e8\u663e\u793a\u786c\u76d8IO\u7684\u547d\u4ee4\uff0c\u754c\u9762\u98ce\u683c\u7c7b\u4f3ctop\u547d\u4ee4\uff0c\u53ef\u4ee5\u663e\u793aIO\u8d1f\u8f7d\u5177\u4f53\u662f\u7531\u54ea\u4e2a\u8fdb\u7a0b\u4ea7\u751f\u7684\u3002\u662f\u4e00\u4e2a\u7528\u6765\u76d1\u89c6\u78c1\u76d8I\/O\u4f7f\u7528\u72b6\u51b5\u7684top\u7c7b\u5de5\u5177\uff0c\u5177\u6709\u4e0etop\u76f8\u4f3c\u7684UI\uff0c\u5176\u4e2d\u5305\u62ecPID\u3001\u7528\u6237\u3001I\/O\u3001\u8fdb\u7a0b\u7b49\u76f8\u5173\u4fe1\u606f\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u53ef\u4ee5\u4ee5\u975e\u4ea4\u4e92\u7684\u65b9\u5f0f\u4f7f\u7528\uff1aiotop \u2013bod interval\uff0c\u67e5\u770b\u6bcf\u4e2a\u8fdb\u7a0b\u7684I\/O\uff0c\u53ef\u4ee5\u4f7f\u7528pidstat\uff0cpidstat \u2013d instat\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\"><br \/><\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u641c\u7d22\u516c\u4f17\u53f7Linux\u4e2d\u6587\u793e\u533a\u540e\u53f0\u56de\u590d\u201c\u79c1\u623f\u83dc\u201d\uff0c\u83b7\u53d6\u4e00\u4efd\u60ca\u559c\u793c\u5305\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-weight: 700;font-size: 15px\">\u25b2pidstat&#8211;\u76d1\u63a7\u7cfb\u7edf\u8d44\u6e90\u60c5\u51b5<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">pidstat\u4e3b\u8981\u7528\u4e8e\u76d1\u63a7\u5168\u90e8\u6216\u6307\u5b9a\u8fdb\u7a0b\u5360\u7528\u7cfb\u7edf\u8d44\u6e90\u7684\u60c5\u51b5,\u5982CPU,\u5185\u5b58\u3001\u8bbe\u5907IO\u3001\u4efb\u52a1\u5207\u6362\u3001\u7ebf\u7a0b\u7b49\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u4f7f\u7528\u65b9\u6cd5\uff1apidstat \u2013d interval\uff1bpidstat\u8fd8\u53ef\u4ee5\u7528\u4ee5\u7edf\u8ba1CPU\u4f7f\u7528\u4fe1\u606f\uff1apidstat \u2013u interval\uff1b\u7edf\u8ba1\u5185\u5b58\u4fe1\u606f\uff1aPidstat \u2013r interval\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"font-weight: 700;line-height: 2\">\u25b2<\/span><span style=\"font-weight: 700\">top<\/span><\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">top\u547d\u4ee4\u7684\u6c47\u603b\u533a\u57df\u663e\u793a\u4e86\u4e94\u4e2a\u65b9\u9762\u7684\u7cfb\u7edf\u6027\u80fd\u4fe1\u606f\uff1a<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">1.\u8d1f\u8f7d\uff1a\u65f6\u95f4\uff0c\u767b\u9646\u7528\u6237\u6570\uff0c\u7cfb\u7edf\u5e73\u5747\u8d1f\u8f7d\uff1b<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">2.\u8fdb\u7a0b\uff1a\u8fd0\u884c\uff0c\u7761\u7720\uff0c\u505c\u6b62\uff0c\u50f5\u5c38\uff1b<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">3.cpu:\u7528\u6237\u6001\uff0c\u6838\u5fc3\u6001\uff0cNICE,\u7a7a\u95f2\uff0c\u7b49\u5f85IO,\u4e2d\u65ad\u7b49\uff1b<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">4.\u5185\u5b58\uff1a\u603b\u91cf\uff0c\u5df2\u7528\uff0c\u7a7a\u95f2\uff08\u7cfb\u7edf\u89d2\u5ea6\uff09\uff0c\u7f13\u51b2\uff0c\u7f13\u5b58\uff1b<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">5.\u4ea4\u6362\u5206\u533a\uff1a\u603b\u91cf\uff0c\u5df2\u7528\uff0c\u7a7a\u95f2<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u4efb\u52a1\u533a\u57df\u9ed8\u8ba4\u663e\u793a\uff1a\u8fdb\u7a0bID,\u6709\u6548\u7528\u6237\uff0c\u8fdb\u7a0b\u4f18\u5148\u7ea7\uff0cNICE\u503c\uff0c\u8fdb\u7a0b\u4f7f\u7528\u7684\u865a\u62df\u5185\u5b58\uff0c\u7269\u7406\u5185\u5b58\u548c\u5171\u4eab\u5185\u5b58\uff0c\u8fdb\u7a0b\u72b6\u6001\uff0cCPU\u5360\u7528\u7387\uff0c\u5185\u5b58\u5360\u7528\u7387\uff0c\u7d2f\u8ba1CPU\u65f6\u95f4\uff0c\u8fdb\u7a0b\u547d\u4ee4\u884c\u4fe1\u606f\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"font-weight: 700;line-height: 2\">\u25b2<\/span><span style=\"font-weight: 700\">htop<\/span><\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px;line-height: 2\">htop \u662fLinux\u7cfb\u7edf\u4e2d\u7684\u4e00\u4e2a\u4e92\u52a8\u7684\u8fdb\u7a0b\u67e5\u770b\u5668,\u4e00\u4e2a\u6587\u672c\u6a21\u5f0f\u7684\u5e94\u7528\u7a0b\u5e8f(\u5728\u63a7\u5236\u53f0\u6216\u8005X\u7ec8\u7aef\u4e2d),\u9700\u8981ncurses\u3002<br \/><\/span><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/275\/013\/2f136c52ec78b7ff3870b8ac10de1cfa-5.jpg\" class=\"aligncenter\" title=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe4\" alt=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe4\" \/><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">Htop\u53ef\u8ba9\u7528\u6237\u4ea4\u4e92\u5f0f\u64cd\u4f5c\uff0c\u652f\u6301\u989c\u8272\u4e3b\u9898\uff0c\u53ef\u6a2a\u5411\u6216\u7eb5\u5411\u6eda\u52a8\u6d4f\u89c8\u8fdb\u7a0b\u5217\u8868\uff0c\u5e76\u652f\u6301\u9f20\u6807\u64cd\u4f5c\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u4e0etop\u76f8\u6bd4\uff0chtop\u6709\u4ee5\u4e0b\u4f18\u70b9\uff1a<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px;line-height: 2\">\u25aa&nbsp;\u53ef\u4ee5\u6a2a\u5411\u6216\u8005\u7eb5\u5411\u6eda\u52a8\u6d4f\u89c8\u8fdb\u7a0b\u5217\u8868\uff0c\u4ee5\u4fbf\u770b\u5230\u6240\u6709\u7684\u8fdb\u7a0b\u548c\u5b8c\u6574\u7684\u547d\u4ee4\u884c\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px;line-height: 2\">\u25aa&nbsp;\u5728\u542f\u52a8\u4e0a\uff0c\u6bd4top\u66f4\u5feb\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px;line-height: 2\">\u25aa&nbsp;\u6740\u8fdb\u7a0b\u65f6\u4e0d\u9700\u8981\u8f93\u5165\u8fdb\u7a0b\u53f7\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px;line-height: 2\">\u25aa htop\u652f\u6301\u9f20\u6807\u64cd\u4f5c\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u25b2mpstat<\/span><span style=\"font-size: 15px;line-height: 2\"><br \/>mpstat \u662fMultiprocessor Statistics\u7684\u7f29\u5199\uff0c\u662f\u5b9e\u65f6\u7cfb\u7edf\u76d1\u63a7\u5de5\u5177\u3002\u5176\u62a5\u544a\u4e0eCPU\u7684\u4e00\u4e9b\u7edf\u8ba1\u4fe1\u606f\uff0c\u8fd9\u4e9b\u4fe1\u606f\u5b58\u653e\u5728\/proc\/stat\u6587\u4ef6\u4e2d\u3002\u5728\u591aCPUs\u7cfb\u7edf\u91cc\uff0c\u5176\u4e0d\u4f46\u80fd\u67e5\u770b\u6240\u6709CPU\u7684\u5e73\u5747\u72b6\u51b5\u4fe1\u606f\uff0c\u800c\u4e14\u80fd\u591f\u67e5\u770b\u7279\u5b9aCPU\u7684\u4fe1\u606f\u3002\u5e38\u89c1\u7528\u6cd5\uff1ampstat \u2013P ALL interval times\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"font-weight: 700;line-height: 2\">\u25b2<\/span><span style=\"font-weight: 700\">netstat<\/span><\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">Netstat\u7528\u4e8e\u663e\u793a\u4e0eIP\u3001TCP\u3001UDP\u548cICMP\u534f\u8bae\u76f8\u5173\u7684\u7edf\u8ba1\u6570\u636e\uff0c\u4e00\u822c\u7528\u4e8e\u68c0\u9a8c\u672c\u673a\u5404\u7aef\u53e3\u7684\u7f51\u7edc\u8fde\u63a5\u60c5\u51b5\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25b2\u5e38\u89c1\u7528\u6cd5\uff1a&nbsp;<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">netstat \u2013npl &nbsp; \u53ef\u4ee5\u67e5\u770b\u4f60\u8981\u6253\u5f00\u7684\u7aef\u53e3\u662f\u5426\u5df2\u7ecf\u6253\u5f00\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">netstat \u2013rn &nbsp; &nbsp;\u6253\u5370\u8def\u7531\u8868\u4fe1\u606f\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">netstat \u2013in &nbsp; &nbsp;\u63d0\u4f9b\u7cfb\u7edf\u4e0a\u7684\u63a5\u53e3\u4fe1\u606f\uff0c\u6253\u5370\u6bcf\u4e2a\u63a5\u53e3\u7684MTU,\u8f93\u5165\u5206\u7ec4\u6570\uff0c\u8f93\u5165\u9519\u8bef\uff0c\u8f93\u51fa\u5206\u7ec4\u6570\uff0c\u8f93\u51fa\u9519\u8bef\uff0c\u51b2\u7a81\u4ee5\u53ca\u5f53\u524d\u7684\u8f93\u51fa\u961f\u5217\u7684\u957f\u5ea6\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"font-weight: 700;line-height: 2\">\u25b2<\/span><span style=\"font-weight: 700\">ps&#8211;\u663e\u793a\u5f53\u524d\u8fdb\u7a0b\u7684\u72b6\u6001&nbsp;<\/span><\/span><span style=\"font-size: 15px;line-height: 2\">&nbsp;<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">ps\u53c2\u6570\u592a\u591a\uff0c\u5177\u4f53\u4f7f\u7528\u65b9\u6cd5\u53ef\u4ee5\u53c2\u8003man ps\uff0c\u5e38\u7528\u7684\u65b9\u6cd5\uff1aps &nbsp;aux &nbsp;#hsserver\uff1bps \u2013ef |grep #hundsun<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px;line-height: 2\">\u25aa&nbsp;\u6740\u6389\u67d0\u4e00\u7a0b\u5e8f\u7684\u65b9\u6cd5\uff1aps &nbsp;aux | grep mysqld | grep \u2013v grep | awk \u2018{print $2 }\u2019 xargs kill -9<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px;line-height: 2\">\u25aa&nbsp;\u6740\u6389\u50f5\u5c38\u8fdb\u7a0b\uff1aps \u2013eal | awk \u2018{if ($2 == \u201cZ\u201d){print $4}}\u2019 | xargs kill -9<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\">\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"font-weight: 700;line-height: 2\">\u25b2<\/span><span style=\"font-weight: 700\">strace<\/span><\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u8ddf\u8e2a\u7a0b\u5e8f\u6267\u884c\u8fc7\u7a0b\u4e2d\u4ea7\u751f\u7684\u7cfb\u7edf\u8c03\u7528\u53ca\u63a5\u6536\u5230\u7684\u4fe1\u53f7\uff0c\u5e2e\u52a9\u5206\u6790\u7a0b\u5e8f\u6216\u547d\u4ee4\u6267\u884c\u4e2d\u9047\u5230\u7684\u5f02\u5e38\u60c5\u51b5\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px;line-height: 2\">\u4e3e\u4f8b\uff1a\u67e5\u770bmysqld\u5728linux\u4e0a\u52a0\u8f7d\u54ea\u79cd\u914d\u7f6e\u6587\u4ef6\uff0c\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff1astrace \u2013e stat64 mysqld \u2013print \u2013defaults &gt; \/dev\/null<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"font-weight: 700;line-height: 2\">\u25b2<\/span><span style=\"font-weight: 700\">uptime<\/span><\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u80fd\u591f\u6253\u5370\u7cfb\u7edf\u603b\u5171\u8fd0\u884c\u4e86\u591a\u957f\u65f6\u95f4\u548c\u7cfb\u7edf\u7684\u5e73\u5747\u8d1f\u8f7d\uff0cuptime\u547d\u4ee4\u6700\u540e\u8f93\u51fa\u7684\u4e09\u4e2a\u6570\u5b57\u7684\u542b\u4e49\u5206\u522b\u662f1\u5206\u949f\uff0c5\u5206\u949f\uff0c15\u5206\u949f\u5185\u7cfb\u7edf\u7684\u5e73\u5747\u8d1f\u8377\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"font-weight: 700;line-height: 2\">\u25b2<\/span><span style=\"font-weight: 700\">lsof<\/span><\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">lsof(list open files)\u662f\u4e00\u4e2a\u5217\u51fa\u5f53\u524d\u7cfb\u7edf\u6253\u5f00\u6587\u4ef6\u7684\u5de5\u5177\u3002\u901a\u8fc7lsof\u5de5\u5177\u80fd\u591f\u67e5\u770b\u8fd9\u4e2a\u5217\u8868\u5bf9\u7cfb\u7edf\u68c0\u6d4b\u53ca\u6392\u9519\uff0c\u5e38\u89c1\u7684\u7528\u6cd5\uff1a<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u67e5\u770b\u6587\u4ef6\u7cfb\u7edf\u963b\u585e &nbsp;lsof \/boot<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u67e5\u770b\u7aef\u53e3\u53f7\u88ab\u54ea\u4e2a\u8fdb\u7a0b\u5360\u7528 &nbsp; lsof &nbsp;-i : 3306<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u67e5\u770b\u7528\u6237\u6253\u5f00\u54ea\u4e9b\u6587\u4ef6 &nbsp; lsof \u2013u username<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u67e5\u770b\u8fdb\u7a0b\u6253\u5f00\u54ea\u4e9b\u6587\u4ef6 &nbsp; lsof \u2013p &nbsp;4838<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u67e5\u770b\u8fdc\u7a0b\u5df2\u6253\u5f00\u7684\u7f51\u7edc\u94fe\u63a5 &nbsp;lsof \u2013i @192.168.34.128<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"font-weight: 700;line-height: 2\">\u25b2<\/span><span style=\"font-weight: 700\">perf<\/span><\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">perf\u662fLinux kernel\u81ea\u5e26\u7684\u7cfb\u7edf\u6027\u80fd\u4f18\u5316\u5de5\u5177\u3002\u4f18\u52bf\u5728\u4e8e\u4e0eLinux Kernel\u7684\u7d27\u5bc6\u7ed3\u5408\uff0c\u5b83\u53ef\u4ee5\u6700\u5148\u5e94\u7528\u5230\u52a0\u5165Kernel\u7684new feature\uff0c\u7528\u4e8e\u67e5\u770b\u70ed\u70b9\u51fd\u6570\uff0c\u67e5\u770bcashe miss\u7684\u6bd4\u7387\uff0c\u4ece\u800c\u5e2e\u52a9\u5f00\u53d1\u8005\u6765\u4f18\u5316\u7a0b\u5e8f\u6027\u80fd\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u6027\u80fd\u8c03\u4f18\u5de5\u5177\u5982 perf\uff0cOprofile \u7b49\u7684\u57fa\u672c\u539f\u7406\u90fd\u662f\u5bf9\u88ab\u76d1\u6d4b\u5bf9\u8c61\u8fdb\u884c\u91c7\u6837\uff0c\u6700\u7b80\u5355\u7684\u60c5\u5f62\u662f\u6839\u636e tick \u4e2d\u65ad\u8fdb\u884c\u91c7\u6837\uff0c\u5373\u5728 tick \u4e2d\u65ad\u5185\u89e6\u53d1\u91c7\u6837\u70b9\uff0c\u5728\u91c7\u6837\u70b9\u91cc\u5224\u65ad\u7a0b\u5e8f\u5f53\u65f6\u7684\u4e0a\u4e0b\u6587\u3002\u5047\u5982\u4e00\u4e2a\u7a0b\u5e8f 90% \u7684\u65f6\u95f4\u90fd\u82b1\u8d39\u5728\u51fd\u6570 foo() \u4e0a\uff0c\u90a3\u4e48 90% \u7684\u91c7\u6837\u70b9\u90fd\u5e94\u8be5\u843d\u5728\u51fd\u6570 foo() \u7684\u4e0a\u4e0b\u6587\u4e2d\u3002\u8fd0\u6c14\u4e0d\u53ef\u6349\u6478\uff0c\u4f46\u6211\u60f3\u53ea\u8981\u91c7\u6837\u9891\u7387\u8db3\u591f\u9ad8\uff0c\u91c7\u6837\u65f6\u95f4\u8db3\u591f\u957f\uff0c\u90a3\u4e48\u4ee5\u4e0a\u63a8\u8bba\u5c31\u6bd4\u8f83\u53ef\u9760\u3002\u56e0\u6b64\uff0c\u901a\u8fc7 tick \u89e6\u53d1\u91c7\u6837\uff0c\u6211\u4eec\u4fbf\u53ef\u4ee5\u4e86\u89e3\u7a0b\u5e8f\u4e2d\u54ea\u4e9b\u5730\u65b9\u6700\u8017\u65f6\u95f4\uff0c\u4ece\u800c\u91cd\u70b9\u5206\u6790\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">\u60f3\u8981\u66f4\u6df1\u7684\u4e86\u89e3\u672c\u5de5\u5177\u53ef\u4ee5\u53c2\u8003\uff1a<\/span><br \/><span style=\"line-height: 2\">http:\/\/blog.csdn.net\/trochiluses\/article\/details\/10261339<\/span><\/span><\/p>\n<p style=\"letter-spacing: 0.544px;font-size: 14px;font-family:\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u6c47\u603b\uff1a\u7ed3\u5408\u4ee5\u4e0a\u5e38\u7528\u7684\u6027\u80fd\u6d4b\u8bd5\u547d\u4ee4\u5e76\u8054\u7cfb\u6587\u521d\u7684\u6027\u80fd\u5206\u6790\u5de5\u5177\u7684\u56fe\uff0c\u5c31\u53ef\u4ee5\u521d\u6b65\u4e86\u89e3\u5230\u6027\u80fd\u5206\u6790\u8fc7\u7a0b\u4e2d\u54ea\u4e2a\u65b9\u9762\u7684\u6027\u80fd\u4f7f\u7528\u54ea\u65b9\u9762\u7684\u5de5\u5177\uff08\u547d\u4ee4\uff09\u3002<\/span><\/p>\n<p style=\"letter-spacing: 0.544px;font-size: 14px;font-family:\"><\/p>\n<p style=\"margin-right: 8px;margin-bottom: 15px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-weight: 700;font-size: 18px\">\u3010\u5e38\u7528\u7684\u6027\u80fd\u6d4b\u8bd5\u5de5\u5177\u3011<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-family: -apple-system-font, BlinkMacSystemFont,\"><span style=\"font-family:\">\u719f\u7ec3\u5e76\u7cbe\u901a\u4e86\u7b2c\u4e8c\u90e8\u5206\u7684\u6027\u80fd\u5206\u6790\u547d\u4ee4\u5de5\u5177\uff0c\u5f15\u5165\u51e0\u4e2a\u6027\u80fd\u6d4b\u8bd5\u7684\u5de5\u5177\uff0c\u4ecb\u7ecd\u4e4b\u524d\u5148\u7b80\u5355\u4e86\u89e3\u51e0\u4e2a\u6027\u80fd\u6d4b\u8bd5\u5de5\u5177\uff1a<\/span><\/p>\n<p style=\"letter-spacing: 0.544px;font-size: 14px;font-family:\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aa perf_events: \u4e00\u6b3e\u968f Linux \u5185\u6838\u4ee3\u7801\u4e00\u540c\u53d1\u5e03\u548c\u7ef4\u62a4\u7684\u6027\u80fd\u8bca\u65ad\u5de5\u5177\uff0c\u7531\u5185\u6838\u793e\u533a\u7ef4\u62a4\u548c\u53d1\u5c55\u3002Perf \u4e0d\u4ec5\u53ef\u4ee5\u7528\u4e8e\u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u7edf\u8ba1\u5206\u6790\uff0c\u4e5f\u53ef\u4ee5\u5e94\u7528\u4e8e\u5185\u6838\u4ee3\u7801\u7684\u6027\u80fd\u7edf\u8ba1\u548c\u5206\u6790\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u66f4\u591a\u53c2\u8003\uff1ahttp:\/\/blog.sina.com.cn\/s\/blog_98822316010122ex.html\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">\u25aa&nbsp;<\/span>eBPF tools:&nbsp;\u4e00\u6b3e\u4f7f\u7528bcc\u8fdb\u884c\u7684\u6027\u80fd\u8ffd\u8e2a\u7684\u5de5\u5177,eBPF map\u53ef\u4ee5\u4f7f\u7528\u5b9a\u5236\u7684eBPF\u7a0b\u5e8f\u88ab\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5185\u6838\u8c03\u4f18\u65b9\u9762\uff0c\u4e5f\u53ef\u4ee5\u8bfb\u53d6\u7528\u6237\u7ea7\u7684\u5f02\u6b65\u4ee3\u7801\u3002\u91cd\u8981\u7684\u662f\u8fd9\u4e2a\u5916\u90e8\u7684\u6570\u636e\u53ef\u4ee5\u5728\u7528\u6237\u7a7a\u95f4\u7ba1\u7406\u3002\u8fd9\u4e2ak-v\u683c\u5f0f\u7684map\u6570\u636e\u4f53\u662f\u901a\u8fc7\u5728\u7528\u6237\u7a7a\u95f4\u8c03\u7528bpf\u7cfb\u7edf\u8c03\u7528\u521b\u5efa\u3001\u6dfb\u52a0\u3001\u5220\u9664\u7b49\u64cd\u4f5c\u7ba1\u7406\u7684\u3002more: http:\/\/blog.csdn.net\/ljy1988123\/article\/details\/50444693\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">\u25aa&nbsp;<\/span>perf-tools: \u4e00\u6b3e\u57fa\u4e8e perf_events (perf) \u548c ftrace \u7684Linux\u6027\u80fd\u5206\u6790\u8c03\u4f18\u5de5\u5177\u96c6\u3002Perf-Tools \u4f9d\u8d56\u5e93\u5c11\uff0c\u4f7f\u7528\u7b80\u5355\u3002\u652f\u6301Linux 3.2 \u53ca\u4ee5\u4e0a\u5185\u6838\u7248\u672c\u3002more: https:\/\/github.com\/brendangregg\/perf-tools\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u25aa bcc(BPF Compiler Collection): \u4e00\u6b3e\u4f7f\u7528eBPF\u7684perf\u6027\u80fd\u5206\u6790\u5de5\u5177\u3002\u4e00\u4e2a\u7528\u4e8e\u521b\u5efa\u9ad8\u6548\u7684\u5185\u6838\u8ddf\u8e2a\u548c\u64cd\u4f5c\u7a0b\u5e8f\u7684\u5de5\u5177\u5305\uff0c\u5305\u62ec\u51e0\u4e2a\u6709\u7528\u7684\u5de5\u5177\u548c\u793a\u4f8b\u3002\u5229\u7528\u6269\u5c55\u7684BPF\uff08\u4f2f\u514b\u5229\u6570\u636e\u5305\u8fc7\u6ee4\u5668\uff09\uff0c\u6b63\u5f0f\u79f0\u4e3aeBPF\uff0c\u4e00\u4e2a\u65b0\u7684\u529f\u80fd\uff0c\u9996\u5148\u88ab\u6dfb\u52a0\u5230Linux 3.15\u3002\u591a\u7528\u9014\u9700\u8981Linux 4.1\u4ee5\u4e0aBCC\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-size: 15px\">\u66f4\u591a\u53c2\u8003\uff1ahttps:\/\/github.com\/iovisor\/bcc#tools\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">\u25aa&nbsp;<\/span>ktap: \u4e00\u79cd\u65b0\u578b\u7684linux\u811a\u672c\u52a8\u6001\u6027\u80fd\u8ddf\u8e2a\u5de5\u5177\u3002\u5141\u8bb8\u7528\u6237\u8ddf\u8e2aLinux\u5185\u6838\u52a8\u6001\u3002ktap\u662f\u8bbe\u8ba1\u7ed9\u5177\u6709\u4e92\u64cd\u4f5c\u6027\uff0c\u5141\u8bb8\u7528\u6237\u8c03\u6574\u64cd\u4f5c\u7684\u89c1\u89e3\uff0c\u6392\u9664\u6545\u969c\u548c\u5ef6\u957f\u5185\u6838\u548c\u5e94\u7528\u7a0b\u5e8f\u3002\u5b83\u7c7b\u4f3c\u4e8eLinux\u548cSolaris DTrace SystemTap\u3002\u66f4\u591a\u53c2\u8003\uff1ahttps:\/\/github.com\/ktap\/ktap\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">\u25aa&nbsp;<\/span>Flame Graphs:\u662f\u4e00\u6b3e\u4f7f\u7528perf,system tap,ktap\u53ef\u89c6\u5316\u7684\u56fe\u5f62\u8f6f\u4ef6\uff0c\u5141\u8bb8\u6700\u9891\u7e41\u7684\u4ee3\u7801\u8def\u5f84\u5feb\u901f\u51c6\u786e\u5730\u8bc6\u522b\uff0c\u53ef\u4ee5\u662f\u4f7f\u7528github.com\/brendangregg\/flamegraph\u4e2d\u7684\u5f00\u53d1\u6e90\u4ee3\u7801\u7684\u7a0b\u5e8f\u751f\u6210\u3002<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">\u66f4\u591a\u53c2\u8003\uff1ahttp:\/\/www.brendangregg.com\/flamegraphs.html\u3002<\/span><\/p>\n<p><span style=\"font-weight: 700\">\u4e00\u3001 Linux observability tools | Linux \u6027\u80fd\u89c2\u6d4b\u5de5\u5177<\/span><\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/275\/013\/2f136c52ec78b7ff3870b8ac10de1cfa-6.jpg\" class=\"aligncenter\" title=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe5\" alt=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe5\" \/><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">\u25aa \u9996\u5148\u5b66\u4e60\u7684Basic Tool\u6709\u5982\u4e0b\uff1a<\/span><br \/><span style=\"line-height: 2\">uptime\u3001top(htop)\u3001mpstat\u3001isstat\u3001vmstat\u3001free\u3001ping\u3001nicstat\u3001dstat\u3002<\/span><\/span><\/p>\n<p style=\"letter-spacing: 0.544px;font-size: 14px;font-family:\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">\u25aa&nbsp;\u9ad8\u7ea7\u7684\u547d\u4ee4\u5982\u4e0b\uff1a<\/span><br \/><span style=\"line-height: 2\">sar\u3001netstat\u3001pidstat\u3001strace\u3001tcpdump\u3001blktrace\u3001iotop\u3001slabtop\u3001sysctl\u3001\/proc\u3002<\/span><\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">\u66f4\u591a\u53c2\u8003\uff1ahttp:\/\/www.open-open.com\/lib\/view\/open1434589043973.html\uff0c\u8be6\u7ec6\u7684\u547d\u4ee4\u4f7f\u7528\u65b9\u6cd5\u53ef\u4ee5\u53c2\u8003man<\/span><\/p>\n<p><span style=\"font-weight: 700\">\u4e8c\u3001Linux benchmarking tools | Linux \u6027\u80fd\u6d4b\u8bc4\u5de5\u5177<\/span><\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/275\/013\/2f136c52ec78b7ff3870b8ac10de1cfa-7.jpg\" class=\"aligncenter\" title=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe6\" alt=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe6\" \/><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">\u662f\u4e00\u6b3e\u6027\u80fd\u6d4b\u8bc4\u5de5\u5177\uff0c\u5bf9\u4e8e\u4e0d\u540c\u6a21\u5757\u7684\u6027\u80fd\u6d4b\u8bd5\u53ef\u4ee5\u4f7f\u7528\u76f8\u5e94\u7684\u5de5\u5177\uff0c\u60f3\u8981\u6df1\u5165\u4e86\u89e3\uff0c\u53ef\u4ee5\u53c2\u8003\u6700\u4e0b\u6587\u7684\u9644\u4ef6\u6587\u6863\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"line-height: 2;font-weight: 700;font-size: 15px\">\u4e09\u3001Linux tuning tools | Linux \u6027\u80fd\u8c03\u4f18\u5de5\u5177<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/275\/013\/ac65b056b001d44a8a7a039000f48fad-8.jpg\" class=\"aligncenter\" title=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe7\" alt=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe7\" \/><br \/><span style=\"max-width:90%\">\u662f\u4e00\u6b3e\u6027\u80fd\u8c03\u4f18\u5de5\u5177\uff0c\u4e3b\u8981\u662f\u4ecelinux\u5185\u6838\u6e90\u7801\u5c42\u8fdb\u884c\u7684\u8c03\u4f18\uff0c\u60f3\u8981\u6df1\u5165\u4e86\u89e3\uff0c\u53ef\u4ee5\u53c2\u8003\u4e0b\u6587\u9644\u4ef6\u6587\u6863\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-weight: 700;font-size: 15px\">\u56db\u3001Linux observability sar |&nbsp;linux\u6027\u80fd\u89c2\u6d4b\u5de5\u5177<\/span><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/275\/013\/ac65b056b001d44a8a7a039000f48fad-9.jpg\" class=\"aligncenter\" title=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe8\" alt=\"\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u63d2\u56fe8\" \/><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\">sar\uff08System Activity Reporter\u7cfb\u7edf\u6d3b\u52a8\u60c5\u51b5\u62a5\u544a\uff09\u662f\u76ee\u524dLINUX\u4e0a\u6700\u4e3a\u5168\u9762\u7684\u7cfb\u7edf\u6027\u80fd\u5206\u6790\u5de5\u5177\u4e4b\u4e00\uff0c\u53ef\u4ee5\u4ece\u591a\u65b9\u9762\u5bf9\u7cfb\u7edf\u7684\u6d3b\u52a8\u8fdb\u884c\u62a5\u544a\uff0c\u5305\u62ec\uff1a\u6587\u4ef6\u7684\u8bfb\u5199\u60c5\u51b5\u3001\u7cfb\u7edf\u8c03\u7528\u7684\u4f7f\u7528\u60c5\u51b5\u3001\u78c1\u76d8I\/O\u3001CPU\u6548\u7387\u3001\u5185\u5b58\u4f7f\u7528\u72b6\u51b5\u3001\u8fdb\u7a0b\u6d3b\u52a8\u53caIPC\u6709\u5173\u7684\u6d3b\u52a8\u7b49\u65b9\u9762\u3002<\/span><\/p>\n<p style=\"font-family: -apple-system, BlinkMacSystemFont,\"><\/p>\n<p style=\"margin-right: 8px;margin-left: 8px;letter-spacing: 0.544px;font-size: 14px;font-family:\"><span style=\"font-size: 15px\"><span style=\"line-height: 2\">sar\u7684\u5e38\u5f52\u4f7f\u7528\u65b9\u5f0f\uff1asar &nbsp;[options] [-A] [-o file] &nbsp;t [n]<\/span><br \/><span style=\"line-height: 2\">\u5176\u4e2d\uff1a<\/span><br \/><span style=\"line-height: 2\">t\u4e3a\u91c7\u6837\u95f4\u9694\uff0cn\u4e3a\u91c7\u6837\u6b21\u6570\uff0c\u9ed8\u8ba4\u503c\u662f1\uff1b<\/span><br \/><span style=\"line-height: 2\">-o file\u8868\u793a\u5c06\u547d\u4ee4\u7ed3\u679c\u4ee5\u4e8c\u8fdb\u5236\u683c\u5f0f\u5b58\u653e\u5728\u6587\u4ef6\u4e2d\uff0cfile \u662f\u6587\u4ef6\u540d\u3002<\/span><br \/><span style=\"line-height: 2\">options \u4e3a\u547d\u4ee4\u884c\u9009\u9879<\/span><\/span><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u8d85\u5168\u6574\u7406 &#8211; Linux\u6027\u80fd\u5206\u6790\u5de5\u5177\u6c47\u603b\u5408\u96c6\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u51fa\u4e8e\u5bf9Linux\u64cd\u4f5c\u7cfb\u7edf\u7684\u5174\u8da3\uff0c\u4ee5\u53ca\u5bf9\u5e95\u5c42\u77e5\u8bc6\u7684\u5f3a\u70c8\u6b32\u671b\uff0c\u56e0\u6b64\u6574\u7406\u4e86\u8fd9\u7bc7\u6587\u7ae0\u3002\u672c\u6587\u4e5f\u53ef\u4ee5\u4f5c\u4e3a\u68c0\u9a8c\u57fa\u7840\u77e5\u8bc6\u7684\u6307\u6807\uff0c\u53e6\u5916\u6587\u7ae0\u6db5\u76d6\u4e86\u4e00\u4e2a\u7cfb\u7edf\u7684\u65b9\u65b9\u9762\u9762\u3002\u5982\u679c\u6ca1\u6709\u5b8c\u5584\u7684\u8ba1\u7b97\u673a\u7cfb\u7edf\u77e5\u8bc6\uff0c\u7f51\u7edc\u77e5\u8bc6\u548c\u64cd\u4f5c\u7cfb\u7edf\u77e5\u8bc6\uff0c\u6587\u6863\u4e2d\u7684\u5de5\u5177\uff0c\u662f\u4e0d\u53ef\u80fd\u5b8c\u5168\u638c\u63e1\u7684\uff0c\u53e6\u5916\u5bf9\u7cfb\u7edf\u6027\u80fd\u5206\u6790\u548c\u4f18\u5316\u662f\u4e00\u4e2a\u957f\u671f\u7684\u7cfb\u5217\u3002 \u672c\u6587\u6863\u4e3b\u8981\u662f\u7ed3\u5408Linux \u5927\u725b\uff0cNetflix \u9ad8\u7ea7\u6027\u80fd\u67b6\u6784\u5e08 Brendan Gregg \u66f4\u65b0 Linux \u6027\u80fd\u8c03\u4f18\u5de5\u5177\u7684\u535a\u6587\uff0c\u641c\u96c6Linux\u7cfb\u7edf\u6027\u80fd\u4f18\u5316\u76f8\u5173\u6587\u7ae0\u6574\u7406\u540e\u7684\u4e00\u7bc7\u7efc\u5408\u6027\u6587\u7ae0\uff0c\u4e3b\u8981\u662f\u7ed3\u5408\u535a\u6587\u5bf9\u6d89\u53ca\u5230\u7684\u539f\u7406\u548c\u6027\u80fd\u6d4b\u8bd5\u7684\u5de5\u5177\u5c55\u5f00\u8bf4\u660e\u3002 \u80cc\u666f\u77e5\u8bc6\uff1a\u5177\u5907\u80cc\u666f\u77e5\u8bc6\u662f\u5206\u6790\u6027\u80fd\u95ee\u9898\u65f6\u9700\u8981\u4e86\u89e3\u7684\u3002\u6bd4\u5982\u786c\u4ef6 cache\uff1b\u518d\u6bd4\u5982\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\u3002\u5e94\u7528\u7a0b\u5e8f\u7684\u884c\u4e3a\u7ec6\u8282\u5f80\u5f80\u662f\u548c\u8fd9\u4e9b\u4e1c\u897f\u4e92\u76f8\u7275\u626f\u7684\uff0c\u8fd9\u4e9b\u5e95\u5c42\u7684\u4e1c\u897f\u4f1a\u4ee5\u610f\u60f3\u4e0d\u5230\u7684\u65b9\u5f0f\u5f71\u54cd\u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\uff0c\u6bd4\u5982\u67d0\u4e9b\u7a0b\u5e8f\u65e0\u6cd5\u5145\u5206\u5229\u7528 cache\uff0c\u4ece\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002\u6bd4\u5982\u4e0d\u5fc5\u8981\u5730\u8c03\u7528\u8fc7\u591a\u7684\u7cfb\u7edf\u8c03\u7528\uff0c\u9020\u6210\u9891\u7e41\u7684\u5185\u6838 \/ \u7528\u6237\u5207\u6362\u7b49\u3002\u8fd9\u91cc\u53ea\u662f\u4e3a\u672c\u6587\u7684\u540e\u7eed\u5185\u5bb9\u505a\u4e00\u4e9b\u94fa\u57ab\uff0c\u5173\u4e8e\u8c03\u4f18\u8fd8\u6709\u5f88\u591a\u4e1c\u897f\uff0c\u6211\u6240\u4e0d\u77e5\u9053\u7684\u6bd4\u77e5\u9053\u7684\u8981\u591a\u7684\u591a\uff0c\u5e0c\u671b\u5927\u5bb6\u80fd\u5171\u540c\u5b66\u4e60\u8fdb\u6b65\u3002 \u3010\u6027\u80fd\u5206\u6790\u5de5\u5177\u3011 \u9996\u5148\u6765\u770b\u4e00\u5f20\u56fe\uff1a \u4e0a\u56fe\u662fBrendan Gregg \u7684\u4e00\u6b21\u6027\u80fd\u5206\u6790\u7684\u5206\u4eab\uff0c\u8fd9\u91cc\u9762\u7684\u6240\u6709\u5de5\u5177\u90fd\u53ef\u4ee5\u901a\u8fc7man\u6765\u83b7\u5f97\u5b83\u7684\u5e2e\u52a9\u6587\u6863\uff0c\u4e0b\u95ee\u7b80\u5355\u4ecb\u7ecd\u4ecb\u7ecd\u4e00\u4e0b\u5e38\u89c4\u7684\u7528\u6cd5\uff1a \u25b2 vmstat&#8211;\u865a\u62df\u5185\u5b58\u7edf\u8ba1 vmstat(VirtualMeomoryStatistics,\u865a\u62df\u5185\u5b58\u7edf\u8ba1) \u662fLinux\u4e2d\u76d1\u63a7\u5185\u5b58\u7684\u5e38\u7528\u5de5\u5177,\u53ef\u5bf9\u64cd\u4f5c\u7cfb\u7edf\u7684\u865a\u62df\u5185\u5b58\u3001\u8fdb\u7a0b\u3001CPU\u7b49\u7684\u6574\u4f53\u60c5\u51b5\u8fdb\u884c\u76d1\u89c6\u3002 vmstat\u7684\u5e38\u89c4\u7528\u6cd5\uff1avmstat interval times\u5373\u6bcf\u9694interval\u79d2\u91c7\u6837\u4e00\u6b21\uff0c\u5171\u91c7\u6837times\u6b21\uff0c\u5982\u679c\u7701\u7565times,\u5219\u4e00\u76f4\u91c7\u96c6\u6570\u636e\uff0c\u76f4\u5230\u7528\u6237\u624b\u52a8\u505c\u6b62\u4e3a\u6b62\u3002\u7b80\u5355\u4e3e\u4e2a\u4f8b\u5b50\uff1a \u53ef\u4ee5\u4f7f\u7528ctrl+c\u505c\u6b62vmstat\u91c7\u96c6\u6570\u636e\u3002 \u7b2c\u4e00\u884c\u663e\u793a\u4e86\u7cfb\u7edf\u81ea\u542f\u52a8\u4ee5\u6765\u7684\u5e73\u5747\u503c\uff0c\u7b2c\u4e8c\u884c\u5f00\u59cb\u663e\u793a\u73b0\u5728\u6b63\u5728\u53d1\u751f\u7684\u60c5\u51b5\uff0c\u63a5\u4e0b\u6765\u7684\u884c\u4f1a\u663e\u793a\u6bcf5\u79d2\u95f4\u9694\u53d1\u751f\u4e86\u4ec0\u4e48\uff0c\u6bcf\u4e00\u5217\u7684\u542b\u4e49\u5728\u5934\u90e8\uff0c\u5982\u4e0b\u6240\u793a\uff1a \u25aa procs\uff1ar\u8fd9\u4e00\u5217\u663e\u793a\u4e86\u591a\u5c11\u8fdb\u7a0b\u5728\u7b49\u5f85cpu\uff0cb\u5217\u663e\u793a\u591a\u5c11\u8fdb\u7a0b\u6b63\u5728\u4e0d\u53ef\u4e2d\u65ad\u7684\u4f11\u7720\uff08\u7b49\u5f85IO\uff09\u3002 \u25aa&nbsp;memory\uff1aswapd\u5217\u663e\u793a\u4e86\u591a\u5c11\u5757\u88ab\u6362\u51fa\u4e86\u78c1\u76d8\uff08\u9875\u9762\u4ea4\u6362\uff09\uff0c\u5269\u4e0b\u7684\u5217\u663e\u793a\u4e86\u591a\u5c11\u5757\u662f\u7a7a\u95f2\u7684\uff08\u672a\u88ab\u4f7f\u7528\uff09\uff0c\u591a\u5c11\u5757\u6b63\u5728\u88ab\u7528\u4f5c\u7f13\u51b2\u533a\uff0c\u4ee5\u53ca\u591a\u5c11\u6b63\u5728\u88ab\u7528\u4f5c\u64cd\u4f5c\u7cfb\u7edf\u7684\u7f13\u5b58\u3002 \u25aa&nbsp;swap\uff1a\u663e\u793a\u4ea4\u6362\u6d3b\u52a8\uff1a\u6bcf\u79d2\u6709\u591a\u5c11\u5757\u6b63\u5728\u88ab\u6362\u5165\uff08\u4ece\u78c1\u76d8\uff09\u548c\u6362\u51fa\uff08\u5230\u78c1\u76d8\uff09\u3002 \u25aa&nbsp;io\uff1a\u663e\u793a\u4e86\u591a\u5c11\u5757\u4ece\u5757\u8bbe\u5907\u8bfb\u53d6\uff08bi\uff09\u548c\u5199\u51fa\uff08bo\uff09,\u901a\u5e38\u53cd\u6620\u4e86\u786c\u76d8I\/O\u3002 \u25aa system\uff1a\u663e\u793a\u6bcf\u79d2\u4e2d\u65ad(in)\u548c\u4e0a\u4e0b\u6587\u5207\u6362\uff08cs\uff09\u7684\u6570\u91cf\u3002 \u25aa cpu\uff1a\u663e\u793a\u6240\u6709\u7684cpu\u65f6\u95f4\u82b1\u8d39\u5728\u5404\u7c7b\u64cd\u4f5c\u7684\u767e\u5206\u6bd4\uff0c\u5305\u62ec\u6267\u884c\u7528\u6237\u4ee3\u7801\uff08\u975e\u5185\u6838\uff09\uff0c\u6267\u884c\u7cfb\u7edf\u4ee3\u7801\uff08\u5185\u6838\uff09\uff0c\u7a7a\u95f2\u4ee5\u53ca\u7b49\u5f85IO\u3002 \u5185\u5b58\u4e0d\u8db3\u7684\u8868\u73b0\uff1afree &nbsp;memory\u6025\u5267\u51cf\u5c11\uff0c\u56de\u6536buffer\u548ccacher\u4e5f\u65e0\u6d4e\u4e8e\u4e8b\uff0c\u5927\u91cf\u4f7f\u7528\u4ea4\u6362\u5206\u533a\uff08swpd\uff09,\u9875\u9762\u4ea4\u6362\uff08swap\uff09\u9891\u7e41\uff0c\u8bfb\u5199\u78c1\u76d8\u6570\u91cf\uff08io\uff09\u589e\u591a\uff0c\u7f3a\u9875\u4e2d\u65ad\uff08in\uff09\u589e\u591a\uff0c\u4e0a\u4e0b\u6587\u5207\u6362\uff08cs\uff09\u6b21\u6570\u589e\u591a\uff0c\u7b49\u5f85IO\u7684\u8fdb\u7a0b\u6570\uff08b\uff09\u589e\u591a\uff0c\u5927\u91cfCPU\u65f6\u95f4\u7528\u4e8e\u7b49\u5f85IO\uff08wa\uff09 \u25b2iostat&#8211;\u7528\u4e8e\u62a5\u544a\u4e2d\u592e\u5904\u7406\u5668\u7edf\u8ba1\u4fe1\u606f iostat\u7528\u4e8e\u62a5\u544a\u4e2d\u592e\u5904\u7406\u5668\uff08CPU\uff09\u7edf\u8ba1\u4fe1\u606f\u548c\u6574\u4e2a\u7cfb\u7edf\u3001\u9002\u914d\u5668\u3001tty \u8bbe\u5907\u3001\u78c1\u76d8\u548c CD-ROM \u7684\u8f93\u5165\/\u8f93\u51fa\u7edf\u8ba1\u4fe1\u606f\uff0c\u9ed8\u8ba4\u663e\u793a\u4e86\u4e0evmstat\u76f8\u540c\u7684cpu\u4f7f\u7528\u4fe1\u606f\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u663e\u793a\u6269\u5c55\u7684\u8bbe\u5907\u7edf\u8ba1\uff1a \u7b2c\u4e00\u884c\u663e\u793a\u7684\u662f\u81ea\u7cfb\u7edf\u542f\u52a8\u4ee5\u6765\u7684\u5e73\u5747\u503c\uff0c\u7136\u540e\u663e\u793a\u589e\u91cf\u7684\u5e73\u5747\u503c\uff0c\u6bcf\u4e2a\u8bbe\u5907\u4e00\u884c\u3002 \u5e38\u89c1\u7684\u78c1\u76d8IO\u6307\u6807\u7684\u7f29\u5199\u4e60\u60ef\uff1arq\u662frequest,r\u662fread,w\u662fwrite,qu\u662fqueue\uff0csz\u662fsize,a\u662fverage,tm\u662ftime,svc\u662fservice\u3002 \u25aarrqm\/s\u548cwrqm\/s\uff1a\u6bcf\u79d2\u5408\u5e76\u7684\u8bfb\u548c\u5199\u8bf7\u6c42\uff0c\u201c\u5408\u5e76\u7684\u201d\u610f\u5473\u7740\u64cd\u4f5c\u7cfb\u7edf\u4ece\u961f\u5217\u4e2d\u62ff\u51fa\u591a\u4e2a\u903b\u8f91\u8bf7\u6c42\u5408\u5e76\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u5230\u5b9e\u9645\u78c1\u76d8\u3002 \u25aar\/s\u548cw\/s\uff1a\u6bcf\u79d2\u53d1\u9001\u5230\u8bbe\u5907\u7684\u8bfb\u548c\u5199\u8bf7\u6c42\u6570\u3002 \u25aarsec\/s\u548cwsec\/s\uff1a\u6bcf\u79d2\u8bfb\u548c\u5199\u7684\u6247\u533a\u6570\u3002 \u25aaavgrq \u2013sz\uff1a\u8bf7\u6c42\u7684\u6247\u533a\u6570\u3002 \u25aaavgqu \u2013sz\uff1a\u5728\u8bbe\u5907\u961f\u5217\u4e2d\u7b49\u5f85\u7684\u8bf7\u6c42\u6570\u3002 \u25aaawait\uff1a\u6bcf\u4e2aIO\u8bf7\u6c42\u82b1\u8d39\u7684\u65f6\u95f4\u3002 \u25aasvctm\uff1a\u5b9e\u9645\u8bf7\u6c42\uff08\u670d\u52a1\uff09\u65f6\u95f4\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-62143","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/62143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=62143"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/62143\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=62143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=62143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=62143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}