{"id":8452,"date":"2020-07-28T19:24:58","date_gmt":"2020-07-28T11:24:58","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=8452"},"modified":"2020-07-28T19:25:23","modified_gmt":"2020-07-28T11:25:23","slug":"blktrace","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/blktrace","title":{"rendered":"blktrace\u547d\u4ee4 – \u5206\u6790\u78c1\u76d8IO"},"content":{"rendered":"\n
\u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u67e5\u770b\u78c1\u76d8\u7684\u8d1f\u8f7d\u60c5\u51b5\uff0c\u54b1\u4eec\u4e00\u822c\u4f7f\u7528iostat\u76d1\u63a7\u5de5\u5177\u3002\u5176\u4e2d\u5f88\u91cd\u8981\u7684\u53c2\u6570\u5c31\u662fawait\uff0cawait\u8868\u793a\u5355\u4e2aI\/O\u6240\u9700\u7684\u5e73\u5747\u65f6\u95f4\uff0c\u4f46\u5b83\u540c\u65f6\u5305\u542b\u4e86I\/O Scheduler\u6240\u6d88\u8017\u7684\u65f6\u95f4\u548c\u786c\u4ef6\u6240\u6d88\u8017\u7684\u65f6\u95f4\uff0c\u6240\u4ee5\u4e0d\u80fd\u4f5c\u4e3a\u786c\u4ef6\u6027\u80fd\u7684\u6307\u6807\u3002\u90a3\u5982\u4f55\u624d\u80fd\u5206\u8fa8\u4e00\u4e2aio\u4ece\u4e0b\u53d1\u5230\u8fd4\u56de\u6574\u4e2a\u65f6\u95f4\u4e0a\uff0c\u662f\u786c\u4ef6\u5c42\u8017\u65f6\u591a\u8fd8\u662f\u5728io\u8c03\u5ea6\u4e0a\u8017\u65f6\u591a\u5462\uff1f\u5982\u4f55\u67e5\u770bio\u5728\u5404\u4e2a\u65f6\u95f4\u6bb5\u6240\u6d88\u8017\u7684\u65f6\u95f4\u5462\uff1f\u90a3\u4e48\uff0cblktrace\u5728\u8fd9\u79cd\u573a\u5408\u5c31\u80fd\u6d3e\u4e0a\u7528\u573a\uff0c\u56e0\u4e3a\u5b83\u80fd\u8bb0\u5f55I\/O\u6240\u7ecf\u5386\u7684\u5404\u4e2a\u6b65\u9aa4\uff0c\u4ece\u4e2d\u53ef\u4ee5\u5206\u6790\u662fIO Scheduler\u6162\u8fd8\u662f\u786c\u4ef6\u54cd\u5e94\u6162\uff0c\u4ee5\u53ca\u5404\u4e2a\u65f6\u95f4\u6bb5\u6240\u7528\u65f6\u95f4\u3002<\/p>\n\n\n\n
blktrace\u7684\u539f\u7406\uff1a<\/p>\n\n\n\n
\u4e00\u4e2aI\/O\u8bf7\u6c42\u8fdb\u5165block layer\u4e4b\u540e\uff0c\u53ef\u80fd\u4f1a\u7ecf\u5386\u4e0b\u9762\u7684\u8fc7\u7a0b\uff1a<\/p>\n\n\n\n
\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>blktrace [\u53c2\u6570]<\/p>\n\n\n\n \u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n \u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n centos7\u5b89\u88c5blktrace\uff08\u4f1a\u81ea\u52a8\u751f\u6210blktrace blkparse btt 3\u4e2a\u5de5\u5177\uff0c\u5176\u4e2d\uff0cblktrace\u6536\u96c6\u6570\u636e\uff0cblkparce\u5206\u6790\u6570\u636e\uff0cbtt\u6c47\u603b\u6570\u636e\uff09\uff1a<\/p>\n\n\n\n \u4f7f\u7528blktrace\u9700\u8981\u6302\u8f7ddebugfs\uff1a<\/p>\n\n\n\n \u5229\u7528blktrace\u67e5\u770b\u5b9e\u65f6\u6570\u636e\u7684\u65b9\u6cd5\uff0c\u6bd4\u5982\u8981\u770b\u7684\u786c\u76d8\u662fsdb\uff1a<\/p>\n\n\n\n \u5206\u6790\u78c1\u76d8\/dev\/sdc\u7684IO\u60c5\u51b5\uff1a<\/p>\n\n\n\n \u751f\u6210\u6570\u636e\uff1a \u5e94\u7528\u7ed3\u675f\u540e\uff0c\u624b\u52a8\u7ec8\u6b62\u76d1\u63a7\uff0c\u4f1a\u751f\u6210cpu\u6570\u91cf\u7684\u6587\u4ef6<\/p>\n\n\n\n \u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u67e5\u770b\u78c1\u76d8\u7684\u8d1f\u8f7d\u60c5\u51b5\uff0c\u54b1\u4eec\u4e00\u822c\u4f7f\u7528iostat\u76d1\u63a7\u5de5\u5177\u3002\u5176\u4e2d\u5f88\u91cd\u8981\u7684\u53c2\u6570\u5c31\u662fawait\uff0caw […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8452"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=8452"}],"version-history":[{"count":1,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8452\/revisions"}],"predecessor-version":[{"id":8453,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8452\/revisions\/8453"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=8452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=8452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=8452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}-A hex-mask<\/td> \u8bbe\u7f6e\u8fc7\u6ee4\u4fe1\u606fmask\u6210\u5341\u516d\u8fdb\u5236mask<\/td><\/tr> -a mask<\/td> \u6dfb\u52a0mask\u5230\u5f53\u524d\u7684\u8fc7\u6ee4\u5668<\/td><\/tr> -b size<\/td> \u6307\u5b9a\u7f13\u5b58\u5927\u5c0ffor\u63d0\u53d6\u7684\u7ed3\u679c\uff0c\u9ed8\u8ba4\u4e3a512KB<\/td><\/tr> -d dev<\/td> \u6dfb\u52a0\u4e00\u4e2a\u8bbe\u5907\u8ffd\u8e2a<\/td><\/tr> -k<\/td> \u6740\u6389\u6b63\u5728\u8fd0\u884c\u7684\u8ffd\u8e2a<\/td><\/tr> -n num-sub<\/td> \u6307\u5b9a\u7f13\u51b2\u6c60\u5927\u5c0f\uff0c\u9ed8\u8ba4\u4e3a4\u4e2a\u5b50\u7f13\u51b2\u533a<\/td><\/tr> -o file<\/td> \u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u7684\u540d\u5b57<\/td><\/tr> -r rel-path<\/td> \u6307\u5b9a\u7684debugfs\u6302\u8f7d\u70b9<\/td><\/tr> -w seconds<\/td> \u8bbe\u7f6e\u8fd0\u884c\u7684\u65f6\u95f4<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n [root@linuxcool ~]# yum install blktrace -y<\/pre>\n\n\n\n
[root@linuxcool ~]# mount -t debugfs debugfs \/sys\/kernel\/debug<\/pre>\n\n\n\n
[root@linuxcool ~]# blktrace -d \/dev\/sdb -o \u2013 | blkparse -i \u2013<\/pre>\n\n\n\n
[root@linuxcool ~]# blktrace -d \/dev\/sdc<\/pre>\n\n\n\n
[root@linuxcool ~]# blkparse -i sdc -d sdc.blktrace.bin<\/pre>\n","protected":false},"excerpt":{"rendered":"