如何使用fio模拟线上环境

线上表现

这里我想通过fio来模拟线上的IO场景,那么如何模拟呢?

首先使用iostat看线上某个盘的 使用情况,这里我们需要关注的是 avgrq-sz, avgrq-qz.

#iostat -dx 1 1000 /dev/sdk
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdk               0.22    16.32   71.08   49.98 23544.95 19763.38   715.45     0.65    5.34    7.64    2.08   5.21  63.04Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdk               0.00     0.00   81.00   78.00 26968.00 39936.00   841.56   143.32  683.93   38.35 1354.35   6.29 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdk               0.00     0.00  115.00   10.00 36940.00  5120.00   672.96   156.64  167.23   30.00 1745.40   7.99  99.90Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdk               0.00    44.00  107.00   28.00 37924.00 13496.00   761.78   149.48  584.97   33.19 2693.57   7.41 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdk               2.00     0.00  153.00    5.00 40896.00  2560.00   550.08   158.39  160.71   29.68 4170.20   6.33 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdk               0.00     0.00   89.00   88.00 28864.00 44424.00   828.11   143.19 2087.81   22.73 4176.35   5.65 100.00
  1. avgrq-sz: 和fio的-bs=参数关联, 单位是扇区数,一个扇区的大小是512KB,因此, 841.56 代表大小是: 841.56/2 = 420.78KB.
  2. avgra-gz: 和fio的iodepth关联,大概是150,因此,我们需要调整 fio的 iodepth的值

线下模拟

那么如何使用fio去模拟这个大小呢?

fio中最重要的一个参数是: -bs=xxxx, 我们经常看到这里是4k,16k,128k等等的测试数据,这里其实就是request 从elevator中出来,dispatch到driver的时候的大小。

线上机器 大小是 841.56 sector (420.78KB.)的时候, 意味着,这里, -bs=420k 比较合适。

需要注意的:

  1. 如果测试/dev/sdc, so, mount /dev/sdc /mnt/sdc , fio目标是/mnt/sdc/test, 而不是 /dev/sdc
  2. 线上差不多4个线程, numjobs = 4
  3. 线上读写比例3:1, So, -rwmixread=70
#fio -filename=/mnt/sdc/test -direct=1 -iodepth=4 -thread -rw=randrw -rwmixread=70 -ioengine=libaio -bs=420k -size=2G -numjobs=4 -name="EBS 4K randwrite test" -group_reporting -runtime=5000

avgqu-sz 和fio的iodepth 的关系

iodepth = 1, iostat avgqu-sz =

#fio -filename=/apxxxxxxx/disk3/test -direct=1 -iodepth=1 -thread -rw=randrw -rwmixread=70 -rwmixwrite=30 -ioengine=libaio -bs=4k -size=8G -numjobs=4 -name="EBS 4K randwrite test" -group_reporting -runtime=50000
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  226.00  125.00   904.00   500.00     8.00    12.00   11.36   17.29    0.62   2.85 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     1.00   23.00    6.00    92.00    28.00     8.28    12.91   16.41   20.61    0.33  34.48 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  186.00   99.00   744.00   396.00     8.00    12.21   30.16   39.33   12.94   3.51 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  207.00  108.00   828.00   432.00     8.00    12.00   12.87   19.07    1.00   3.17 100.00

iodepth = 100, iostat avgqu-sz =

#fio -filename=/axxxxxx/disk3/test -direct=1 -iodepth=100 -thread -rw=randrw -rwmixread=70 -rwmixwrite=30 -ioengine=libaio -bs=4k -size=8G -numjobs=4 -name="EBS 4K randwrite test" -group_reporting -runtime=50000

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  180.00   68.00   720.00   272.00     8.00   111.30  230.22  231.29  227.40   2.85  70.80Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  241.00  103.00   964.00   412.00     8.00   159.43  392.41  395.76  384.58   2.91 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  254.00   89.00  1016.00   356.00     8.00   158.65  465.12  436.02  548.17   2.92 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  261.00  114.00  1044.00   456.00     8.00   156.64  395.21  440.19  292.23   2.67 100.00

