sysbench除了测试mysql,还可以测试很多东西。
比如:cpu。
cpu-max-prime:素数生成数量的上限。
[root@localhost ~]# sysbench --test=cpu --cpu-max-prime=20000 --num-threads=4 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.17 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Prime numbers limit: 20000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 1702.29
General statistics:
total time: 10.0020s
total number of events: 17029
Latency (ms):
min: 2.17
avg: 2.35
max: 4.37
95th percentile: 2.71
sum: 39991.72
Threads fairness:
events (avg/stddev): 4257.2500/14.43
execution time (avg/stddev): 9.9979/0.00
测试io。
准备2g的数据。
sysbench --test=fileio --file-total-size=2G prepare
--file-test-mode 还可以为
seqwr:顺序写入
seqrewq:顺序重写
seqrd:顺序读取
rndrd:随机读取
rndwr:随机写入
rndrw:混合随机读写
测试随机读。
Throughput: 吞吐量
read, MiB/s: 185.54 每秒184m
[root@localhost ~]# sysbench --test=fileio --file-total-size=2G --file-test-mode=rndrd run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.17 (using bundled LuaJIT 2.1.0-beta2)
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!
File operations:
reads/s: 11874.33
writes/s: 0.00
fsyncs/s: 0.00
Throughput:
read, MiB/s: 185.54
written, MiB/s: 0.00
General statistics:
total time: 10.0152s
total number of events: 118947
Latency (ms):
min: 0.00
avg: 0.08
max: 6.89
95th percentile: 0.27
sum: 9903.09
Threads fairness:
events (avg/stddev): 118947.0000/0.00
execution time (avg/stddev): 9.9031/0.00
测试顺序读。
可以看到,顺序读的性能几乎是随机读的10倍。
Throughput:
read, MiB/s: 1651.26 每秒1651m
[root@localhost ~]# sysbench --test=fileio --file-total-size=2G --file-test-mode=seqrd run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.17 (using bundled LuaJIT 2.1.0-beta2)
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 read test
Initializing worker threads...
Threads started!
File operations:
reads/s: 105680.73
writes/s: 0.00
fsyncs/s: 0.00
Throughput:
read, MiB/s: 1651.26
written, MiB/s: 0.00
General statistics:
total time: 10.0014s
total number of events: 1057359
Latency (ms):
min: 0.00
avg: 0.01
max: 8.54
95th percentile: 0.00
sum: 9660.95
Threads fairness:
events (avg/stddev): 1057359.0000/0.00
execution time (avg/stddev): 9.6609/0.00
网友评论