日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

fio

發(fā)布時(shí)間:2025/4/9 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 fio 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一、安裝
http://freshmeat.sourceforge.net/projects/fio上下載fio-2.1.10.tar.gz,版本包見附件
解壓
tar ?-xvf ?fio-3.3.tar.gz
cd ?fio-3.3

執(zhí)行命令:
./configure
make
make install

安裝libaio-devel
yum install libaio-devel

重新執(zhí)行:
#./configure
#make
#make install

直接執(zhí)行fio測(cè)試。
#fio -ioengine=libaio -filename=fiofile -bs=20k -direct=1 -iodepth=4 -thread -size=300g -rw=randwrite -name=20k_randwrite -numjobs=2 -group_reporting
如果有報(bào)錯(cuò):是因?yàn)闆]裝libaio-devel

檢查libaio和rbd是否存在,存在表示已經(jīng)安裝了libaio和rdb,下面可以看到所有引擎
[root@ceph1 home]# fio --enghelp
Available IO engines:
cpuio
mmap
sync
psync
vsync
pvsync
null
net
netsplice
libaio
posixaio
falloc
e4defrag
splice
rbd
sg
binject
二、fio引擎介紹
參考網(wǎng)址:
http://blog.yufeng.info/archives/677
ioengine=str
Defines how the job issues I/O. The following types are defined:
sync
Basic read(2) or write(2) I/O. fseek(2) is used to position the I/O location.
psync
Basic pread(2) or pwrite(2) I/O.
vsync
Basic readv(2) or writev(2) I/O. Will emulate queuing by coalescing adjacents IOs into a single submission.
libaio
Linux native asynchronous I/O. This ioengine defines engine specific options.
posixaio
POSIX asynchronous I/O using aio_read(3) and aio_write(3).
solarisaio
Solaris native asynchronous I/O.
windowsaio
Windows native asynchronous I/O.
mmap
File is memory mapped with mmap(2) and data copied using memcpy(3).
splice
splice(2) is used to transfer the data and vmsplice(2) to transfer data from user-space to the kernel.
syslet-rw
Use the syslet system calls to make regular read/write asynchronous.
sg
SCSI generic sg v3 I/O. May be either synchronous using the SG_IO ioctl, or if the target is an sg character device, we use read(2) and write(2) for asynchronous I/O.
null
Doesn’t transfer any data, just pretends to. Mainly used to exercise fio itself and for debugging and testing purposes.
net
Transfer over the network. The protocol to be used can be defined with the protocol parameter. Depending on the protocol, filename, hostname, port, or listen must be specified. This ioengine defines engine specific options.
netsplice
Like net, but uses splice(2) and vmsplice(2) to map data and send/receive. This ioengine defines engine specific options.
cpuio
Doesn’t transfer any data, but burns CPU cycles according to cpuload and cpucycles parameters.
guasi
The GUASI I/O engine is the Generic Userspace Asynchronous Syscall Interface approach to asycnronous I/O.

個(gè)別中文解釋:
默認(rèn)值是sync同步阻塞I/O,
libaio是Linux的native異步I/O
io引擎使用pync方式
sync:采用read,write,使用fseek定位讀寫位置。
psync:采用pread、pwrite進(jìn)行文件讀寫操作
vsync:采用readv(2) orwritev(2)進(jìn)行文件讀寫操作
三、各引擎使用方法
1、fio-vsync:
vsync:采用readv(2) orwritev(2)進(jìn)行文件讀寫操作
fio -filename=/mnt/data/112.log -direct=1 -iodepth 1 -thread -rw=randread -ioengine=vsync -bs=4k -size=1G -numjobs=64 -runtime=10 -group_reporting -name=file

2、sync:采用read,write,使用fseek定位讀寫位置。同步阻塞I/O,
fio -filename=/mnt/data/111.log -ioengine=sync -direct=1 -rw=randwrite -bs=8k -size=1G -numjobs=8 -runtime=10-group_reporting -name=fio_test

3、psync對(duì)磁盤進(jìn)行讀寫(lsblk),如下查出來就是/dev/vdb
[root@host111 data]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 252:0 0 75G 0 disk
├─vda1 252:1 0 200M 0 part /boot
└─vda2 252:2 0 74.8G 0 part
├─systemvg-swaplv (dm-0) 253:0 0 10G 0 lvm [SWAP]
├─systemvg-rootlv (dm-1) 253:1 0 8G 0 lvm /
├─systemvg-homelv (dm-2) 253:2 0 2G 0 lvm /home
├─systemvg-varlv (dm-3) 253:3 0 6G 0 lvm /var
├─systemvg-tmplv (dm-4) 253:4 0 2G 0 lvm /tmp
├─systemvg-optlv (dm-5) 253:5 0 30G 0 lvm /opt
└─systemvg-usrlv (dm-6) 253:6 0 10G 0 lvm /usr
vdb 252:16 0 100G 0 disk /mysql
vdc 252:32 0 500G 0 disk /mnt/data

或者對(duì)一個(gè)文件進(jìn)行寫:
fio -filename=/mnt/data/112.log -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=4k -size=1G -numjobs=64 -runtime=10 -group_reporting -name=file

4、posixaio:glibc POSIX asynchronous I/O using aio_read(3) and aio_write(3).
fio -name=/mnt/data/11.log -direct=0 -iodepth=96 -rw=randread -ioengine=posixaio -bs=4k -size=1G -numjobs=64 -runtime=10 -group_reporting

5、libaio:Linux native asynchronous I/O.Linux的native異步I/O
fio -filename=/mnt/data/112.log -direct=1 -iodepth 1 -thread -rw=randread -ioengine=libaio -bs=4k -size=1G -numjobs=64 -runtime=10 -group_reporting -name=file

