连续6年不跑路的安全速度最适合国人VPN
概念
fio,又稱爲flexible io tester,是jens axboe編寫的應用程序。Jens是Linux Kernel中block IO subsystem的維護者。FIO是一種用於測試網絡文件系統和磁盤性能的工具,常用於驗證機型和比較文件系統性能。它能自動將fio命令發送到集羣機器列表,並收集小文件的IOPS和大文件的吞吐量數據。
rw=[mode]rwmixwrite=30 在混合讀寫的模式下,寫佔30%moderead 順序讀write 順序寫readwrite 順序混合讀寫randwrite 隨機寫randread 隨機讀randrw 隨機混合讀寫登錄後複製
安裝
yumdownloader --destdir=/tmp --resolve fiorpm -ivh /tmp/*.rpmrpm -ivh fio-3.7-2.el7.x86_64.rpm登錄後複製
說明
說明:filename=/dev/sdb1 測試文件名稱,通常選擇需要測試的盤的data目錄。direct=1 測試過程繞過機器自帶的buffer。使測試結果更真實。rw=randwrite 測試隨機寫的I/Orw=randrw 測試隨機寫和讀的I/Obs=16k 單次io的塊文件大小爲16kbsrange=512-2048 同上,提定數據塊的大小範圍size=5g 本次的測試文件大小爲5g,以每次4k的io進行測試。numjobs=30 本次的測試線程爲30.runtime=1000 測試時間爲1000秒,如果不寫則一直將5g文件分4k每次寫完爲止。ioengine=psync io引擎使用pync方式rwmixwrite=30 在混合讀寫的模式下,寫佔30%group_reporting 關於顯示結果的,彙總每個進程的信息。此外lockmem=1g 只使用1g內存進行測試。zero_buffers 用0初始化系統buffer。nrfiles=8 每個進程生成文件的數量。登錄後複製
測試隨機寫帶寬
fio --name=wbw --filename=/data/sui_ji_xie --numjobs=4 --bs=128k --size=4G --ioengine=libaio --direct=1 --randrepeat=0 --norandommap --rw=randwrite --group_reporting --iodepth=512 --iodepth_batch=128 --iodepth_batch_complete=128 --gtod_reduce=1 --runtime=30登錄後複製
測試4K 隨機寫延遲:
fio --name=wlat --filename=/data/4k_sui_ji_xie --numjobs=1 --runtime=30 --bs=4k --size=4G --ioengine=libaio --direct=1 --norandommap --randrepeat=0 -rw=randwrite --group_reporting --iodepth=1 --iodepth_batch_complete=0登錄後複製
測試4k 隨機寫IOPS:
fio --name=wiops --filename=/data/4k_sui_ji_xie_iops --numjobs=4 --bs=4k --size=4G --ioengine=libaio --direct=1 --randrepeat=0 --norandommap --rw=randwrite --group_reporting --iodepth=512 --iodepth_batch=128 --iodepth_batch_complete=128 --gtod_reduce=1 --runtime=30登錄後複製
測試4k 讀帶寬:
fio --name=rbw --filename=/data/4k_sui_ji_du --numjobs=4 --bs=128k --size=4G --ioengine=libaio --direct=1 --randrepeat=0 --norandommap --rw=randread --group_reporting --iodepth=512 --iodepth_batch=128 --iodepth_batch_complete=128 --gtod_reduce=1 --runtime=30登錄後複製
測試4k 隨機讀延遲:
fio --name=rlat --filename=/data/4k_sui_ji_du_yanchi --numjobs=1 --runtime=30 --bs=4k --size=4G --ioengine=libaio --direct=1 --randrepeat=0 --rw=randread --group_reporting --iodepth=1 --iodepth_batch_complete=0登錄後複製
測試4k 隨機讀IOPS:
fio --name=riops --filename=/data/4k_sui_ji_du_iops --numjobs=4 --bs=4k --size=4G --ioengine=libaio --direct=1 --randrepeat=0 --norandommap --rw=randread --group_reporting --iodepth=512 --iodepth_batch=128 --iodepth_batch_complete=128 --gtod_reduce=1 --runtime=30登錄後複製
隨機讀:
fio -filename=/data/sui_ji_du -iodepth=1 -ioengine=libaio -direct=1 -rw=randread -bs=4k -size=1G -numjobs=10 -runtime=20 -group_reporting -name=test-rand-read登錄後複製
隨機寫:
fio -filename=/data/sui_ji_xie -iodepth=64 -ioengine=libaio -direct=1 -rw=randwrite -bs=4k -size=2G -numjobs=64 -runtime=20 -group_reporting -name=test-rand-write登錄後複製
順序讀:
fio -filename=/data/shun_xu_du -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=20G -numjobs=30 -runtime=1000 -group_reporting -name=mytest登錄後複製
混合隨機讀寫:
fio -filename=/data/hun_he_du_xie -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=16k -size=10G -numjobs=30 -runtime=100 -group_reporting -name=mytest -ioscheduler=noop登錄後複製
io=執行了多少M的IObw=平均IO帶寬iops=IOPSrunt=線程運行時間slat=提交延遲clat=完成延遲lat=響應時間bw=帶寬cpu=利用率IO depths=io隊列IO submit=單個IO提交要提交的IO數IO complete=Like the above submit number, but for completions instead.IO issued=The number of read/write requests issued, and how many of them were short.IO latencies=IO完延遲的分佈io=總共執行了多少size的IOaggrb=group總帶寬minb=最小.平均帶寬.maxb=最大平均帶寬.mint=group中線程的最短運行時間.maxt=group中線程的最長運行時間.ios=所有group總共執行的IO數.merge=總共發生的IO合併數.ticks=Number of ticks we kept the disk busy.in_queue=花費在隊列上的總共時間.util=磁盤利用率登錄後複製
以上就是實戰:Linux上硬盤io讀寫測試的詳細內容,更多請關注本站其它相關文章!