源码安装
安装方法参见: https://github.com/akopytov/sysbench
源码编译的安装步骤如下:
yum -y install make automake libtool pkgconfig libaio-devel openssl-devel
wget https://github.com/akopytov/sysbench/archive/master.zip
unzip master.zip
cd sysbench-master/
./autogen.sh
./configure --without-mysql
make -j
make install
没有安装mysql,所以要用–without-mysql。
fileio 测试
# sysbench fileio help
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)
fileio options:
--file-num=N number of files to create [128]
--file-block-size=N block size to use in all IO operations [16384]
--file-total-size=SIZE total size of files to create [2G]
--file-test-mode=STRING test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw}
--file-io-mode=STRING file operations mode {sync,async,mmap} [sync]
--file-async-backlog=N number of asynchronous operatons to queue per thread [128]
--file-extra-flags=[LIST,...] list of additional flags to use to open files {sync,dsync,direct} []
--file-fsync-freq=N do fsync() after this number of requests (0 - don't use fsync()) [100]
--file-fsync-all[=on|off] do fsync() after each write operation [off]
--file-fsync-end[=on|off] do fsync() at the end of test [on]
--file-fsync-mode=STRING which method to use for synchronization {fsync, fdatasync} [fsync]
--file-merged-requests=N merge at most this number of IO requests if possible (0 - don't merge) [0]
--file-rw-ratio=N reads/writes ratio for combined test [1.5]
# sysbench fileio prepare
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)
128 files, 16384Kb each, 2048Mb total
Creating files for the test...
...
Creating file test_file.127
2147483648 bytes written in 4.26 seconds (481.08 MiB/sec).
飞腾机器测试顺序写大约400M/S:
# sysbench fileio --file-test-mode=seqwr run
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 16MiB each
2GiB total file size
Block size 16KiB
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential write (creation) test
Initializing worker threads...
Threads started!
Throughput:
read: IOPS=0.00 0.00 MiB/s (0.00 MB/s)
write: IOPS=25040.09 391.25 MiB/s (410.26 MB/s)
fsync: IOPS=32061.56
Latency (ms):
min: 0.00
avg: 0.02
max: 55.21
95th percentile: 0.05
sum: 9695.04
[root@localhost infokist]#
这是一个由11个sata盘组成的RAID 6的磁盘整列。
# sysbench fileio --file-test-mode=rndrd run
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 16MiB each
2GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random read test
Initializing worker threads...
Threads started!
Throughput:
read: IOPS=19340.10 302.19 MiB/s (316.87 MB/s)
write: IOPS=0.00 0.00 MiB/s (0.00 MB/s)
fsync: IOPS=0.00
Latency (ms):
min: 0.01
avg: 0.05
max: 0.25
95th percentile: 0.07
sum: 9828.43
只读的iops将近2万
测试完成要删除用于测试的文件
# sysbench fileio cleanup
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)
Removing test files...
其他测试
# sysbench threads run
# sysbench memory run
# sysbench cpu run
# sysbench mutex run