开始模拟: cfq对SYNC, ASYNC的影响

Case1: fio 使用-direct=1

这里read write都是SYNC, 由于cfq 的影响,保SYNC, 因为线上的场景是 SYNC 的read, 和ASYNC的 writeback,所以这样模拟是不对的

command:

#fio -filename=/apsarapangu/disk3/test -direct=1 -iodepth=130 -thread -rw=randrw -rwmixread=70 -rwmixwrite=30 -ioengine=libaio -bs=420k -size=8G -numjobs=4 -name="EBS 4K randwrite test" -group_reporting -runtime=50000

performance:

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  106.00   56.00 43084.00 23868.00   826.57   297.76  609.85  539.71  742.61   6.17 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  100.00   57.00 40740.00 22752.00   808.82   307.53 1015.72  893.46 1230.21   6.37 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00   95.00   50.00 37556.00 20160.00   796.08   278.35 1181.94 1041.71 1448.40   6.90 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     1.00   59.00   74.00 23940.00 28568.00   789.59   223.16 2312.37 1595.39 2884.01   7.52 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00   79.00   32.00 32340.00 12956.00   816.14   299.97 1007.95  744.37 1658.66   9.01 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  124.00   41.00 50616.00 17656.00   827.54   303.84 1060.12  906.26 1525.46   6.06 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  106.00   47.00 43368.00 18532.00   809.15   290.17 1676.39 1099.78 2976.83   6.54 100.00

Analyze: Not I want!

Case2: fio 不使用-direct=1

这里read write都是SYNC, 由于cfq 的影响,保SYNC, 因为线上的场景是 SYNC 的read, 和ASYNC的 writeback,这里就和线上比较相似。

command:

#fio -filename=/apsarapangu/disk3/test -iodepth=130 -thread -rw=randrw -rwmixread=70 -rwmixwrite=30 -ioengine=libaio -bs=420k -size=8G -numjobs=4 -name="EBS 4K randwrite test" -group_reporting -runtime=50000

when cfq:

#echo cfq > /sys/block/sdc/queue/scheduler

Performance:

  • when read and writeback reproduce at the same time:
  • cfq have a good performance better than noop at this scene!
  • Cause cfq and split SYNC and ASYNC, SYNC have a better priority!
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  353.00    8.00 41768.00  3504.00   250.81   148.39   91.06   40.39 2326.88   2.77 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  374.00    4.00 45348.00  1864.00   249.80   145.76   64.60   30.51 3251.75   2.65 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     2.00  201.00   32.00 19400.00 12756.00   276.02   175.74  581.51  100.38 3603.59   4.29 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  384.00    1.00 46524.00   420.00   243.86   171.37   48.15   34.22 5396.00   2.60 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  346.00    0.00 50388.00     0.00   291.26   167.22   29.55   29.55    0.00   2.89 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  417.00    0.00 46424.00     0.00   222.66   168.39   26.64   26.64    0.00   2.40 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00  365.00    1.00 47996.00   420.00   264.57   166.98   50.49   30.11 7492.00   2.73 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     9.00  271.00  101.00 30148.00 41796.00   386.80   161.59 2375.33   30.86 8665.95   2.69 100.00

when noop:

#echo noop > /sys/block/sdc/queue/scheduler