6、mmap:File is memory mapped with mmap(2) and data copied using memcpy(3).
fio -filename=/mnt/data/112.log -direct=1 -iodepth 1 -thread -rw=randread -ioengine=mmap -bs=4k -size=1G -numjobs=64 -runtime=10 -group_reporting -name=file

7、splice: splice(2) is used to transfer the data and vmsplice(2) to transfer data from user-space to the kernel.
fio -filename=/mnt/data/112.log -direct=1 -iodepth 1 -thread -rw=randread -ioengine=splice -bs=4k -size=1G -numjobs=64 -runtime=10 -group_reporting -name=file

8、falloc
fio -filename=/mnt/data/112.log -direct=1 -iodepth 1 -thread -rw=randread -ioengine=falloc -bs=4k -size=1G -numjobs=64 -runtime=10 -group_reporting -name=file

9、pvsync:
fio -filename=/mnt/data/112.log -direct=1 -iodepth 1 -thread -rw=randread -ioengine=pvsync -bs=4k -size=1G -numjobs=64 -runtime=10 -group_reporting -name=file

引擎參照:沒有舉例的可能執(zhí)行有問題,或者是針對(duì)塊存儲(chǔ)的
binject:只針對(duì)block devices
sg:針對(duì)塊
splice
e4defrag:Option inplace: missing long option name
falloc
posixaio
libaio
net:fio: network IO can't be random
netsplice
null
sync
psync
vsync
pvsync
mmap
cpuio
syslet-rw

使用配置文件執(zhí)行:
參考:https://segmentfault.com/a/1190000003880571
如下為rdb測(cè)試的配置文件:執(zhí)行:fio 256k-randread.fio
[root@host111 fio_cfg]# vi 256k-randread.fio
[randread-256k]
description="randread test with block size of 256k-test-poolimages1"
ioengine=rbd
clientname=admin
pool=test-pool
rbdname=test-poolimages1
iodepth=8
runtime=300
rw=randread
bs=256k
numjobs=1
size=5g
#write_iops_log=write_iops
#log_avg_msec=1000
#filename=/data/osd.0/1.txt
write_bw_log=rw
write_lat_log=rw
write_iops_log=rw

[randread-256k]
description="randread test with block size of 256k-test-poolimages2"
ioengine=rbd
clientname=admin
pool=test-pool
rbdname=test-poolimages2
iodepth=8
runtime=300
rw=randread
bs=256k
numjobs=1
size=5g
#write_iops_log=write_iops
#log_avg_msec=1000
#filename=/data/osd.0/1.txt
write_bw_log=rw
write_lat_log=rw
write_iops_log=rw
四、補(bǔ)充
1、安裝插件:
yum install gnuplot

2.輸出bw,lat和iops數(shù)據(jù)并畫圖
fio安裝完后自帶有一個(gè)高級(jí)腳本fio_generate_plots能夠根據(jù)fio輸出的數(shù)據(jù)進(jìn)行畫圖。操作流程如下:
fio的輸出日志主要包含三種:bw,lat和iops,設(shè)置這三種的參數(shù)如下:
write_bw_log=rw
w
write_lat_log=rw
w
write_iops_log=rw


如:fio -filename=/mnt/data/112.log -direct=1 -iodepth 1 -thread -rw=randread -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=10 -group_reporting -name=file -write_bw_log=rww -write_lat_log=rww -write_iops_log=rw
最后生成:
[root@host111 fio_cfg]# ls
psync randrw.fio read.fio rw_iops.1.log rww_clat.1.log rww_slat.1.log
randread.fio randwrite.fio rw.fio rww_bw.1.log rww_lat.1.log write.fio
需要將$1.log改為*.log
[root@host111 fio_cfg]# mv rw_iops.1.log rw_iops.log
[root@host111 fio_cfg]# mv rww_bw.1.log rww_bw.log
[root@host111 fio_cfg]# mv rww_clat.1.log rww_clat.log
[root@host111 fio_cfg]# mv rww_lat.1.log rww_lat.log
[root@host111 fio_cfg]# mv rww_slat.1.log rww_slat.log
[root@host111 fio_cfg]# ls
psync randrw.fio read.fio rw_iops.log rww_clat.log rww_slat.log
randread.fio randwrite.fio rw.fio rww_bw.log rww_lat.log write.fio

或者使用下面腳本進(jìn)行修改:
這里需要強(qiáng)調(diào)的一點(diǎn)是,后面接的參數(shù)rw,是輸出日志文件名的prefix,如最終會(huì)生成的日志文件如下:
rw_iops.log

rw_clat.log

rw_slat.log

rw_lat.log

rw_bw.log


這個(gè)參數(shù)在后面畫圖的時(shí)候也要用到。
for i in clat lat slat bw iops;do mv rbd_$i.1.log rbd_$i.log;done

3、畫圖
前提是還需要安裝好gnuplot,然后使用下面的命令即可自動(dòng)畫圖:
root@ubuntu:/tmp> fio_generate_plots bw


發(fā)現(xiàn)沒有,fio_generate_plots接受的唯一參數(shù)就是這個(gè)日志文件名的prefix。
本例中生成的圖片文件有:
bw-bw.svg?
bw-clat.svg?
bw-iops.svg?
bw-lat.svg?
bw-slat.svg

下載到本地,需要用谷歌瀏覽器才能打開,圖片軟件打不開

轉(zhuǎn)載于:https://www.cnblogs.com/AgainstTheWind/p/9869643.html

總結(jié)

以上是生活随笔為你收集整理的fio的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。