{"id":6049,"date":"2016-09-19T10:29:32","date_gmt":"2016-09-19T02:29:32","guid":{"rendered":"https:\/\/kyle.ai\/blog\/?p=6049"},"modified":"2016-09-19T10:29:32","modified_gmt":"2016-09-19T02:29:32","slug":"%e5%a6%82%e4%bd%95%e7%94%a8%e5%8d%81%e6%9d%a1%e5%91%bd%e4%bb%a4%e5%9c%a8%e4%b8%80%e5%88%86%e9%92%9f%e5%86%85%e6%a3%80%e6%9f%a5linux%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%80%a7%e8%83%bd","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/6049.html","title":{"rendered":"\u5982\u4f55\u7528\u5341\u6761\u547d\u4ee4\u5728\u4e00\u5206\u949f\u5185\u68c0\u67e5Linux\u670d\u52a1\u5668\u6027\u80fd"},"content":{"rendered":"<p>\u901a\u8fc7\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u53ef\u4ee5\u57281\u5206\u949f\u5185\u5bf9\u7cfb\u7edf\u8d44\u6e90\u4f7f\u7528\u60c5\u51b5\u6709\u4e2a\u5927\u81f4\u7684\u4e86\u89e3\u3002<\/p>\n<ul>\n<li>uptime<\/li>\n<li>dmesg | tail<\/li>\n<li>vmstat 1<\/li>\n<li>mpstat -P ALL 1<\/li>\n<li>pidstat 1<\/li>\n<li>iostat -xz 1<\/li>\n<li>free -m<\/li>\n<li>sar -n DEV 1<\/li>\n<li>sar -n TCP,ETCP 1<\/li>\n<li>top<\/li>\n<\/ul>\n<p>\u5176\u4e2d\u4e00\u4e9b\u547d\u4ee4\u9700\u8981\u5b89\u88c5sysstat\u5305\uff0c\u6709\u4e00\u4e9b\u7531procps\u5305\u63d0\u4f9b\u3002\u8fd9\u4e9b\u547d\u4ee4\u7684\u8f93\u51fa\uff0c\u6709\u52a9\u4e8e\u5feb\u901f\u5b9a\u4f4d\u6027\u80fd\u74f6\u9888\uff0c\u68c0\u67e5\u51fa\u6240\u6709\u8d44\u6e90\uff08CPU\u3001\u5185\u5b58\u3001\u78c1\u76d8IO\u7b49\uff09\u7684\u5229\u7528\u7387\uff08utilization\uff09\u3001\u9971\u548c\u5ea6\uff08saturation\uff09\u548c\u9519\u8bef\uff08error\uff09\u5ea6\u91cf\uff0c\u4e5f\u5c31\u662f\u6240\u8c13\u7684USE\u65b9\u6cd5\u3002<\/p>\n<p>\u4e0b\u9762\u6211\u4eec\u6765\u9010\u4e00\u4ecb\u7ecd\u4e0b\u8fd9\u4e9b\u547d\u4ee4\uff0c\u6709\u5173\u8fd9\u4e9b\u547d\u4ee4\u66f4\u591a\u7684\u53c2\u6570\u548c\u8bf4\u660e\uff0c\u8bf7\u53c2\u7167\u547d\u4ee4\u7684\u624b\u518c\u3002<\/p>\n<p><a name=\"uptime\"><\/a><\/p>\n<h2>uptime<\/h2>\n<pre>$ uptime\r\n\r\n23:51:26 up 21:31,  1 user,  load average: 30.02, 26.43, 19.02\r\n<\/pre>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u53ef\u4ee5\u5feb\u901f\u67e5\u770b\u673a\u5668\u7684\u8d1f\u8f7d\u60c5\u51b5\u3002\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u8fd9\u4e9b\u6570\u636e\u8868\u793a\u7b49\u5f85CPU\u8d44\u6e90\u7684\u8fdb\u7a0b\u548c\u963b\u585e\u5728\u4e0d\u53ef\u4e2d\u65adIO\u8fdb\u7a0b\uff08\u8fdb\u7a0b\u72b6\u6001\u4e3aD\uff09\u7684\u6570\u91cf\u3002\u8fd9\u4e9b\u6570\u636e\u53ef\u4ee5\u8ba9\u6211\u4eec\u5bf9\u7cfb\u7edf\u8d44\u6e90\u4f7f\u7528\u6709\u4e00\u4e2a\u5b8f\u89c2\u7684\u4e86\u89e3\u3002<\/p>\n<p>\u547d\u4ee4\u7684\u8f93\u51fa\u5206\u522b\u8868\u793a1\u5206\u949f\u30015\u5206\u949f\u300115\u5206\u949f\u7684\u5e73\u5747\u8d1f\u8f7d\u60c5\u51b5\u3002\u901a\u8fc7\u8fd9\u4e09\u4e2a\u6570\u636e\uff0c\u53ef\u4ee5\u4e86\u89e3\u670d\u52a1\u5668\u8d1f\u8f7d\u662f\u5728\u8d8b\u4e8e\u7d27\u5f20\u8fd8\u662f\u8d8b\u4e8e\u7f13\u89e3\u3002\u5982\u679c1\u5206\u949f\u5e73\u5747\u8d1f\u8f7d\u5f88\u9ad8\uff0c\u800c15\u5206\u949f\u5e73\u5747\u8d1f\u8f7d\u5f88\u4f4e\uff0c\u8bf4\u660e\u670d\u52a1\u5668\u6b63\u5728\u547d\u4ee4\u9ad8\u8d1f\u8f7d\u60c5\u51b5\uff0c\u9700\u8981\u8fdb\u4e00\u6b65\u6392\u67e5CPU\u8d44\u6e90\u90fd\u6d88\u8017\u5728\u4e86\u54ea\u91cc\u3002\u53cd\u4e4b\uff0c\u5982\u679c15\u5206\u949f\u5e73\u5747\u8d1f\u8f7d\u5f88\u9ad8\uff0c1\u5206\u949f\u5e73\u5747\u8d1f\u8f7d\u8f83\u4f4e\uff0c\u5219\u6709\u53ef\u80fd\u662fCPU\u8d44\u6e90\u7d27\u5f20\u65f6\u523b\u5df2\u7ecf\u8fc7\u53bb\u3002<\/p>\n<p>\u4e0a\u9762\u4f8b\u5b50\u4e2d\u7684\u8f93\u51fa\uff0c\u53ef\u4ee5\u770b\u89c1\u6700\u8fd11\u5206\u949f\u7684\u5e73\u5747\u8d1f\u8f7d\u975e\u5e38\u9ad8\uff0c\u4e14\u8fdc\u9ad8\u4e8e\u6700\u8fd115\u5206\u949f\u8d1f\u8f7d\uff0c\u56e0\u6b64\u6211\u4eec\u9700\u8981\u7ee7\u7eed\u6392\u67e5\u5f53\u524d\u7cfb\u7edf\u4e2d\u6709\u4ec0\u4e48\u8fdb\u7a0b\u6d88\u8017\u4e86\u5927\u91cf\u7684\u8d44\u6e90\u3002\u53ef\u4ee5\u901a\u8fc7\u4e0b\u6587\u5c06\u4f1a\u4ecb\u7ecd\u7684vmstat\u3001mpstat\u7b49\u547d\u4ee4\u8fdb\u4e00\u6b65\u6392\u67e5\u3002<\/p>\n<p><a name=\"dmesg\u4e28tail\"><\/a><\/p>\n<h2>dmesg\u4e28tail<\/h2>\n<pre>$ dmesg | tail\r\n\r\n[1880957.563150] perl invoked oom-killer: gfp_mask=0x280da, order=0, oom_score_adj=0\r\n\r\n[...]\r\n\r\n[1880957.563400] Out of memory: Kill process 18694 (perl) score 246 or sacrifice child\r\n\r\n[1880957.563408] Killed process 18694 (perl) total-vm:1972392kB, anon-rss:1953348kB, file-rss:0kB\r\n\r\n[2320864.954447] TCP: Possible SYN flooding on port 7001. Dropping\r\n\r\nrequest.  Check SNMP counters.\r\n<\/pre>\n<p>\u8be5\u547d\u4ee4\u4f1a\u8f93\u51fa\u7cfb\u7edf\u65e5\u5fd7\u7684\u6700\u540e10\u884c\u3002\u793a\u4f8b\u4e2d\u7684\u8f93\u51fa\uff0c\u53ef\u4ee5\u770b\u89c1\u4e00\u6b21\u5185\u6838\u7684oom kill\u548c\u4e00\u6b21TCP\u4e22\u5305\u3002\u8fd9\u4e9b\u65e5\u5fd7\u53ef\u4ee5\u5e2e\u52a9\u6392\u67e5\u6027\u80fd\u95ee\u9898\u3002\u5343\u4e07\u4e0d\u8981\u5fd8\u4e86\u8fd9\u4e00\u6b65\u3002<\/p>\n<p><a name=\"vmstat-1\"><\/a><\/p>\n<h2>vmstat 1<\/h2>\n<pre>$ vmstat 1\r\n\r\nprocs ---------memory---------- ---swap-- -----io---- -system-- ------cpu-----\r\n\r\n r  b swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\r\n\r\n34  0    0 200889792  73708 591828    0    0     0     5    6   10 96  1  3  0  0\r\n\r\n32  0    0 200889920  73708 591860    0    0     0   592 13284 4282 98  1  1  0  0\r\n\r\n32  0    0 200890112  73708 591860    0    0     0     0 9501 2154 99  1  0  0  0\r\n\r\n32  0    0 200889568  73712 591856    0    0     0    48 11900 2459 99  0  0  0  0\r\n\r\n32  0    0 200890208  73712 591860    0    0     0     0 15898 4840 98  1  1  0  0\r\n\r\n^C\r\n<\/pre>\n<p>vmstat(8) \u547d\u4ee4\uff0c\u6bcf\u884c\u4f1a\u8f93\u51fa\u4e00\u4e9b\u7cfb\u7edf\u6838\u5fc3\u6307\u6807\uff0c\u8fd9\u4e9b\u6307\u6807\u53ef\u4ee5\u8ba9\u6211\u4eec\u66f4\u8be6\u7ec6\u7684\u4e86\u89e3\u7cfb\u7edf\u72b6\u6001\u3002\u540e\u9762\u8ddf\u7684\u53c2\u65701\uff0c\u8868\u793a\u6bcf\u79d2\u8f93\u51fa\u4e00\u6b21\u7edf\u8ba1\u4fe1\u606f\uff0c\u8868\u5934\u63d0\u793a\u4e86\u6bcf\u4e00\u5217\u7684\u542b\u4e49\uff0c\u8fd9\u51e0\u4ecb\u7ecd\u4e00\u4e9b\u548c\u6027\u80fd\u8c03\u4f18\u76f8\u5173\u7684\u5217\uff1a<\/p>\n<ul>\n<li>r\uff1a\u7b49\u5f85\u5728CPU\u8d44\u6e90\u7684\u8fdb\u7a0b\u6570\u3002\u8fd9\u4e2a\u6570\u636e\u6bd4\u5e73\u5747\u8d1f\u8f7d\u66f4\u52a0\u80fd\u591f\u4f53\u73b0CPU\u8d1f\u8f7d\u60c5\u51b5\uff0c\u6570\u636e\u4e2d\u4e0d\u5305\u542b\u7b49\u5f85IO\u7684\u8fdb\u7a0b\u3002\u5982\u679c\u8fd9\u4e2a\u6570\u503c\u5927\u4e8e\u673a\u5668CPU\u6838\u6570\uff0c\u90a3\u4e48\u673a\u5668\u7684CPU\u8d44\u6e90\u5df2\u7ecf\u9971\u548c\u3002<\/li>\n<li>free\uff1a\u7cfb\u7edf\u53ef\u7528\u5185\u5b58\u6570\uff08\u4ee5\u5343\u5b57\u8282\u4e3a\u5355\u4f4d\uff09\uff0c\u5982\u679c\u5269\u4f59\u5185\u5b58\u4e0d\u8db3\uff0c\u4e5f\u4f1a\u5bfc\u81f4\u7cfb\u7edf\u6027\u80fd\u95ee\u9898\u3002\u4e0b\u6587\u4ecb\u7ecd\u5230\u7684free\u547d\u4ee4\uff0c\u53ef\u4ee5\u66f4\u8be6\u7ec6\u7684\u4e86\u89e3\u7cfb\u7edf\u5185\u5b58\u7684\u4f7f\u7528\u60c5\u51b5\u3002<\/li>\n<li>si\uff0cso\uff1a\u4ea4\u6362\u533a\u5199\u5165\u548c\u8bfb\u53d6\u7684\u6570\u91cf\u3002\u5982\u679c\u8fd9\u4e2a\u6570\u636e\u4e0d\u4e3a0\uff0c\u8bf4\u660e\u7cfb\u7edf\u5df2\u7ecf\u5728\u4f7f\u7528\u4ea4\u6362\u533a\uff08swap\uff09\uff0c\u673a\u5668\u7269\u7406\u5185\u5b58\u5df2\u7ecf\u4e0d\u8db3\u3002<\/li>\n<li>us, sy, id, wa, st\uff1a\u8fd9\u4e9b\u90fd\u4ee3\u8868\u4e86CPU\u65f6\u95f4\u7684\u6d88\u8017\uff0c\u5b83\u4eec\u5206\u522b\u8868\u793a\u7528\u6237\u65f6\u95f4\uff08user\uff09\u3001\u7cfb\u7edf\uff08\u5185\u6838\uff09\u65f6\u95f4\uff08sys\uff09\u3001\u7a7a\u95f2\u65f6\u95f4\uff08idle\uff09\u3001IO\u7b49\u5f85\u65f6\u95f4\uff08wait\uff09\u548c\u88ab\u5077\u8d70\u7684\u65f6\u95f4\uff08stolen\uff0c\u4e00\u822c\u88ab\u5176\u4ed6\u865a\u62df\u673a\u6d88\u8017\uff09\u3002<\/li>\n<\/ul>\n<p>\u4e0a\u8ff0\u8fd9\u4e9bCPU\u65f6\u95f4\uff0c\u53ef\u4ee5\u8ba9\u6211\u4eec\u5f88\u5feb\u4e86\u89e3CPU\u662f\u5426\u51fa\u4e8e\u7e41\u5fd9\u72b6\u6001\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u7528\u6237\u65f6\u95f4\u548c\u7cfb\u7edf\u65f6\u95f4\u76f8\u52a0\u975e\u5e38\u5927\uff0cCPU\u51fa\u4e8e\u5fd9\u4e8e\u6267\u884c\u6307\u4ee4\u3002\u5982\u679cIO\u7b49\u5f85\u65f6\u95f4\u5f88\u957f\uff0c\u90a3\u4e48\u7cfb\u7edf\u7684\u74f6\u9888\u53ef\u80fd\u5728\u78c1\u76d8IO\u3002<\/p>\n<p>\u793a\u4f8b\u547d\u4ee4\u7684\u8f93\u51fa\u53ef\u4ee5\u770b\u89c1\uff0c\u5927\u91cfCPU\u65f6\u95f4\u6d88\u8017\u5728\u7528\u6237\u6001\uff0c\u4e5f\u5c31\u662f\u7528\u6237\u5e94\u7528\u7a0b\u5e8f\u6d88\u8017\u4e86CPU\u65f6\u95f4\u3002\u8fd9\u4e0d\u4e00\u5b9a\u662f\u6027\u80fd\u95ee\u9898\uff0c\u9700\u8981\u7ed3\u5408r\u961f\u5217\uff0c\u4e00\u8d77\u5206\u6790\u3002<\/p>\n<p><a name=\"mpstat-P-ALL-1\"><\/a><\/p>\n<h2>mpstat-P ALL 1<\/h2>\n<pre>$ mpstat -P ALL 1\r\n\r\nLinux 3.13.0-49-generic (titanclusters-xxxxx)  07\/14\/2015  _x86_64_ (32 CPU)\r\n\r\n07:38:49 PM  CPU   %usr  %nice   %sys %iowait   %irq  %soft  %steal  %guest  %gnice  %idle\r\n\r\n07:38:50 PM  all  98.47   0.00   0.75    0.00   0.00   0.00    0.00    0.00    0.00   0.78\r\n\r\n07:38:50 PM    0  96.04   0.00   2.97    0.00   0.00   0.00    0.00    0.00    0.00   0.99\r\n\r\n07:38:50 PM    1  97.00   0.00   1.00    0.00   0.00   0.00    0.00    0.00    0.00   2.00\r\n\r\n07:38:50 PM    2  98.00   0.00   1.00    0.00   0.00   0.00    0.00    0.00    0.00   1.00\r\n\r\n07:38:50 PM    3  96.97   0.00   0.00    0.00   0.00   0.00    0.00    0.00    0.00   3.03\r\n\r\n[...]\r\n<\/pre>\n<p>\u8be5\u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u6bcf\u4e2aCPU\u7684\u5360\u7528\u60c5\u51b5\uff0c\u5982\u679c\u6709\u4e00\u4e2aCPU\u5360\u7528\u7387\u7279\u522b\u9ad8\uff0c\u90a3\u4e48\u6709\u53ef\u80fd\u662f\u4e00\u4e2a\u5355\u7ebf\u7a0b\u5e94\u7528\u7a0b\u5e8f\u5f15\u8d77\u7684\u3002<\/p>\n<p><a name=\"pidstat-1\"><\/a><\/p>\n<h2>pidstat 1<\/h2>\n<pre>$ pidstat 1\r\n\r\nLinux 3.13.0-49-generic (titanclusters-xxxxx)  07\/14\/2015    _x86_64_    (32 CPU)\r\n\r\n07:41:02 PM   UID       PID    %usr %system  %guest    %CPU   CPU  Command\r\n\r\n07:41:03 PM     0         9    0.00    0.94    0.00    0.94     1  rcuos\/0\r\n\r\n07:41:03 PM     0      4214    5.66    5.66    0.00   11.32    15  mesos-slave\r\n\r\n07:41:03 PM     0      4354    0.94    0.94    0.00    1.89     8  java\r\n\r\n07:41:03 PM     0      6521 1596.23    1.89    0.00 1598.11    27  java\r\n\r\n07:41:03 PM     0      6564 1571.70    7.55    0.00 1579.25    28  java\r\n\r\n07:41:03 PM 60004     60154    0.94    4.72    0.00    5.66     9  pidstat\r\n\r\n07:41:03 PM   UID       PID    %usr %system  %guest    %CPU   CPU  Command\r\n\r\n07:41:04 PM     0      4214    6.00    2.00    0.00    8.00    15  mesos-slave\r\n\r\n07:41:04 PM     0      6521 1590.00    1.00    0.00 1591.00    27  java07:41:04 PM     0      6564 1573.00   10.00    0.00 1583.00    28  java\r\n\r\n07:41:04 PM   108      6718    1.00    0.00    0.00    1.00     0  snmp-pass\r\n\r\n07:41:04 PM 60004     60154    1.00    4.00    0.00    5.00     9  pidstat\r\n\r\n^C\r\n<\/pre>\n<p>pidstat\u547d\u4ee4\u8f93\u51fa\u8fdb\u7a0b\u7684CPU\u5360\u7528\u7387\uff0c\u8be5\u547d\u4ee4\u4f1a\u6301\u7eed\u8f93\u51fa\uff0c\u5e76\u4e14\u4e0d\u4f1a\u8986\u76d6\u4e4b\u524d\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u65b9\u4fbf\u89c2\u5bdf\u7cfb\u7edf\u52a8\u6001\u3002\u5982\u4e0a\u7684\u8f93\u51fa\uff0c\u53ef\u4ee5\u770b\u89c1\u4e24\u4e2aJAVA\u8fdb\u7a0b\u5360\u7528\u4e86\u5c06\u8fd11600%\u7684CPU\u65f6\u95f4\uff0c\u65e2\u6d88\u8017\u4e86\u5927\u7ea616\u4e2aCPU\u6838\u5fc3\u7684\u8fd0\u7b97\u8d44\u6e90\u3002<\/p>\n<p><a name=\"iostat-xz-1\"><\/a><\/p>\n<h2>iostat-xz 1<\/h2>\n<pre>$ iostat -xz 1\r\n\r\nLinux 3.13.0-49-generic (titanclusters-xxxxx)  07\/14\/2015  _x86_64_ (32 CPU)\r\n\r\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\r\n\r\n          73.96    0.00    3.73    0.03    0.06   22.21\r\n\r\nDevice:   rrqm\/s   wrqm\/s     r\/s     w\/s    rkB\/s    wkB\/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util\r\n\r\nxvda        0.00     0.23    0.21    0.18     4.52     2.08    34.37     0.00    9.98   13.80    5.42   2.44   0.09\r\n\r\nxvdb        0.01     0.00    1.02    8.94   127.97   598.53   145.79     0.00    0.43    1.78    0.28   0.25   0.25\r\n\r\nxvdc        0.01     0.00    1.02    8.86   127.79   595.94   146.50     0.00    0.45    1.82    0.30   0.27   0.26\r\n\r\ndm-0        0.00     0.00    0.69    2.32    10.47    31.69    28.01     0.01    3.23    0.71    3.98   0.13   0.04\r\n\r\ndm-1        0.00     0.00    0.00    0.94     0.01     3.78     8.00     0.33  345.84    0.04  346.81   0.01   0.00\r\n\r\ndm-2        0.00     0.00    0.09    0.07     1.35     0.36    22.50     0.00    2.55    0.23    5.62   1.78   0.03\r\n\r\n[...]\r\n\r\n^C\r\n<\/pre>\n<p>iostat\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e\u67e5\u770b\u673a\u5668\u78c1\u76d8IO\u60c5\u51b5\u3002\u8be5\u547d\u4ee4\u8f93\u51fa\u7684\u5217\uff0c\u4e3b\u8981\u542b\u4e49\u662f\uff1a<\/p>\n<ul>\n<li>r\/s, w\/s, rkB\/s, wkB\/s\uff1a\u5206\u522b\u8868\u793a\u6bcf\u79d2\u8bfb\u5199\u6b21\u6570\u548c\u6bcf\u79d2\u8bfb\u5199\u6570\u636e\u91cf\uff08\u5343\u5b57\u8282\uff09\u3002\u8bfb\u5199\u91cf\u8fc7\u5927\uff0c\u53ef\u80fd\u4f1a\u5f15\u8d77\u6027\u80fd\u95ee\u9898\u3002<\/li>\n<li>await\uff1aIO\u64cd\u4f5c\u7684\u5e73\u5747\u7b49\u5f85\u65f6\u95f4\uff0c\u5355\u4f4d\u662f\u6beb\u79d2\u3002\u8fd9\u662f\u5e94\u7528\u7a0b\u5e8f\u5728\u548c\u78c1\u76d8\u4ea4\u4e92\u65f6\uff0c\u9700\u8981\u6d88\u8017\u7684\u65f6\u95f4\uff0c\u5305\u62ecIO\u7b49\u5f85\u548c\u5b9e\u9645\u64cd\u4f5c\u7684\u8017\u65f6\u3002\u5982\u679c\u8fd9\u4e2a\u6570\u503c\u8fc7\u5927\uff0c\u53ef\u80fd\u662f\u786c\u4ef6\u8bbe\u5907\u9047\u5230\u4e86\u74f6\u9888\u6216\u8005\u51fa\u73b0\u6545\u969c\u3002<\/li>\n<li>avgqu-sz\uff1a\u5411\u8bbe\u5907\u53d1\u51fa\u7684\u8bf7\u6c42\u5e73\u5747\u6570\u91cf\u3002\u5982\u679c\u8fd9\u4e2a\u6570\u503c\u5927\u4e8e1\uff0c\u53ef\u80fd\u662f\u786c\u4ef6\u8bbe\u5907\u5df2\u7ecf\u9971\u548c\uff08\u90e8\u5206\u524d\u7aef\u786c\u4ef6\u8bbe\u5907\u652f\u6301\u5e76\u884c\u5199\u5165\uff09\u3002<\/li>\n<li>%util\uff1a\u8bbe\u5907\u5229\u7528\u7387\u3002\u8fd9\u4e2a\u6570\u503c\u8868\u793a\u8bbe\u5907\u7684\u7e41\u5fd9\u7a0b\u5ea6\uff0c\u7ecf\u9a8c\u503c\u662f\u5982\u679c\u8d85\u8fc760\uff0c\u53ef\u80fd\u4f1a\u5f71\u54cdIO\u6027\u80fd\uff08\u53ef\u4ee5\u53c2\u7167IO\u64cd\u4f5c\u5e73\u5747\u7b49\u5f85\u65f6\u95f4\uff09\u3002\u5982\u679c\u5230\u8fbe100%\uff0c\u8bf4\u660e\u786c\u4ef6\u8bbe\u5907\u5df2\u7ecf\u9971\u548c\u3002<\/li>\n<\/ul>\n<p>\u5982\u679c\u663e\u793a\u7684\u662f\u903b\u8f91\u8bbe\u5907\u7684\u6570\u636e\uff0c\u90a3\u4e48\u8bbe\u5907\u5229\u7528\u7387\u4e0d\u4ee3\u8868\u540e\u7aef\u5b9e\u9645\u7684\u786c\u4ef6\u8bbe\u5907\u5df2\u7ecf\u9971\u548c\u3002\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u5373\u4f7fIO\u6027\u80fd\u4e0d\u7406\u60f3\uff0c\u4e5f\u4e0d\u4e00\u5b9a\u610f\u5473\u8fd9\u5e94\u7528\u7a0b\u5e8f\u6027\u80fd\u4f1a\u4e0d\u597d\uff0c\u53ef\u4ee5\u5229\u7528\u8bf8\u5982\u9884\u8bfb\u53d6\u3001\u5199\u7f13\u5b58\u7b49\u7b56\u7565\u63d0\u5347\u5e94\u7528\u6027\u80fd\u3002<\/p>\n<p><a name=\"free-m\"><\/a><\/p>\n<h2>free -m<\/h2>\n<pre>$ free -m\r\n\r\n             total       used       free     shared    buffers     cached\r\n\r\nMem:        245998      24545     221453         83         59        541\r\n\r\n-\/+ buffers\/cache:      23944     222053\r\n\r\nSwap:            0          0          0\r\n<\/pre>\n<p>free\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u7cfb\u7edf\u5185\u5b58\u7684\u4f7f\u7528\u60c5\u51b5\uff0c-m\u53c2\u6570\u8868\u793a\u6309\u7167\u5146\u5b57\u8282\u5c55\u793a\u3002\u6700\u540e\u4e24\u5217\u5206\u522b\u8868\u793a\u7528\u4e8eIO\u7f13\u5b58\u7684\u5185\u5b58\u6570\uff0c\u548c\u7528\u4e8e\u6587\u4ef6\u7cfb\u7edf\u9875\u7f13\u5b58\u7684\u5185\u5b58\u6570\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u7b2c\u4e8c\u884c-\/+ buffers\/cache\uff0c\u770b\u4e0a\u53bb\u7f13\u5b58\u5360\u7528\u4e86\u5927\u91cf\u5185\u5b58\u7a7a\u95f4\u3002<\/p>\n<p>\u8fd9\u662fLinux\u7cfb\u7edf\u7684\u5185\u5b58\u4f7f\u7528\u7b56\u7565\uff0c\u5c3d\u53ef\u80fd\u7684\u5229\u7528\u5185\u5b58\uff0c\u5982\u679c\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u5185\u5b58\uff0c\u8fd9\u90e8\u5206\u5185\u5b58\u4f1a\u7acb\u5373\u88ab\u56de\u6536\u5e76\u5206\u914d\u7ed9\u5e94\u7528\u7a0b\u5e8f\u3002\u56e0\u6b64\uff0c\u8fd9\u90e8\u5206\u5185\u5b58\u4e00\u822c\u4e5f\u88ab\u5f53\u6210\u662f\u53ef\u7528\u5185\u5b58\u3002<\/p>\n<p>\u5982\u679c\u53ef\u7528\u5185\u5b58\u975e\u5e38\u5c11\uff0c\u7cfb\u7edf\u53ef\u80fd\u4f1a\u52a8\u7528\u4ea4\u6362\u533a\uff08\u5982\u679c\u914d\u7f6e\u4e86\u7684\u8bdd\uff09\uff0c\u8fd9\u6837\u4f1a\u589e\u52a0IO\u5f00\u9500\uff08\u53ef\u4ee5\u5728iostat\u547d\u4ee4\u4e2d\u63d0\u73b0\uff09\uff0c\u964d\u4f4e\u7cfb\u7edf\u6027\u80fd\u3002<\/p>\n<p><a name=\"sar-n-DEV-1\"><\/a><\/p>\n<h2>sar -n DEV 1<\/h2>\n<pre>$ sar -n DEV 1\r\n\r\nLinux 3.13.0-49-generic (titanclusters-xxxxx)  07\/14\/2015     _x86_64_    (32 CPU)\r\n\r\n12:16:48 AM     IFACE   rxpck\/s   txpck\/s    rxkB\/s    txkB\/s   rxcmp\/s   txcmp\/s  rxmcst\/s   %ifutil\r\n\r\n12:16:49 AM      eth0  18763.00   5032.00  20686.42    478.30      0.00      0.00      0.00      0.00\r\n\r\n12:16:49 AM        lo     14.00     14.00      1.36      1.36      0.00      0.00      0.00      0.00\r\n\r\n12:16:49 AM   docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00\r\n\r\n12:16:49 AM     IFACE   rxpck\/s   txpck\/s    rxkB\/s    txkB\/s   rxcmp\/s   txcmp\/s  rxmcst\/s   %ifutil\r\n\r\n12:16:50 AM      eth0  19763.00   5101.00  21999.10    482.56      0.00      0.00      0.00      0.00\r\n\r\n12:16:50 AM        lo     20.00     20.00      3.25      3.25      0.00      0.00      0.00      0.00\r\n\r\n12:16:50 AM   docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00\r\n\r\n^C\r\n<\/pre>\n<p>sar\u547d\u4ee4\u5728\u8fd9\u91cc\u53ef\u4ee5\u67e5\u770b\u7f51\u7edc\u8bbe\u5907\u7684\u541e\u5410\u7387\u3002\u5728\u6392\u67e5\u6027\u80fd\u95ee\u9898\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u7f51\u7edc\u8bbe\u5907\u7684\u541e\u5410\u91cf\uff0c\u5224\u65ad\u7f51\u7edc\u8bbe\u5907\u662f\u5426\u5df2\u7ecf\u9971\u548c\u3002\u5982\u793a\u4f8b\u8f93\u51fa\u4e2d\uff0ceth0\u7f51\u5361\u8bbe\u5907\uff0c\u541e\u5410\u7387\u5927\u6982\u572822 Mbytes\/s\uff0c\u65e2176 Mbits\/sec\uff0c\u6ca1\u6709\u8fbe\u52301Gbit\/sec\u7684\u786c\u4ef6\u4e0a\u9650\u3002<\/p>\n<p><a name=\"sar-n-TCPETCP-1\"><\/a><\/p>\n<h2>sar -n TCP,ETCP 1<\/h2>\n<pre>$ sar -n TCP,ETCP 1\r\n\r\nLinux 3.13.0-49-generic (titanclusters-xxxxx)  07\/14\/2015    _x86_64_    (32 CPU)\r\n\r\n12:17:19 AM  active\/s passive\/s    iseg\/s    oseg\/s\r\n\r\n12:17:20 AM      1.00      0.00  10233.00  18846.00\r\n\r\n12:17:19 AM  atmptf\/s  estres\/s retrans\/s isegerr\/s   orsts\/s\r\n\r\n12:17:20 AM      0.00      0.00      0.00      0.00      0.00\r\n\r\n12:17:20 AM  active\/s passive\/s    iseg\/s    oseg\/s\r\n\r\n12:17:21 AM      1.00      0.00   8359.00   6039.00\r\n\r\n12:17:20 AM  atmptf\/s  estres\/s retrans\/s isegerr\/s   orsts\/s\r\n\r\n12:17:21 AM      0.00      0.00      0.00      0.00      0.00\r\n\r\n^C\r\n<\/pre>\n<p>sar\u547d\u4ee4\u5728\u8fd9\u91cc\u7528\u4e8e\u67e5\u770bTCP\u8fde\u63a5\u72b6\u6001\uff0c\u5176\u4e2d\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>active\/s\uff1a\u6bcf\u79d2\u672c\u5730\u53d1\u8d77\u7684TCP\u8fde\u63a5\u6570\uff0c\u65e2\u901a\u8fc7connect\u8c03\u7528\u521b\u5efa\u7684TCP\u8fde\u63a5\uff1b<\/li>\n<li>passive\/s\uff1a\u6bcf\u79d2\u8fdc\u7a0b\u53d1\u8d77\u7684TCP\u8fde\u63a5\u6570\uff0c\u5373\u901a\u8fc7accept\u8c03\u7528\u521b\u5efa\u7684TCP\u8fde\u63a5\uff1b<\/li>\n<li>retrans\/s\uff1a\u6bcf\u79d2TCP\u91cd\u4f20\u6570\u91cf\uff1b<\/li>\n<\/ul>\n<p>TCP\u8fde\u63a5\u6570\u53ef\u4ee5\u7528\u6765\u5224\u65ad\u6027\u80fd\u95ee\u9898\u662f\u5426\u7531\u4e8e\u5efa\u7acb\u4e86\u8fc7\u591a\u7684\u8fde\u63a5\uff0c\u8fdb\u4e00\u6b65\u53ef\u4ee5\u5224\u65ad\u662f\u4e3b\u52a8\u53d1\u8d77\u7684\u8fde\u63a5\uff0c\u8fd8\u662f\u88ab\u52a8\u63a5\u53d7\u7684\u8fde\u63a5\u3002TCP\u91cd\u4f20\u53ef\u80fd\u662f\u56e0\u4e3a\u7f51\u7edc\u73af\u5883\u6076\u52a3\uff0c\u6216\u8005\u670d\u52a1\u5668\u538b\u529b\u8fc7\u5927\u5bfc\u81f4\u4e22\u5305\u3002<\/p>\n<p><a name=\"top\"><\/a><\/p>\n<h2>top<\/h2>\n<pre>$ top\r\n\r\ntop - 00:15:40 up 21:56,  1 user,  load average: 31.09, 29.87, 29.92\r\n\r\nTasks: 871 total,   1 running, 868 sleeping,   0 stopped,   2 zombie\r\n\r\n%Cpu(s): 96.8 us,  0.4 sy,  0.0 ni,  2.7 id,  0.1 wa,  0.0 hi,  0.0 si,  0.0 st\r\n\r\nKiB Mem:  25190241+total, 24921688 used, 22698073+free,    60448 buffers\r\n\r\nKiB Swap:        0 total,        0 used,        0 free.   554208 cached Mem\r\n\r\n   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND\r\n\r\n 20248 root      20   0  0.227t 0.012t  18748 S  3090  5.2  29812:58 java\r\n\r\n  4213 root      20   0 2722544  64640  44232 S  23.5  0.0 233:35.37 mesos-slave\r\n\r\n 66128 titancl+  20   0   24344   2332   1172 R   1.0  0.0   0:00.07 top\r\n\r\n  5235 root      20   0 38.227g 547004  49996 S   0.7  0.2   2:02.74 java\r\n\r\n  4299 root      20   0 20.015g 2.682g  16836 S   0.3  1.1  33:14.42 java     1 root      20   0   33620   2920   1496 S   0.0  0.0   0:03.82 init\r\n\r\n     2 root      20   0       0      0      0 S   0.0  0.0   0:00.02 kthreadd\r\n\r\n     3 root      20   0       0      0      0 S   0.0  0.0   0:05.35 ksoftirqd\/0\r\n\r\n     5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker\/0:0H\r\n\r\n     6 root      20   0       0      0      0 S   0.0  0.0   0:06.94 kworker\/u256:0\r\n\r\n     8 root      20   0       0      0      0 S   0.0  0.0   2:38.05 rcu_sched\r\n<\/pre>\n<p>top\u547d\u4ee4\u5305\u542b\u4e86\u524d\u9762\u597d\u51e0\u4e2a\u547d\u4ee4\u7684\u68c0\u67e5\u7684\u5185\u5bb9\u3002\u6bd4\u5982\u7cfb\u7edf\u8d1f\u8f7d\u60c5\u51b5\uff08uptime\uff09\u3001\u7cfb\u7edf\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\uff08free\uff09\u3001\u7cfb\u7edfCPU\u4f7f\u7528\u60c5\u51b5\uff08vmstat\uff09\u7b49\u3002\u56e0\u6b64\u901a\u8fc7\u8fd9\u4e2a\u547d\u4ee4\uff0c\u53ef\u4ee5\u76f8\u5bf9\u5168\u9762\u7684\u67e5\u770b\u7cfb\u7edf\u8d1f\u8f7d\u7684\u6765\u6e90\u3002\u540c\u65f6\uff0ctop\u547d\u4ee4\u652f\u6301\u6392\u5e8f\uff0c\u53ef\u4ee5\u6309\u7167\u4e0d\u540c\u7684\u5217\u6392\u5e8f\uff0c\u65b9\u4fbf\u67e5\u627e\u51fa\u8bf8\u5982\u5185\u5b58\u5360\u7528\u6700\u591a\u7684\u8fdb\u7a0b\u3001CPU\u5360\u7528\u7387\u6700\u9ad8\u7684\u8fdb\u7a0b\u7b49\u3002<\/p>\n<p>\u4f46\u662f\uff0ctop\u547d\u4ee4\u76f8\u5bf9\u4e8e\u524d\u9762\u4e00\u4e9b\u547d\u4ee4\uff0c\u8f93\u51fa\u662f\u4e00\u4e2a\u77ac\u95f4\u503c\uff0c\u5982\u679c\u4e0d\u6301\u7eed\u76ef\u7740\uff0c\u53ef\u80fd\u4f1a\u9519\u8fc7\u4e00\u4e9b\u7ebf\u7d22\u3002\u8fd9\u65f6\u53ef\u80fd\u9700\u8981\u6682\u505ctop\u547d\u4ee4\u5237\u65b0\uff0c\u6765\u8bb0\u5f55\u548c\u6bd4\u5bf9\u6570\u636e\u3002<\/p>\n<p><a name=\"\u603b\u7ed3\"><\/a><\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p>\u6392\u67e5Linux\u670d\u52a1\u5668\u6027\u80fd\u95ee\u9898\u8fd8\u6709\u5f88\u591a\u5de5\u5177\uff0c\u4e0a\u9762\u4ecb\u7ecd\u7684\u4e00\u4e9b\u547d\u4ee4\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5feb\u901f\u7684\u5b9a\u4f4d\u95ee\u9898\u3002\u4f8b\u5982\u524d\u9762\u7684\u793a\u4f8b\u8f93\u51fa\uff0c\u591a\u4e2a\u8bc1\u636e\u8bc1\u660e\u6709JAVA\u8fdb\u7a0b\u5360\u7528\u4e86\u5927\u91cfCPU\u8d44\u6e90\uff0c\u4e4b\u540e\u7684\u6027\u80fd\u8c03\u4f18\u5c31\u53ef\u4ee5\u9488\u5bf9\u5e94\u7528\u7a0b\u5e8f\u8fdb\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u901a\u8fc7\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u53ef\u4ee5\u57281\u5206\u949f\u5185\u5bf9\u7cfb\u7edf\u8d44\u6e90\u4f7f\u7528\u60c5\u51b5\u6709\u4e2a\u5927\u81f4\u7684\u4e86\u89e3\u3002 uptime dmesg | tail v [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-6049","post","type-post","status-publish","format-standard","hentry","category-skill"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6049","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=6049"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6049\/revisions"}],"predecessor-version":[{"id":6050,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6049\/revisions\/6050"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=6049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=6049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=6049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}