Performance:

  • When read and writeback reproduce at the same time
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     3.00   69.00  248.00  1864.00 100800.00   647.72   178.71  580.56  537.20  592.62   3.15 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     2.00   63.00  246.00  1568.00 100412.00   660.06   173.11  583.21  523.25  598.57   3.24 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     0.00   33.00   90.00   912.00 36544.00   609.04   181.04 1077.03 1079.82 1076.01   8.13 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     2.00   59.00  242.00  1436.00 100800.00   679.31   183.44  732.01  565.46  772.62   3.32 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     1.00   66.00  250.00  2364.00 102060.00   660.91   176.00  567.93  513.26  582.36   3.16 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     2.00   71.00  251.00  1700.00 104160.00   657.52   177.67  569.05  513.06  584.88   3.11 100.00Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdc               0.00     6.00   44.00  233.00  1764.00 96180.00   707.18   161.17  604.32  542.25  616.04   3.61 100.00

转载于:https://www.cnblogs.com/muahao/p/9390204.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/390019.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

熊猫数据集_熊猫迈向数据科学的第二部分

熊猫数据集If you haven’t read the first article then it is advised that you go through that before continuing with this article. You can find that article here. So far we have learned how to access data in different ways. Now we will learn how to analyze …

Python基础综合练习

Pycharm开发环境设置与熟悉。 练习基本输入输出&#xff1a; print(你好,{}..format(name)) print(sys.argv) 库的使用方法&#xff1a; import ... from ... import ... 条件语句&#xff1a; if (abs(pos()))<1: break 循环语句&#xff1a; for i in range(5): while Tru…

POJ 3608 旋转卡壳

思路&#xff1a; 旋转卡壳应用 注意点&边 边&边 点&点 三种情况 //By SiriusRen #include <cmath> #include <cstdio> #include <algorithm> using namespace std; const double eps1e-5; const int N10050; typedef double db; int n,m; str…

405. 数字转换为十六进制数

405. 数字转换为十六进制数 给定一个整数&#xff0c;编写一个算法将这个数转换为十六进制数。对于负整数&#xff0c;我们通常使用 补码运算 方法。 注意: 十六进制中所有字母(a-f)都必须是小写。 十六进制字符串中不能包含多余的前导零。如果要转化的数为0&#xff0c;那么…

为什么我要重新开始数据科学

I’m feeling stuck.我感觉卡住了。 In my current work and in the content I create (videos and blog posts), I feel like I’ve begun to stall out. Most of the consumers of my content are at the start of their data science journey. The longer I’m in the fiel…

蓝牙协议 HFP,HSP,A2DP,A2DP_CT,A2DP_TG,AVRCP,OPP,PBAP,SPP,FTP,TP,DTMF,DUN,SDP

简介&#xff1a; HSP&#xff08;手机规格&#xff09;– 提供手机&#xff08;移动电话&#xff09;与耳机之间通信所需的基本功能。 HFP&#xff08;免提规格&#xff09;– 在 HSP 的基础上增加了某些扩展功能&#xff0c;原来只用于从固定车载免提装置来控制移动电话。 A2…

482. 密钥格式化

482. 密钥格式化 有一个密钥字符串 S &#xff0c;只包含字母&#xff0c;数字以及 ‘-’&#xff08;破折号&#xff09;。其中&#xff0c; N 个 ‘-’ 将字符串分成了 N1 组。 给你一个数字 K&#xff0c;请你重新格式化字符串&#xff0c;使每个分组恰好包含 K 个字符。特…

安装mariadb、安装Apache

2019独角兽企业重金招聘Python工程师标准>>> 安装mariadb 安装mariadb的步骤与安装mysql的一样 下载二进制源码包 再用tar 解压&#xff0c;创建/data/mariadb目录和用户 初始化 编译启动脚本 启动 安装Apache Apache是软件基金会的名字&#xff0c;软件的名字叫htt…

数据科学的发展_数据科学的发展与发展

数据科学的发展There’s perhaps nothing that sets the 21st century apart from others more than the concept of data. Every interaction we have with a connected device creates a data record, and beams it back to some data store for tracking and analysis. Inte…

Polling 、Long Polling 和 WebSocket

