參考:
https://www.cnblogs.com/xuzhongtao/p/14517876.html
https://help.aliyun.com/document_detail/65228.htm#section-urf-b97-l23
單個文件系統的讀寫性能上限(峰值)與文件系統的當前使用容量成正比,即使用容量越大,讀寫性能上限(峰值)越高。
IOPS(Input/Output Per Second)即每秒IO操作的次數(讀寫次數)。
吞吐量 = IOPS * 讀寫塊大小
IOPS = 讀寫次數 / 任務整體時延
序號 | 讀寫塊大小 | 並發數 | 寫入次數 | 任務整體時延 | IOPS | 吞吐量 | 說明 |
---|---|---|---|---|---|---|---|
方案一 | 4 KiB | 1 | 250 | 10 ms*250=2.5s | 250/2.5s=100 | 4 KiB*100=400 KiB/s | 小塊讀寫加上低並發數,導致吞吐和時延性能都很差,無法達到1 MiB/s的吞吐目標。 |
方案二 | 1 MiB | 1 | 1 | 100 ms | 1/0.1s=10 | 1 MiB*10=10 MiB/s | 相較方案一僅提高讀寫塊大小,吞吐和時延性能有提升,達到了1 MiB/s的吞吐目標,但任務整體時延較長。 |
方案三 | 4 KiB | 125 | 250 | 10 ms*(250/125)=20 ms | 250/0.02s=12500 | 4 KiB*12500≈49 MiB/s | 相較方案一僅提高任務並發數,吞吐和時延性能有提升,達到了1 MiB/s的吞吐目標,任務整體時延也很短,但IOPS較高,容易觸及文件系統的IOPS上限。 |
方案四 | 8 KiB | 125 | 125 | 15 ms*(125/125)=15 ms | 125/0.015s≈8333 | 8 KiB*8333≈65 MiB/s | 相較方案一同時提高讀寫塊大小和任務並發數,吞吐和時延性能有提升,達到了1 MiB/s的吞吐目標,任務整體延時最短,IOPS較低,不容易觸及文件系統的IOPS上限。 |
I/O 測試工具
FIO
https://www.cnblogs.com/bugutian/p/6653083.html
https://linux.die.net/man/1/fio
http://rpmfind.net/linux/rpm2html/search.php?query=fio(x86-64)
I/O benchmark and stress/hardware verification tool |
DAG packages for Red Hat Linux el7 x86_64 |
Linux IOSTAT / NFSIOSTAT 命令
https://blog.csdn.net/wych1981/article/details/8020429
IOSTAT
https://www.cnblogs.com/Sweettesting/p/13902545.html
avg-cpu:總體cpu使用情況統計信息,對於多核cpu,這里為所有cpu的平均值。重點關注iowait值,表示CPU用於
等待io請求的完成時間,各參數介紹如下:
%user:CPU處在用戶模式下的時間百分比
%nice:CPU處在帶NICE值的用戶模式下的時間百分比
%system:CPU處在系統模式下的時間百分比
%iowait:CPU等待輸入輸出完成時間的百分比
%steal:管理程序維護另一個虛擬處理器時,虛擬CPU的無意識等待時間百分比
%idle:CPU空閑時間百分比
Device:各磁盤設備的IO統計信息,參數介紹如下:
tps:該設備每秒的傳輸次數(Indicate the number of transfers per second that were issued to the device)。“一次傳輸”意思是“一次I/O請求”,多個邏輯請求可能會被合並為“一次I/O請求”,“一次傳輸”請求的大小是未知的。
kB_read/s:每秒從設備(drive expressed)讀取的數據量
kB_wrtn/s:每秒向設備(drive expressed)寫入的數據量
kB_read:讀取的數據總量
kB_wrtn:寫入的數據總量
如果%iowait的值過高,表示硬盤存在I/O瓶頸。
如果%idle值高,表示CPU較空閑;如果%idle值高但系統響應慢時,有可能是CPU等待分配內存,此時應加大內存容量;%idle值如果持續低於10,那么系統的CPU處理能力相對較低,表明系統中最需要解決的資源是CPU。
NFSIOSTAT:
(1)nfsiostat輸出的間隔時間,(2)運行nfsiostat的次數,如果第二個數字留空,nfsiostat會一直執行下去,直到你按下^c停止它。
https://blog.csdn.net/linux_tcpdump/article/details/114336653
https://www.howtouselinux.com/post/use-linux-nfsiostat-to-troubleshoot-nfs-performance-issue
We can get the NFS performance metrics here like NFS IOPS, bandwidth, latency.
-
op/s This is the number of operations per second.
-
rpc bklog This is the length of the backlog queue.
-
kB/s This is the number of kB written/read per second.
-
kB/op This is the number of kB written/read per each operation.
-
retrans This is the number of retransmissions.
-
avg RTT (ms) This is the duration from the time that client's kernel sends the RPC request until the time it receives the reply.
-
avg exe (ms) This is the duration from the time that NFS client does the RPC request to its kernel until the RPC request is completed, this includes the RTT time above.
sar
https://www.e-learn.cn/topic/3803452