{"id":2935,"date":"2021-06-21T22:13:41","date_gmt":"2021-06-21T14:13:41","guid":{"rendered":"\/?p=2935"},"modified":"2021-06-22T22:14:24","modified_gmt":"2021-06-22T14:14:24","slug":"6-6-%e6%80%a7%e8%83%bd%e5%88%86%e6%9e%90%e7%9a%84%e4%b8%80%e8%88%ac%e6%80%9d%e8%b7%af","status":"publish","type":"post","link":"http:\/\/xinblog.ltd\/?p=2935","title":{"rendered":"6.6 \u6027\u80fd\u5206\u6790\u7684\u4e00\u822c\u601d\u8def"},"content":{"rendered":"<p>\u6211\u4eec\u5c06\u5e94\u7528\u7a0b\u5e8f\u7684\u76d1\u63a7,\u5206\u4e3a\u4e86\u6307\u6807\u76d1\u63a7\u548c\u65e5\u5fd7\u76d1\u63a7\u4e24\u4e2a\u5927\u5757<\/p>\n<p>\u6307\u6807\u76d1\u63a7,\u4e3b\u8981\u662f\u5bf9\u4e00\u5b9a\u65f6\u95f4\u6bb5\u7684\u6027\u80fd\u6307\u6807\u8fdb\u884c\u6d4b\u91cf,\u7136\u540e\u901a\u8fc7\u65f6\u95f4\u5e8f\u5217,\u8fdb\u884c\u544a\u8b66,\u67e5\u8be2<\/p>\n<p>\u65e5\u5fd7\u76d1\u63a7,\u5219\u662f\u63d0\u4f9b\u66f4\u52a0\u8be6\u7ec6\u4e0a\u4e0b\u6587\u4fe1\u606f,\u8fdb\u884c\u56fe\u5f62\u5316\u5c55\u793a<\/p>\n<p>\u8de8\u4e0d\u540c\u5e94\u7528\u7684\u590d\u6742\u4e1a\u52a1\u4e2d,\u53ef\u4ee5\u6784\u5efa\u5168\u94fe\u8def\u8ddf\u8e2a\u7cfb\u7edf,\u5c31\u53ef\u4ee5\u52a8\u6001\u7684\u8ddf\u8e2a\u5404\u4e2a\u7ec4\u4ef6\u7684\u6027\u80fd,\u751f\u6210\u6574\u4e2a\u5e94\u7528\u7684\u8c03\u7528\u62d3\u8865\u56fe,\u52a0\u5feb\u5b9a\u4f4d\u590d\u6742\u4e3a\u9898\u7684\u80fd\u529b<\/p>\n<p>\u8bf4\u5b8c\u4e86\u4e0a\u9762\u7684\u76d1\u63a7,\u6211\u4eec\u4eca\u5929\u8bf4\u4e00\u4e0b\u6027\u80fd\u5206\u6790\u7684\u5e38\u89c1\u601d\u8def<\/p>\n<p>\u8fd8\u662f\u5c06\u5176\u5206\u4e3a\u4e86\u7cfb\u7edf\u8d44\u6e90\u548c\u5e94\u7528\u7a0b\u5e8f<\/p>\n<p>\u800c\u7cfb\u7edf\u8d44\u6e90\u4e4b\u4e2d,\u53ef\u4ee5\u4f7f\u7528USE\u6cd5,\u4f7f\u7528\u4f7f\u7528\u7387 \u9971\u548c\u5ea6 \u9519\u8bef\u7387\u8fdb\u884c\u8861\u91cf,\u5185\u90e8\u5206\u4e3a\u4e86\u786c\u4ef6\u8d44\u6e90\u548c\u8f6f\u4ef6\u8d44\u6e90<\/p>\n<p>\u786c\u4ef6\u6709CPU \u5185\u5b58 \u78c1\u76d8\u548c\u6587\u4ef6\u7cfb\u7edf \u7f51\u7edc\u7b49<\/p>\n<p>\u8f6f\u4ef6\u6709 \u6587\u4ef6\u63cf\u8ff0\u7b26\u6570 \u94fe\u63a5\u8ddf\u8e2a\u6570 \u5957\u63a5\u5b57\u7f13\u51b2\u533a\u5927\u5c0f,\u5219\u662f\u5178\u578b\u7684\u8f6f\u4ef6\u8d44\u6e90<\/p>\n<p>\u9996\u5148\u662fCPU\u7684\u6027\u80fd\u5206\u6790<\/p>\n<p>\u6574\u4f53\u7684\u4e00\u5f20\u56fe\u5982\u4e0b<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"839\" height=\"1014\" class=\"wp-image-2936\" src=\"\/wp-content\/uploads\/2021\/06\/unnamed-file-31.png\" alt=\"\u56fe\u7247\" srcset=\"http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-31.png 839w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-31-248x300.png 248w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-31-768x928.png 768w\" sizes=\"(max-width: 839px) 100vw, 839px\" \/><\/p>\n<p>\u5b9e\u9645\u4e0a,top pidstat vmstat\u8fd9\u7c7b\u7684\u5de5\u5177\u6c47\u62a5\u7684CPU\u6027\u80fd\u6307\u6807,\u6e90\u81ea\/proc\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u76d1\u63a7\/proc\u6587\u4ef6\u7cfb\u7edf,\u4ee5\u53ca\u5206\u522b\u67e5\u770b\u7cfb\u7edf\u7ea7\u522b\u7684CPU\u8fc7\u9ad8\u548c\u8fdb\u7a0b\u7ea7\u522b\u7684CPU\u8fc7\u9ad8<\/p>\n<p>\u7136\u540e\u662f\u5185\u5b58\u5206\u6790,\u5bf9\u4e8e\u5185\u5b58\u5206\u6790,\u9996\u5148\u5b9a\u4f4d\u6574\u4f53\u5185\u5b58\u74f6\u9888,\u7136\u540e\u8fdb\u884c\u8fdb\u7a0b\u7ea7\u522b\u7684\u5185\u5b58\u4f7f\u7528 \u5206\u914d \u6cc4\u9732,\u627e\u51fa\u95ee\u9898\u6839\u6e90<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1629\" height=\"885\" class=\"wp-image-2937\" src=\"\/wp-content\/uploads\/2021\/06\/unnamed-file-32.png\" alt=\"\u56fe\u7247\" srcset=\"http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-32.png 1629w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-32-300x163.png 300w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-32-1024x556.png 1024w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-32-768x417.png 768w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-32-1536x834.png 1536w\" sizes=\"(max-width: 1629px) 100vw, 1629px\" \/><\/p>\n<p>\u5982\u540cCPU\u6027\u80fd\u4e00\u6837,\u5f88\u591a\u5185\u5b58\u7684\u6027\u80fd\u6307\u6807,\u90fd\u6765\u6e90\u4e8e\/proc\u6587\u4ef6\u7cfb\u7edf \/proc\/meminfo \/proc\/slabinfo\u8fdb\u884c\u76d1\u63a7\u544a\u8b66,\u52a0\u5feb\u95ee\u9898\u5b9a\u4f4d<\/p>\n<p>\u63a5\u4e0b\u6765,\u5c31\u662f\u78c1\u76d8\u548c\u6587\u4ef6\u7cfb\u7edf\u7684IO\u6027\u80fd\u5206\u6790<\/p>\n<p>\u5173\u4e8e\u78c1\u76d8\u548c\u6587\u4ef6\u7cfb\u7edf\u7684IO\u6027\u80fd\u5206\u6790,\u4e4b\u524d\u4e5f\u6709\u8bf4\u8fc7<\/p>\n<p>\u53ef\u4ee5\u5148\u4f7f\u7528iostat\u67e5\u8be2\u78c1\u76d8IO\u7684\u6027\u80fd\u74f6\u9888,\u7136\u540e\u901a\u8fc7pidstat vmstat\u786e\u8ba4IO\u6765\u6e90<\/p>\n<p>\u6839\u636e\u6765\u6e90\u7684\u4e0d\u540c,\u8fdb\u4e00\u6b65\u7684\u5206\u6790\u6587\u4ef6\u7cfb\u7edf\u548c\u78c1\u76d8\u7684\u4f7f\u7528\u7387,\u7f13\u5b58\u4ee5\u53ca\u8fdb\u7a0bIO\u7b49<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"3732\" height=\"1886\" class=\"wp-image-2938\" src=\"\/wp-content\/uploads\/2021\/06\/unnamed-file-33.png\" alt=\"\u56fe\u7247\" srcset=\"http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-33.png 3732w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-33-300x152.png 300w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-33-1024x517.png 1024w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-33-768x388.png 768w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-33-1536x776.png 1536w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-33-2048x1035.png 2048w\" sizes=\"(max-width: 3732px) 100vw, 3732px\" \/><\/p>\n<p>\u540cCPU\u548c\u5185\u5b58\u6027\u80fd\u7c7b\u4f3c,\u5f88\u591a\u78c1\u76d8\u548c\u6587\u4ef6\u7cfb\u7edf\u7684\u6765\u6e90\u90fd\u662f\/proc \/sys\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>\u540c\u6837\u53ef\u4ee5\u8fdb\u884c\u76d1\u63a7,\u7136\u540e\u8fdb\u884c\u5224\u65ad,\u9996\u5148\u4ece\u76d1\u63a7\u7cfb\u7edf\u4e2d,\u627e\u5230IO\u6700\u591a\u7684\u8fdb\u7a0b,\u7136\u540e\u5206\u6790\u8fdb\u7a0b\u7684IO\u884c\u4e3a<\/p>\n<p>\u7f51\u7edc\u6027\u80fd\u5206\u6790<\/p>\n<p>\u6700\u540e\u7684\u7f51\u7edc\u6027\u80fd,\u5305\u542b\u4e24\u7c7b\u8d44\u6e90,\u5206\u522b\u662f\u7f51\u7edc\u63a5\u53e3\u548c\u5185\u6838\u8d44\u6e90,\u7f51\u7edc\u6027\u80fd\u7684\u5206\u6790,\u4eceLinux\u7f51\u7edc\u534f\u8bae\u6808\u7684\u539f\u7406\u6765\u5207\u5165,\u4e0b\u9762\u7684\u56fe,\u5c31\u662fLinux\u7f51\u7edc\u534f\u8bae\u6808\u7684\u57fa\u672c\u539f\u7406,\u5305\u62ec\u5e94\u7528\u5c42,\u5957\u63a5\u5b57\u63a5\u53e3,\u4f20\u8f93\u5c42<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1826\" height=\"1242\" class=\"wp-image-2939\" src=\"\/wp-content\/uploads\/2021\/06\/unnamed-file-34.png\" alt=\"\u56fe\u7247\" srcset=\"http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-34.png 1826w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-34-300x204.png 300w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-34-1024x696.png 1024w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-34-768x522.png 768w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2021\/06\/unnamed-file-34-1536x1045.png 1536w\" sizes=\"(max-width: 1826px) 100vw, 1826px\" \/><\/p>\n<p>\u94fe\u8def\u5c42,\u53ef\u4ee5\u4ece\u7f51\u7edc\u63a5\u53e3\u7684\u541e\u5410\u91cf \u4e22\u5305 \u9519\u8bef \u4ee5\u53ca\u8f6f\u4e2d\u65ad\u548c\u7f51\u7edc\u529f\u80fd\u5378\u8f7d\u8fdb\u884c\u5206\u6790<\/p>\n<p>\u7f51\u7edc\u5c42 \u4ece\u8def\u7531 \u5206\u7247 \u53e0\u52a0\u7f51\u7edc\u7b49\u89d2\u5ea6\u5206\u6790<\/p>\n<p>\u4f20\u8f93\u5c42,\u4eceTCP UDP\u7b49\u539f\u7406\u51fa\u53d1,\u4ece\u8fde\u63a5\u6570 \u541e\u5410\u91cf \u5ef6\u8fdf \u91cd\u4f20\u7b49\u89d2\u5ea6\u5206\u6790<\/p>\n<p>\u5e94\u7528\u5c42,\u4ece\u5e94\u7528\u5c42\u534f\u8bae \u8bf7\u6c42\u6570 \u5957\u63a5\u5b57\u7f13\u5b58\u7b49\u89d2\u5ea6\u5206\u6790<\/p>\n<p>\u7f51\u7edc\u7684\u6027\u80fd\u6307\u6807\u6765\u6e90\u4e8e\u5185\u6838,\u5305\u62ec\/proc\u6587\u4ef6\u7cfb\u7edf \u7f51\u7edc\u63a5\u53e3\u4ee5\u53caconntrack\u5185\u6838\u6a21\u5757,\u4e5f\u9700\u8981\u88ab\u76d1\u63a7,\u8fd9\u6837,\u5f53\u6536\u5230\u7f51\u7edc\u544a\u8b66\u7684\u65f6\u5019,\u53ef\u4ee5\u66f4\u5feb\u7684\u5b9a\u4f4d\u51fa\u95ee\u9898<\/p>\n<p>\u5f53\u6536\u5230\u7f51\u7edc\u4e0d\u540c\u7684\u544a\u8b66\u7684\u65f6\u5019,\u53ef\u4ee5\u67e5\u627e\u5404\u4e2a\u5c42\u6b21\u7684\u4e22\u5305\u6307\u6807,\u786e\u8ba4\u6240\u5728\u534f\u8bae\u5c42,\u786e\u8ba4\u7f51\u7edc\u5e26\u5bbd \u7f13\u51b2\u533a \u8ddf\u8e2a\u6570\u7b49\u8f6f\u786c\u4ef6,\u7136\u540e\u5206\u6790\u7f51\u7edc\u7684\u6536\u53d1\u6570\u636e,\u786e\u8ba4\u95ee\u9898<\/p>\n<p>\u8bf4\u5b8c\u4e86\u7cfb\u7edf\u8d44\u6e90,\u8bf4\u4e00\u4e0b\u5e94\u7528\u7a0b\u5e8f\u7684\u76f8\u5173\u74f6\u9888<\/p>\n<p>\u5bf9\u4e8e\u5e94\u7528\u7a0b\u5e8f\u7684\u74f6\u9888,\u8bc4\u5224\u6807\u51c6\u53ef\u4ee5\u6709\u541e\u5410\u91cf \u4e0b\u964d \u9519\u8bef\u7387\u5347\u9ad8\u548c\u54cd\u5e94\u65f6\u95f4\u589e\u5927<\/p>\n<p>\u5bf9\u4e8e\u51fa\u73b0\u7684\u95ee\u9898,\u53ef\u4ee5\u5206\u4e3a\u8d44\u6e90\u74f6\u9888 \u4f9d\u8d56\u670d\u52a1\u74f6\u9888 \u5e94\u7528\u81ea\u8eab\u74f6\u9888<\/p>\n<p>\u7b2c\u4e00\u79cd\u8d44\u6e90\u74f6\u9888,\u6307\u7684\u662f\u63d0\u5230CPU \u5185\u5b58 \u78c1\u76d8\u548c\u6587\u4ef6\u7cfb\u7edfIO \u7f51\u7edc\u4ee5\u53ca\u5185\u6838\u8d44\u6e90\u8f6f\u786c\u4ef6\u8fdb\u884c\u4e86\u74f6\u9888,\u4ece\u800c\u5bfc\u81f4\u7684\u5e94\u7528\u7a0b\u5e8f\u53d7\u9650<\/p>\n<p>\u7b2c\u4e8c\u79cd,\u4f9d\u8d56\u670d\u52a1\u74f6\u9888,\u8bf8\u5982\u6570\u636e\u5e93 \u5206\u5e03\u5f0f\u7f13\u5b58 \u4e2d\u95f4\u4ef6\u7b49\u5e94\u7528\u7a0b\u5e8f,\u76f4\u63a5\u6216\u8005\u95f4\u63a5\u7684\u670d\u52a1\u51fa\u73b0\u4e86\u6027\u80fd\u95ee\u9898,\u5bfc\u81f4\u7684\u5e94\u7528\u7a0b\u5e8f\u54cd\u5e94\u53d8\u6162,\u9519\u8bef\u7387\u5347\u9ad8,\u8bf4\u767d\u4e86\u5c31\u662f\u8de8\u5e94\u7528\u7684\u6027\u80fd\u95ee\u9898,\u4f7f\u7528\u5168\u94fe\u8def\u7cfb\u7edf,\u53ef\u4ee5\u5b9a\u4f4d\u8fd9\u4e2a\u6839\u6e90<\/p>\n<p>\u7b2c\u4e09\u79cd,\u5e94\u7528\u7a0b\u5e8f\u81ea\u8eab\u7684\u6027\u80fd\u95ee\u9898,\u5305\u62ec\u591a\u7ebf\u7a0b\u5904\u7406\u4e0d\u5f53,\u6b7b\u9501,\u4e1a\u52a1\u7b97\u6cd5\u590d\u6742\u5ea6\u7b49,\u8fd9\u9700\u8981\u6211\u4eec\u66b4\u9732\u51fa\u5bf9\u5e94\u7684\u65e5\u5fd7,\u65b9\u4fbf\u67e5\u770b<\/p>\n<p>\u51fa\u73b0\u62a5\u8b66\u4e4b\u540e,\u5229\u7528\u8fd9\u4e9b\u624b\u6bb5\u67e5\u627e\u51fa\u74f6\u9888,\u53ef\u4ee5\u5229\u7528\u7cfb\u7edf\u8d44\u6e90\u6a21\u5757\u6765\u8fdb\u884c\u5206\u6790\u5b9a\u4f4d,\u6bd4\u5982<\/p>\n<p>strace,\u89c2\u5bdf\u7cfb\u7edf\u8c03\u7528<\/p>\n<p>\u4f7f\u7528perf\u548c\u706b\u7130\u56fe \u5206\u6790\u70ed\u70b9\u51fd\u6570<\/p>\n<p>\u4f7f\u7528\u52a8\u6001\u8ddf\u8e2a,\u5206\u6790\u8fdb\u7a0b\u72b6\u6001<\/p>\n<p>\u6700\u540e\u603b\u7ed3\u4e00\u4e0b,<\/p>\n<p>\u7cfb\u7edf\u8d44\u6e90\u548c\u5e94\u7528\u7a0b\u5e8f\u662f\u5bc6\u4e0d\u53ef\u5206\u7684,\u5f88\u591a\u8d44\u6e90\u74f6\u9888,\u662f\u7531\u7a0b\u5e8f\u81ea\u8eab\u8fd0\u884c\u5bfc\u81f4\u7684,\u8fdb\u7a0b\u7684\u5185\u5b58\u6cc4\u9732,\u4f1a\u5bfc\u81f4\u5185\u5b58\u4e0d\u8db3,\u8fdb\u7a0b\u8fc7\u591a\u7684IO,\u62d6\u6162\u7cfb\u7edf\u6574\u4f53IO\u8bf7\u6c42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u4eec\u5c06\u5e94\u7528\u7a0b\u5e8f\u7684\u76d1\u63a7,\u5206\u4e3a\u4e86\u6307 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"_links":{"self":[{"href":"http:\/\/xinblog.ltd\/index.php?rest_route=\/wp\/v2\/posts\/2935"}],"collection":[{"href":"http:\/\/xinblog.ltd\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xinblog.ltd\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xinblog.ltd\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xinblog.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2935"}],"version-history":[{"count":0,"href":"http:\/\/xinblog.ltd\/index.php?rest_route=\/wp\/v2\/posts\/2935\/revisions"}],"wp:attachment":[{"href":"http:\/\/xinblog.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xinblog.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2935"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xinblog.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}