最近在学习研究WebSocket,了解到Polling 和Long Polling,翻阅了一些博文&#xff0c;根据自己的理解&#xff0c;做个学习笔记 Polling &#xff08;轮询&#xff09;&#xff1a; 这种方式就是客户端定时向服务器发送http的Get请求&#xff0c;服务器收到请求后&#xff0c;就…

惯性张量的推理_选择合适的intel工作站处理器进行张量流推理和开发

惯性张量的推理With the increasing number of data scientists using TensorFlow, it might be a good time to discuss which workstation processor to choose from Intel’s lineup. You have several options to choose from:随着使用TensorFlow的数据科学家数量的增加&am…

MongoDB数据库查询性能提高40倍

MongoDB数据库查询性能提高40倍 大家在使用 MongoDB 的时候有没有碰到过性能问题呢&#xff1f;下面这篇文章主要给大家分享了MongoDB数据库查询性能提高40倍的经历&#xff0c;需要的朋友可以参考借鉴&#xff0c;下面来一起看看吧。 前言 数据库性能对软件整体性能有着至关重…

通过Ajax方式上传文件(input file),使用FormData进行Ajax请求

<script type"text/jscript">$(function () {$("#btn_uploadimg").click(function () {var fileObj document.getElementById("FileUpload").files[0]; // js 获取文件对象if (typeof (fileObj) "undefined" || fileObj.size …

并发插入数据库会导致失败吗_会导致业务失败的数据分析方法

并发插入数据库会导致失败吗The true value of data depends on business insight.Data analysis is one of the most powerful resources an enterprise has. However, if the tools and processes used are not friendly and widely available to the business users who nee…

434. 字符串中的单词数

434. 字符串中的单词数 统计字符串中的单词个数&#xff0c;这里的单词指的是连续的不是空格的字符。 请注意&#xff0c;你可以假定字符串里不包括任何不可打印的字符。 示例: 输入: “Hello, my name is John” 输出: 5 解释: 这里的单词是指连续的不是空格的字符&#x…

zooland 新开源的RPC项目,希望大家在开发的微服务的时候多一种选择,让微服务开发简单,并且容易上手。...

zooland 我叫它动物园地&#xff0c;一个构思很长时间的一个项目。起初只是觉得各种通信框架都封装的很好了&#xff0c;但是就是差些兼容&#xff0c;防错&#xff0c;高可用。同时在使用上&#xff0c;不希望有多余的代码&#xff0c;像普通接口一样使用就可以了。 基于这些想…

187. 重复的DNA序列

187. 重复的DNA序列 所有 DNA 都由一系列缩写为 ‘A’&#xff0c;‘C’&#xff0c;‘G’ 和 ‘T’ 的核苷酸组成&#xff0c;例如&#xff1a;“ACGAATTCCG”。在研究 DNA 时&#xff0c;识别 DNA 中的重复序列有时会对研究非常有帮助。 编写一个函数来找出所有目标子串&am…

牛客网_Go语言相关练习_选择题(2)

注&#xff1a;题目来源均出自牛客网。 一、选择题 Map&#xff08;集合&#xff09;属于Go的内置类型&#xff0c;不需要引入其它库即可使用。 Go-Map_菜鸟教程 在函数声明中&#xff0c;返回的参数要么都有变量名&#xff0c;要么都没有。 C选项函数声明语法有错误&#xff0…

机器学习模型部署_9月版部署机器学习模型

机器学习模型部署每月版 (MONTHLY EDITION) Often, the last step of a Data Science task is deployment. Let’s say you’re working at a big corporation. You’re building a project for a customer of the corporation and you’ve created a model that performs well…

352. 将数据流变为多个不相交区间

352. 将数据流变为多个不相交区间 给你一个由非负整数 a1, a2, …, an 组成的数据流输入&#xff0c;请你将到目前为止看到的数字总结为不相交的区间列表。 实现 SummaryRanges 类&#xff1a; SummaryRanges() 使用一个空数据流初始化对象。void addNum(int val) 向数据流中…