如何使用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.pswp.cn/news/390019.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/390019.shtml
英文地址,請注明出處:http://en.pswp.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) 向數據流中…