{"id":7420,"date":"2022-08-30T11:48:31","date_gmt":"2022-08-30T03:48:31","guid":{"rendered":"https:\/\/egonlin.com\/?p=7420"},"modified":"2022-10-27T12:20:13","modified_gmt":"2022-10-27T04:20:13","slug":"03-%e6%8e%a7%e5%88%b6%e5%ae%b9%e5%99%a8%e7%a3%81%e7%9b%98%e8%af%bb%e5%86%99%e6%80%a7%e8%83%bd","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=7420","title":{"rendered":"03 \u63a7\u5236\u5bb9\u5668\u78c1\u76d8\u8bfb\u5199\u6027\u80fd"},"content":{"rendered":"<h1>\u4e00 \u5f15\u5165\u95ee\u9898<\/h1>\n<p>\u9664\u4e86\u63a7\u5236\u5bb9\u5668\u7684\u78c1\u76d8\u7684\u5bb9\u91cf\u4e4b\u5916\uff0c\u8fd8\u5e94\u8be5\u5bf9\u5bb9\u5668\u7684\u78c1\u76d8\u6027\u80fd\u8fdb\u884c\u9650\u5236\uff0c\u9632\u6b62\u5f71\u54cd\u5230\u5176\u4ed6\u5bb9\u5668\u3002<\/p>\n<p>\u5728\u4ecb\u7ecd\u793a\u4f8b\u4e4b\u524d\uff0c\u5148\u6765\u590d\u4e60\u4e00\u4e2a\u77e5\u8bc6<\/p>\n<p>\u8861\u91cf\u78c1\u76d8\u6027\u80fd\u7684\u4e24\u4e2a\u5e38\u89c1\u7684\u6307\u6807 <\/p>\n<ul>\n<li>IOPS \uff1a\u82f1\u6587\u5168\u79f0 Input\/Output Operations Per Second \uff0c\u7ffb\u8bd1\u8fc7\u6765\u5c31\u662f<strong>\u6bcf\u79d2\u949f\u78c1\u76d8\u8bfb\u5199\u7684\u6b21\u6570<\/strong>\uff0c\u8fd9\u4e2a\u6570\u503c\u8d8a\u5927\uff0c\u5f53\u7136\u4e5f\u5c31\u8868\u793a\u6027\u80fd\u8d8a\u597d\u3002<\/li>\n<li>\n<p>BPS\uff08Throughput\u541e\u5410\u91cf\uff0c\u6709\u65f6\u5019\u4e5f\u88ab\u79f0\u4e3a\u5e26\u5bbdBandwidth\uff0c\u7b80\u79f0 BW\uff09\uff1a\u662f\u6307<strong>\u6bcf\u79d2\u949f\u78c1\u76d8\u4e2d\u6570\u636e\u7684\u8bfb\u53d6\u91cf<\/strong>\uff0c\u4e00\u822c\u4ee5 MB\/s \u4e3a\u5355\u4f4d\u3002\u8fd9\u4e2a\u8bfb\u53d6\u91cf\u53ef\u4ee5\u53eb\u4f5c\u541e\u5410\u91cf<\/p>\n<p>IOPS\u4e0e\u541e\u5410\u91cf\u76f4\u63a5\u7684\u5173\u7cfb\uff0c\u53ef\u4ee5\u7b80\u5355\u7684\u5927\u6982\u7406\u89e3\u4e3a\uff1a\u541e\u5410\u91cf = \u6570\u636e\u5757\u5927\u5c0f *IOPS<br \/>\n\u4ece\u4e0a\u9762\u7684\u7b80\u7565\u516c\u5f0f\u4e2d\u53ef\u4ee5\u770b\u51fa\u6765\uff0c\u5982\u679cIOPS\u56fa\u5b9a\uff0c\u90a3\u4e48\u6570\u636e\u5e93\u8d8a\u5927\uff0c\u541e\u5410\u91cf\u81ea\u7136\u8d8a\u5927<\/p>\n<\/li>\n<\/ul>\n<p>\u793a\u4f8b\uff1a\u4e0b\u9762\u793a\u4f8b\u4e2d\u7528 fio \u6d4b\u8bd5\u7684\u7ed3\u679c\u4e2d\u5c31\u5305\u542b\u4e86\u5e26\u5bbdBW<\/p>\n<pre><code class=\"language-bash\"># 1\u3001\u5236\u4f5c\u955c\u50cf\n[root@test04 ttt]# cat Dockerfile \nFROM centos:7\n\nRUN yum install fio -y\n\nCMD tail -f \/dev\/null\n\n[root@test04 ttt]# docker build -t fiotest:v1.0 .\/\n\n# 2\u3001\u5bb9\u5668\u6587\u4ef6\u7cfb\u7edf\u5e76\u4e0d\u9002\u5408\u9891\u7e41\u7684\u5199\uff0c\u5bf9\u4e8e\u9891\u7e41\u7684\u5199\u5165\u64cd\u4f5c\uff0c\u5e94\u8be5\u4e3a\u5176\u5173\u8054\u4e00\u4e2avolume\uff0cvolume\u53ef\u4ee5\u662f\u4e00\u4e2a\u672c\u6b21\u78c1\u76d8\uff0c\u4e5f\u53ef\u4ee5\u662f\u4e00\u4e2a\u7f51\u7edc\u78c1\u76d8\n[root@test04 ~]# mkdir \/tmp\/test1\n[root@test04 ~]# mkdir \/tmp\/test2\n[root@test04 ~]# mkdir \/tmp\/test3\n\n[root@test04 ~]# docker container run -d --name test1 -v \/tmp\/test1:\/tmp\/test1 fiotest:v1.0 tail -f \/dev\/null\n\n[root@test04 ~]# docker container run -d --name test2 -v \/tmp\/test2:\/tmp\/test2 fiotest:v1.0 tail -f \/dev\/null\n\n[root@test04 ~]# docker container run -d --name test3 -v \/tmp\/test3:\/tmp\/test3 fiotest:v1.0 tail -f \/dev\/null\n\n# 3\u3001\u5148\u6d4b\u8bd5\uff0c\u53ea\u6709\u4e00\u4e2a\u5bb9\u5668\u5728\u5199\u7684\u65f6\u5019\u7684\u5e26\u5bbd\u60c5\u51b5\n[root@test04 ttt]# docker exec -ti test1 sh\nsh-4.2# fio -name=mytest1 -direct=1 -rw=write -bs=4k -size=2G -ioengine=libaio -iodepth=64 -thread -numjob=1 -filename=\/tmp\/test1\/test1.txt\n\n\u8f93\u51fa\uff1awrite: IOPS=21.5k, BW=83.8MiB\/s (87.9MB\/s)(2048MiB\/24431msec)\n\u4ee3\u8868\u6b64IOS\u4e3a21.5k\uff0c\u5e26\u5bbd\uff08BW\uff09\u662f83.8MiB\/s\u5de6\u53f3\n\n# 4\u3001\u7136\u540e\u6d4b\u8bd5\uff0c3\u4e2a\u5bb9\u5668\u540c\u65f6\u5728\u5199\u7684\u65f6\u5019\u5404\u81ea\u7684\u5e26\u5bbd\u60c5\u51b5\n\u5f3a\u8c03\uff0c\u5982\u679c\u4f60\u8981\u540c\u65f6\u6d4b\u8bd5\uff0c\u8bf7\u4fdd\u8bc1\u5185\u5b58\u5269\u4f59\u5145\u8db3\uff0c\u5426\u5219\u540c\u65f6\u6d4b\u8bd5fio\u7684\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u603b\u6709\u4e00\u4e2a\u88abkilled\u7684\u60c5\u51b5\n\u5f3a\u8c03\uff0c\u5982\u679c\u4f60\u8981\u540c\u65f6\u6d4b\u8bd5\uff0c\u8bf7\u4fdd\u8bc1\u5185\u5b58\u5269\u4f59\u5145\u8db3\uff0c\u5426\u5219\u540c\u65f6\u6d4b\u8bd5fio\u7684\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u603b\u6709\u4e00\u4e2a\u88abkilled\u7684\u60c5\u51b5\n\u5f3a\u8c03\uff0c\u5982\u679c\u4f60\u8981\u540c\u65f6\u6d4b\u8bd5\uff0c\u8bf7\u4fdd\u8bc1\u5185\u5b58\u5269\u4f59\u5145\u8db3\uff0c\u5426\u5219\u540c\u65f6\u6d4b\u8bd5fio\u7684\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u603b\u6709\u4e00\u4e2a\u88abkilled\u7684\u60c5\u51b5\n\u5f3a\u8c03\uff0c\u5982\u679c\u4f60\u8981\u540c\u65f6\u6d4b\u8bd5\uff0c\u8bf7\u4fdd\u8bc1\u5185\u5b58\u5269\u4f59\u5145\u8db3\uff0c\u5426\u5219\u540c\u65f6\u6d4b\u8bd5fio\u7684\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u603b\u6709\u4e00\u4e2a\u88abkilled\u7684\u60c5\u51b5\n\u5f3a\u8c03\uff0c\u5982\u679c\u4f60\u8981\u540c\u65f6\u6d4b\u8bd5\uff0c\u8bf7\u4fdd\u8bc1\u5185\u5b58\u5269\u4f59\u5145\u8db3\uff0c\u5426\u5219\u540c\u65f6\u6d4b\u8bd5fio\u7684\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u603b\u6709\u4e00\u4e2a\u88abkilled\u7684\u60c5\u51b5\n\n\u4e0b\u97623\u4e2afio\u6d4b\u8bd5\u8981\u540c\u65f6\u6267\u884c\n[root@test04 ttt]# docker exec -ti test1 sh\nsh-4.2# fio -name=mytest1 -direct=1 -rw=write -bs=4k -size=2G -ioengine=libaio -iodepth=64 -thread -numjob=1 -filename=\/tmp\/test1\/1.txt\n\u8f93\u51fa\uff1awrite: IOPS=10.3k, BW=40.4MiB\/s (42.4MB\/s)(2048MiB\/50693msec)\n\n[root@test04 ttt]# docker exec -ti test2 sh\nsh-4.2# fio -name=mytest2 -direct=1 -rw=write -bs=4k -size=2G -ioengine=libaio -iodepth=64 -thread -numjob=1 -filename=\/tmp\/test2\/2.txt\n\u8f93\u51fa\uff1awrite: IOPS=9763, BW=38.1MiB\/s (39.0MB\/s)(2048MiB\/53700msec)\n\n[root@test04 ttt]# docker exec -ti test3 sh\nsh-4.2# fio -name=mytest3 -direct=1 -rw=write -bs=4k -size=2G -ioengine=libaio -iodepth=64 -thread -numjob=1 -filename=\/tmp\/test3\/3.txt\n\u8f93\u51fa\uff1awrite: IOPS=11.5k, BW=44.7MiB\/s (46.9MB\/s)(2048MiB\/45774msec)<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u5f53\u591a\u4e2a\u5bb9\u5668\u540c\u65f6\u8fdb\u884c\u5199\u64cd\u4f5c\u65f6\uff0cIOS\u4e0eBW\u5e26\u5bbd\u90fd\u4f1a\u4e0b\u964d<\/p>\n<p>\u8865\u5145<\/p>\n<blockquote>\n<p>\u5728linux\u5185\u68384.15\u4e4b\u540e\uff0c\u4e3a\u4e86OverlayFS\u6dfb\u52a0\u4e86\u81ea\u5df1\u7684read\/write\u63a5\u53e3\uff0c\u4ece\u800c\u4e0d\u518d\u76f4\u63a5\u8c03\u7528OverlayFS\u540e\u7aef\u6587\u4ef6\u7cfb\u7edf\u5982XFS\u6216Ext4\u7684\u8bfb\u5199\u63a5\u53e3\uff0c\u4f46\u4e5f\u53ea\u5b9e\u73b0\u4e86\u540c\u6b65I\/O\uff08sync I\/O\uff09\uff0c\u6ca1\u6709\u5b9e\u73b0\u5f02\u6b65I\/O\uff0c\u5982\u679c\u6211\u4eec\u7528fio\u5de5\u5177\u53bb\u6d4b\u8bd5\u6587\u4ef6\u7cfb\u7edf\u6027\u80fd\uff0c\u82e5\u91c7\u7528\u5f02\u6b65io\u6a21\u5f0f\uff0c\u5728linux5.4\u5185\u6838\u4e0a\u5c31\u65e0\u6cd5\u6d4b\u8bd5OverlayFS\u7684\u6700\u9ad8\u6027\u80fd\u6307\u6807\u3002<br \/>\nOverlayFS \u5728 Linux \u5185\u6838\u4e2d\u8fd8\u5728\u4e0d\u65ad\u7684\u5b8c\u5584\u4e2d\uff0clinux5.6\u5185\u6838\u901a\u8fc7\u6253\u8865\u4e01\u7684\u65b9\u5f0f\u4fee\u590d\u4e86\u4e0a\u8ff0\u95ee\u9898<\/p>\n<\/blockquote>\n<h1>\u4e8c \u57fa\u4e8eCgroup v1\u9650\u5236\u5bb9\u5668\u78c1\u76d8IO<\/h1>\n<p>\u6211\u4eec\u53ef\u4ee5\u7528Cgroups\u673a\u5236\u9650\u5236\u5bb9\u5668\u7684cpu\u3001\u5185\u5b58\u8d44\u6e90\u4f7f\u7528\uff0c\u540c\u6837\u53ef\u4ee5\u7528\u5b83\u6765\u9650\u5236\u5bb9\u5668\u7684\u78c1\u76d8\u6027\u80fd<\/p>\n<p>\u5177\u4f53\u5982\u4f55\u9650\u5236\uff0c\u9700\u8981\u5206cgroup v1\u4e0ecgroup v2\u4e24\u4e2a\u7248\u672c\u6765\u770b<br \/>\nCgroup v1 \u4e2d\u6709 blkio \u5b50\u7cfb\u7edf\uff0c\u5b83\u53ef\u4ee5\u6765\u9650\u5236\u78c1\u76d8\u7684 I\/O\uff0cblkio cgroup\u7684\u865a\u62df\u673a\u6587\u4ef6\u7cfb\u7edf\u6302\u8f7d\u70b9\u901a\u5e38\u5728&quot;\/sys\/fs\/cgroup\/blkio\/&quot;\uff0c\u6709\u56db\u4e2a\u91cd\u8981\u53c2\u6570<\/p><div id=\"rml_readmorelogin_placeholder\" style=\"position:relative;\"><div id=\"rml_fade_content\" style=\"position: absolute;\r\ntop:-10em;\r\nwidth:100%;\r\nheight:10em;\r\nbackground: -webkit-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -moz-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -o-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -ms-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\"><\/div><div class=\"wpf-controller aru_rml_from_in_post\" style=\"background-color:#eeeeee;border:5px solid #cce6ff;\" id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><h2 id=\"Header\">\u67e5\u770b\u66f4\u591a<\/h2><div id=\"Message\"><p>\u8054\u7cfb\u7ba1\u7406\u5458\u5fae\u4fe1tutu19192010\uff0c\u6ce8\u518c\u8d26\u53f7<\/p>\n<\/div><div id=\"StatusBarHeader\"><\/div><form id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><input name=\"post_id\" value=\"7420\" type=\"hidden\"\/><input name=\"_init_callback\" value=\"InitLogin\" type=\"hidden\"\/><input name=\"post_id\" value=\"7420\" type=\"hidden\"\/><input name=\"rt_ype\" value=\"1\" type=\"hidden\"\/><input name=\"nonce\" value=\"69167d0bd4\" type=\"hidden\"\/><input name=\"_wpnonce\" value=\"7755f0f36d\" type=\"hidden\"\/><input name=\"_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_proxy_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_view\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginView\" type=\"hidden\"\/><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\" width=\"400px\"><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Username:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"username\" value=\"\" type=\"text\"\/><\/td><\/tr><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Password:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"password\" value=\"\" type=\"password\"\/><\/td><\/tr><\/tbody><\/table><p class=\"wpf-table-placeholder submit\"><button class=\"wp_plugin_framework_ajax_button\" type=\"button\" style=\"background-color:#4D90FE;;color:#ffffff;;border:1px solid #3079ed;\" name=\"_event\" value=\"ButtonLogin\">Log in<\/button><\/p><\/td><td class=\"wpf-table-placeholder-input\"><\/td><\/tr><\/tbody><\/table><\/form><div id=\"ButtonStartRegister\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=register\">Register<\/a><\/div><div id=\"Link1\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=lostpassword\">Forgotten username or password?<\/a><\/div><div id=\"StatusBarFooter\"><\/div><\/div><\/div><div id=aru_remaining_content><\/div>","protected":false},"excerpt":{"rendered":"<p>\u4e00 \u5f15\u5165\u95ee\u9898 \u9664\u4e86\u63a7\u5236\u5bb9\u5668\u7684\u78c1\u76d8\u7684\u5bb9\u91cf\u4e4b\u5916\uff0c\u8fd8\u5e94\u8be5\u5bf9\u5bb9\u5668\u7684\u78c1\u76d8\u6027\u80fd\u8fdb\u884c\u9650\u5236\uff0c\u9632\u6b62\u5f71\u54cd\u5230\u5176\u4ed6\u5bb9\u5668\u3002 \u5728\u4ecb\u7ecd\u793a\u4f8b\u4e4b [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[426,422],"tags":[],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/7420"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7420"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/7420\/revisions"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}