{"id":7884,"date":"2016-08-15T11:54:25","date_gmt":"2016-08-15T03:54:25","guid":{"rendered":"http:\/\/jpuyy.com\/?p=7884"},"modified":"2016-08-22T12:23:24","modified_gmt":"2016-08-22T04:23:24","slug":"find-what-cause-load-avg-high","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=7884","title":{"rendered":"linux \u8d1f\u8f7d\u9ad8\u6392\u67e5"},"content":{"rendered":"<p>\u673a\u5668 load avg \u9ad8<\/p>\n<p>\u9996\u5148\u770b\u4e00\u4e0b\u4ec0\u4e48\u662f load avg<\/p>\n<pre>man proc\r\nThe first three fields in this file are load average figures giving the number of jobs  in  the  run  queue\r\n              (state  R)  or waiting for disk I\/O (state D) averaged over 1, 5, and 15 minutes.  They are the same as the\r\n              load average numbers given by uptime(1) and other programs.  The fourth field consists of two numbers sepa\u2010\r\n              rated  by  a  slash (\/).  The first of these is the number of currently runnable kernel scheduling entities\r\n              (processes, threads).  The value after the slash is the number of kernel scheduling entities that currently\r\n              exist  on the system.  The fifth field is the PID of the process that was most recently created on the sys\u2010\r\n              tem.\r\n<\/pre>\n<p>\u67e5\u770b load avg<\/p>\n<pre>cat \/proc\/loadavg \r\n3.33 4.76 5.55 2\/505 8687<\/pre>\n<p>\u67e5\u770b\u961f\u5217<\/p>\n<pre>sar -q 1<\/pre>\n<p>\u67e5\u770b cpu time \u6765\u8bf4\uff0c\u5982\u679c system time \u4e0d\u9ad8\uff0c\u6211\u4eec\u8ba4\u4e3a\u7cfb\u7edf\u5c42\u9762\u6ca1\u6709\u95ee\u9898\uff0c\u66f4\u591a\u7684\u5173\u6ce8 user , nice, \u5982\u679c\u6709 io \u95ee\u9898\u5173\u6ce8 iowait\u0002\u0002\u0002\u0002\u0002\u0002\u0002\u0002\u0002\u0002. \u5982\u679c system time \u9ad8\uff0c\u9700\u8981\u89e3\u51b3\u3002<\/p>\n<p>strace \u662f\u8f93\u51fa system call \u7684\u5de5\u5177\uff0c-c \u53ef\u4ee5\u8fdb\u884c\u4e00\u6bb5\u65f6\u95f4\u7684\u7edf\u8ba1\uff0c\u4e4b\u540e\u6309 ctrl + c \u505c\u6b62<\/p>\n<pre>strace -c -p 6615<\/pre>\n<p>\u6253\u5370\u51fa\u6765\u4f1a\u6309 cpu time \u5360\u6bd4\u6765\u770b<\/p>\n<pre>\r\nuptime\r\ndimes -T | tail\r\nvmstat 1\r\nmpstatl -P ALL 1\r\npidstat 1\r\ninstate -xz 1\r\nfree -m\r\nsar -n DEV 1\r\nsar -n TCP,ETCP 1\r\ntop<\/pre>\n<p><iframe loading=\"lazy\" title=\"SREcon 2016 Performance Checklists for SREs\" src=\"https:\/\/www.slideshare.net\/slideshow\/embed_code\/key\/1Zs9CS9urxFTkz\" width=\"427\" height=\"356\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" style=\"border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;\" allowfullscreen> <\/iframe> <\/p>\n<div style=\"margin-bottom:5px\"> <strong> <a href=\"https:\/\/www.slideshare.net\/brendangregg\/srecon-2016-performance-checklists-for-sres\" title=\"SREcon 2016 Performance Checklists for SREs\" target=\"_blank\">SREcon 2016 Performance Checklists for SREs<\/a> <\/strong> from <strong><a href=\"https:\/\/www.slideshare.net\/brendangregg\" target=\"_blank\">Brendan Gregg<\/a><\/strong> <\/div>\n<p>http:\/\/techblog.netflix.com\/2015\/11\/linux-performance-analysis-in-60s.html<\/p>\n<p>http:\/\/blog.scoutapp.com\/articles\/2009\/07\/31\/understanding-load-averages<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u673a\u5668 load avg \u9ad8 \u9996\u5148\u770b\u4e00\u4e0b\u4ec0\u4e48\u662f load avg man proc The first three fields in this file are load average figures giving the number of jobs in the run queue (state R) or waiting for disk I\/O (state D) averaged over 1, 5, and 15 minutes. They are the same as the load average numbers given [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-7884","post","type-post","status-publish","format-standard","hentry","category-life"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7884","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7884"}],"version-history":[{"count":10,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7884\/revisions"}],"predecessor-version":[{"id":7913,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7884\/revisions\/7913"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}