磁盘测试工具fio

https://wiki.mikejung.biz/Benchmarking

#blocksize
This options determines the block size for the I/O units used during the test. The default value for blocksize is 4k (4KB).
--blocksize=4k

#ioengine
By default, Fio will run tests using the sync io engine, but if you want to change the engine used, you can. There are many different options you could change this value to, but on Linux the most common options are sync or libaio if the kernel supports it.
--ioengine=sync (default)

#iodepth
The iodepth option defines the amount of IO units that will continue to hammer a file with requests during the test. If you are using the default sync ioengine, then increasing the iodepth beyond the default value of 1 will not have an effect. 
--iodepth=1 (default)

#direct
This option tells Fio whether or not it should use direct IO, or buffered IO. The default value is "0" which means that Fio will use use buffered I/O for the test. If you set this value to 1 then Fio will avoid using buffered IO, usually this is similar to O_DIRECT. 
--direct=0 (default)

#fsync
The fsync option tells Fio how often it should use fsync to flush "dirty data" to disk. By default this value is set to 0 which means "don't sync". Many applications perform like this and leave it up to Linux to figure out when to flush data from memory to disk. If your application or server always flushes every write to disk (meta-data and data) then you should include this option and set it to a 1.
--fsync=0 (default)
#Random Write
fio --name=randwrite --ioengine=libaio --iodepth=1 --rw=randwrite --bs=4k --direct=0 --size=512M --numjobs=8 --runtime=240 --group_reporting

#Random Read
fio --name=randread --ioengine=libaio --iodepth=16 --rw=randread --bs=4k --direct=0 --size=512M --numjobs=8 --runtime=240 --group_reporting

#Fio Random Write Test using libaio and direct flags
fio --name=randwrite --ioengine=libaio --iodepth=16 --rw=randwrite --bs=4k --direct=1 --size=1G --numjobs=8 --runtime=240 --group_reporting

#Fio Random Read Test using libaio and direct flags
fio --name=randread --ioengine=libaio --iodepth=16 --rw=randread --bs=4k --direct=1 --size=1G --numjobs=8 --runtime=240 --group_reporting
#Google Compute SSD FIO Script
# Change this variable to the path of the device you want to test
block_dev=/$mount/$point

# install dependencies
sudo apt-get -y update
sudo apt-get install -y fio

# full write pass
sudo fio --name=writefile --size=10G --filesize=10G 
--filename=$block_dev --bs=1M --nrfiles=1 
--direct=1 --sync=0 --randrepeat=0 --rw=write --refill_buffers --end_fsync=1 
--iodepth=200 --ioengine=libaio

# rand read
sudo fio --time_based --name=benchmark --size=10G --runtime=30 
--filename=$block_dev --ioengine=libaio --randrepeat=0 
--iodepth=128 --direct=1 --invalidate=1 --verify=0 --verify_fatal=0 
--numjobs=4 --rw=randread --blocksize=4k --group_reporting

# rand write
sudo fio --time_based --name=benchmark --size=10G --runtime=30 
--filename=$block_dev --ioengine=libaio --randrepeat=0 
--iodepth=128 --direct=1 --invalidate=1 --verify=0 --verify_fatal=0 
--numjobs=4 --rw=randwrite --blocksize=4k --group_reporting
#AWS EBS FIO Tests
#The following command performs 16 KB random write operations
fio --name fio_test_file --direct=1 --rw=randwrite --bs=4k --size=1G --numjobs=16 --time_based --runtime=180 --group_reporting

#The following command performs 16 KB random read operations
fio --name fio_test_file --direct=1 --rw=randread --bs=4k --size=1G --numjobs=16 --time_based --runtime=180 --group_reporting
原文地址:https://www.cnblogs.com/liujitao79/p/5542639.html