{"id":1102,"date":"2023-09-01T10:30:31","date_gmt":"2023-09-01T02:30:31","guid":{"rendered":"http:\/\/www.rchen.top\/?p=1102"},"modified":"2023-09-01T10:31:10","modified_gmt":"2023-09-01T02:31:10","slug":"%e5%88%86%e6%9e%90nas%e6%95%85%e9%9a%9c%e5%af%bc%e8%87%b4%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%9a%84io-load%e5%bc%82%e5%b8%b8","status":"publish","type":"post","link":"https:\/\/www.rchen.top\/?p=1102","title":{"rendered":"\u5206\u6790NAS\u6545\u969c\u5bfc\u81f4\u670d\u52a1\u5668\u7684io load\u5f02\u5e38"},"content":{"rendered":"<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-family: 'Microsoft YaHei'; font-size: 11.0pt;\">\u95ee\u9898\u73b0\u8c61\uff1a<\/p>\n<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-size: 11.0pt;\"><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u670d\u52a1\u5668\u6302\u8f7d\u7684<\/span><span lang=\"en-US\" style=\"font-family: Calibri;\">nas<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u5b58\u50a8\u51fa\u73b0\u6545\u969c\uff0c\u670d\u52a1\u5668\u65e0\u6cd5\u6b63\u5e38\u8bfb\u5199<\/span><span lang=\"en-US\" style=\"font-family: Calibri;\">disk ,<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u5bfc\u81f4\u8fdb\u7a0b\u8fdb\u5165<\/span><span lang=\"en-US\" style=\"font-family: Calibri;\">sleep<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u72b6\u6001\u6216<\/span><span lang=\"en-US\" style=\"font-family: Calibri;\">d<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u72b6\u6001\uff08<\/span><span lang=\"en-US\" style=\"font-family: Calibri;\">disk sleep<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\uff09\uff0c\u6b64\u65f6\u670d\u52a1\u5668\u8fdb\u7a0b\u4f1a<\/span> <span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u5904\u4e8e\u4f11\u7720\u6216\u7ec8\u6b62\u72b6\u6001\uff1b<\/span><\/p>\n<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-size: 11.0pt;\"><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u670d\u52a1\u5668<\/span><span lang=\"en-US\" style=\"font-family: Calibri;\">cpu<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u4f7f\u7528\u4e0d\u9ad8\u7684\u60c5\u51b5\u4e0b\uff0c\u901a\u8fc7<\/span><span lang=\"en-US\" style=\"font-family: Calibri;\">top<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u547d\u4ee4\uff0c<\/span><span lang=\"en-US\" style=\"font-family: Calibri;\">load <\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u4f1a\u663e\u793a\u9ad8\u72b6\u6001\u5e76\u6301\u7eed\u5347\u9ad8<\/span><\/p>\n<p style=\"margin: 0in;\"><img loading=\"lazy\" decoding=\"async\" width=\"456\" height=\"54\" class=\"alignnone wp-image-1105 size-full\" src=\"http:\/\/www.rchen.top\/wp-content\/uploads\/2023\/09\/Pasted-1.png\" \/><\/p>\n<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-family: Calibri; font-size: 11.0pt;\">\n<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-family: 'Microsoft YaHei'; font-size: 11.0pt;\">\u89e3\u51b3\uff1a<\/p>\n<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-size: 11.0pt;\"><span lang=\"en-US\" style=\"font-family: Calibri;\">1<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u3001\u4fee\u590d\u5b58\u50a8\uff0c\u786e\u4fdd\u5b58\u50a8\u5377\u8bbf\u95ee\u6b63\u5e38\uff1b<\/span><\/p>\n<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-size: 11.0pt;\"><span lang=\"en-US\" style=\"font-family: Calibri;\">2<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u3001\u5728\u670d\u52a1\u5668\u65e0\u6cd5\u91cd\u542f\u65f6\uff0c\u6b64\u65f6\u5927\u90e8\u5206\u8fdb\u7a0b\u53ef\u4ee5\u4ece<\/span><span lang=\"en-US\" style=\"font-family: Calibri;\">sleep<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u72b6\u6001\u8f6c\u6210\u5c31\u7eea<\/span><span lang=\"en-US\" style=\"font-family: Calibri;\">R<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u72b6\u6001\uff0c\u5e76\u7ee7\u7eed\u8fd0\u884c\uff1b<\/span><\/p>\n<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-size: 11.0pt;\"><span lang=\"en-US\" style=\"font-family: Calibri;\">3<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u3001\u95ee\u9898\u8fdb\u7a0b\u5e76\u4e0d\u4f1a\u81ea\u52a8\u5173\u95ed\uff0c\u9700\u8981\u624b\u52a8\u627e\u51fa\u5e76<\/span><span lang=\"en-US\" style=\"font-family: Calibri;\">kill<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u8fdb\u7a0b\uff1b<\/span><\/p>\n<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-size: 11.0pt;\"><span style=\"font-family: 'Microsoft YaHei';\">\u5982\u4f55\u627e\u51fa\u7cfb\u7edf\u4e2d<\/span><span style=\"font-family: Calibri;\"> load <\/span><span style=\"font-family: 'Microsoft YaHei';\">\u9ad8\u65f6\u5904\u4e8e\u8fd0\u884c\u961f\u5217\u7684\u8fdb\u7a0b\u901a\u8fc7\u524d\u9762\u7684\u8bb2\u89e3\uff0c\u6211\u4eec\u5df2\u7ecf\u660e\u767d\u6709\u53ef\u80fd\u7cfb\u7edf\u6709\u5f88\u9ad8\u7684\u8d1f\u8f7d\u4f46\u662f<\/span><span style=\"font-family: Calibri;\"> CPU <\/span><span style=\"font-family: 'Microsoft YaHei';\">\u4f7f\u7528\u7387\u5374\u5f88\u4f4e\uff0c \u6216\u8005\u8d1f\u8f7d\u5f88\u4f4e\u800c<\/span><span style=\"font-family: Calibri;\"> CPU <\/span><span style=\"font-family: 'Microsoft YaHei';\">\u5229\u7528\u7387\u5f88\u9ad8\uff0c\u8fd9\u4e24\u8005\u6ca1\u6709\u76f4\u63a5\u5173\u7cfb\uff0c\u5982\u4f55\u7528\u811a\u672c\u7edf\u8ba1\u51fa\u6765\u5904\u4e8e \u8fd0\u884c\u961f\u5217\u7684\u8fdb\u7a0b\u5462\uff1f \u6bcf\u9694<\/span><span style=\"font-family: Calibri;\"> 1s <\/span><span style=\"font-family: 'Microsoft YaHei';\">\u7edf\u8ba1\u4e00\u6b21\uff1a<\/span><\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">#!\/bin\/bash<br \/>\nLANG=C<br \/>\nPATH=\/sbin:\/usr\/sbin:\/bin:\/usr\/bin<br \/>\ninterval=1<br \/>\nlength=86400<br \/>\nfor i in $(seq 1 $(expr ${length} \/ ${interval}));do<br \/>\ndate<br \/>\nLANG=C ps -eTo stat,pid,tid,ppid,comm &#8211;no-header | sed -e &#8216;s\/^ \\*\/\/&#8217; |<br \/>\nperl -nE &#8216;chomp;say if (m!^\\S*[RD]+\\S*!)&#8217;<br \/>\ndate<br \/>\ncat \/proc\/loadavg<br \/>\necho -e &#8220;\\n&#8221;<br \/>\nsleep ${interval}<br \/>\ndone<\/p>\n<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-size: 11.0pt;\"><span style=\"font-family: 'Microsoft YaHei';\">\u00a0\u5728<\/span><span style=\"font-family: Calibri;\"> load <\/span><span style=\"font-family: 'Microsoft YaHei';\">\u6bd4\u8f83\u9ad8\u7684\u65f6\u5019\uff0c\u6709\u5927\u91cf\u7684<\/span><span style=\"font-family: Calibri;\"> nginx <\/span><span style=\"font-family: 'Microsoft YaHei';\">\u5904\u4e8e<\/span><span style=\"font-family: Calibri;\"> R <\/span><span style=\"font-family: 'Microsoft YaHei';\">\u6216\u8005<\/span><span style=\"font-family: Calibri;\"> D <\/span><span style=\"font-family: 'Microsoft YaHei';\">\u72b6\u6001\uff0c\u4ed6\u4eec\u624d\u662f\u9020\u6210<\/span><span style=\"font-family: Calibri;\"> load <\/span><span style=\"font-family: 'Microsoft YaHei';\">\u4e0a \u5347\u7684\u5143\u51f6\uff0c\u548c\u6211\u4eec\u5e95\u5c42\u7684\u8d1f\u8f7d\u786e\u5b9e\u662f\u6ca1\u6709\u5173\u7cfb\u7684\u3002<\/span><\/p>\n<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-size: 11.0pt;\"><span style=\"font-family: 'Microsoft YaHei';\">\u6700\u540e\u4e5f\u7ed9\u5927\u5bb6<\/span><span style=\"font-family: Calibri;\"> share <\/span><span style=\"font-family: 'Microsoft YaHei';\">\u4e00\u4e0b\u67e5<\/span><span style=\"font-family: Calibri;\"> CPU <\/span><span style=\"font-family: 'Microsoft YaHei';\">\u4f7f\u7528\u7387\u6bd4\u8f83\u9ad8\u7684\u7ebf\u7a0b\u5c0f\u811a\u672c<\/span><\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">#!\/bin\/bash<br \/>\nLANG=C<br \/>\nPATH=\/sbin:\/usr\/sbin:\/bin:\/usr\/bin<\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">interval=1<br \/>\nlength=86400<br \/>\nfor i in $(seq 1 $(expr ${length} \/ ${interval}));do<br \/>\ndate<br \/>\nLANG=C ps -eT -o%cpu,pid,tid,ppid,comm | grep -v CPU | sort -n -r | head -20<br \/>\ndate<br \/>\nLANG=C cat \/proc\/loadavg<br \/>\n{ LANG=C ps -eT -o%cpu,pid,tid,ppid,comm | sed -e &#8216;s\/^ *\/\/&#8217; | tr -s &#8216; &#8216; |<br \/>\ngrep -v CPU | sort -n -r | cut -d &#8216; &#8216; -f 1 | xargs -I{} echo -n &#8220;{} + &#8221; &amp;&amp;<br \/>\necho &#8216;0&#8217;; } | bc -l<br \/>\nsleep ${interval}<br \/>\ndone<br \/>\nfuser -k $0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898\u73b0\u8c61\uff1a \u670d\u52a1\u5668\u6302\u8f7d\u7684nas\u5b58\u50a8\u51fa\u73b0\u6545\u969c\uff0c\u670d\u52a1\u5668\u65e0\u6cd5\u6b63\u5e38\u8bfb\u5199disk ,\u5bfc\u81f4\u8fdb\u7a0b\u8fdb\u5165sleep\u72b6\u6001\u6216d\u72b6\u6001\uff08 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":490,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,88],"tags":[14],"class_list":["post-1102","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-hpc","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts\/1102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1102"}],"version-history":[{"count":2,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts\/1102\/revisions"}],"predecessor-version":[{"id":1106,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts\/1102\/revisions\/1106"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/media\/490"}],"wp:attachment":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}