yum install -y wget
wget --no-check-certificate https://github.com/teddysun/across/raw/master/unixbench.sh
chmod +x unixbench.sh
./unixbench.sh
115.231.102.80:
Double-Precision Whetstone 17086.1 MWIPS (10.0 s, 7 samples)
Execl Throughput 14392.7 lps (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 476888.5 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 136850.5 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 983756.4 KBps (30.0 s, 2 samples)
Pipe Throughput 6399569.2 lps (10.0 s, 7 samples)
Pipe-based Context Switching 1416599.5 lps (10.0 s, 7 samples)
Process Creation 30040.1 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 14900.7 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 2484.1 lpm (60.1 s, 2 samples)
System Call Overhead 2247922.5 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 152391926.4 13058.4
Double-Precision Whetstone 55.0 17086.1 3106.6
Execl Throughput 43.0 14392.7 3347.1
File Copy 1024 bufsize 2000 maxblocks 3960.0 476888.5 1204.3
File Copy 256 bufsize 500 maxblocks 1655.0 136850.5 826.9
File Copy 4096 bufsize 8000 maxblocks 5800.0 983756.4 1696.1
Pipe Throughput 12440.0 6399569.2 5144.3
Pipe-based Context Switching 4000.0 1416599.5 3541.5
Process Creation 126.0 30040.1 2384.1
Shell Scripts (1 concurrent) 42.4 14900.7 3514.3
Shell Scripts (8 concurrent) 6.0 2484.1 4140.2
System Call Overhead 15000.0 2247922.5 1498.6
========
System Benchmarks Index Score 2784.5
======= Script description and score comparison completed! =======
********
CPU
[root@ecloud log]# sysbench --test=cpu --num-threads=500 --cpu-max-prime=2000 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.6 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 500
Initializing random number generator from current time
Prime numbers limit: 2000
Initializing worker threads...
Threads started!
General statistics:
total time: 10.0111s
total number of events: 279414
Latency (ms):
min: 0.14
avg: 14.11
max: 3849.15
95th percentile: 0.15
sum: 3942001.48
Threads fairness:
events (avg/stddev): 558.8280/159.04
execution time (avg/stddev): 7.8840/1.41
2.sysbench测试工具
[root@hd1_live_video_test12 ~]# sysbench --test=cpu --num-threads=500 --cpu-max-prime=2000 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.6 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 500
Initializing random number generator from current time
Prime numbers limit: 2000
Initializing worker threads...
Threads started!
General statistics:
total time: 10.0298s
total number of events: 146550
Latency (ms):
min: 0.10
avg: 31.56
max: 2434.14
95th percentile: 0.19
sum: 4625765.20
Threads fairness:
events (avg/stddev): 293.1000/20.06
execution time (avg/stddev): 9.2515/0.46
program
[root@ecloud log]# sysbench --test=threads --num-threads=500 --thread-yields=100 --thread-locks=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.6 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 500
Initializing random number generator from current time
Initializing worker threads...
Threads started!
General statistics:
total time: 10.0242s
total number of events: 183556
Latency (ms):
min: 0.03
avg: 27.27
max: 505.66
95th percentile: 121.08
sum: 5005451.78
Threads fairness:
events (avg/stddev): 367.1120/33.10
[root@hd1_live_video_test12 ~]# sysbench --test=threads --num-threads=500 --thread-yields=100 --thread-locks=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.6 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 500
Initializing random number generator from current time
Initializing worker threads...
Threads started!
General statistics:
total time: 10.0351s
total number of events: 180507
Latency (ms):
min: 0.00
avg: 27.74
max: 717.29
95th percentile: 106.75
sum: 5006797.73
Threads fairness:
events (avg/stddev): 361.0140/18.77
execution time (avg/stddev): 10.0136/0.01
测试磁盘IO:
准备测试文件:
sysbench --test=fileio --num-threads=16 --file-total-size=2G --file-test-mode=rndrw prepare
[root@ecloud ~]# sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw 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.6 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 20
Initializing random number generator from current time
Extra file open flags: 0
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 r/w test
Initializing worker threads...
Threads started!
File operations:
reads/s: 4372.96
writes/s: 2915.30
fsyncs/s: 9322.08
Throughput:
read, MiB/s: 68.33
written, MiB/s: 45.55
General statistics:
total time: 10.0004s
total number of events: 166143
Latency (ms):
min: 0.00
avg: 1.20
max: 95.72
95th percentile: 3.43
sum: 199829.97
Threads fairness:
events (avg/stddev): 8307.1500/361.33
execution time (avg/stddev): 9.9915/0.00
[root@hd1_live_video_test12 ~]# sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw 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.6 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 20
Initializing random number generator from current time
Extra file open flags: 0
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 r/w test
Initializing worker threads...
Threads started!
File operations:
reads/s: 1762.77
writes/s: 1175.51
fsyncs/s: 3753.91
Throughput:
read, MiB/s: 27.54
written, MiB/s: 18.37
General statistics:
total time: 10.0039s
total number of events: 66961
Latency (ms):
min: 0.00
avg: 2.99
max: 96.62
95th percentile: 8.28
sum: 199961.64
Threads fairness:
events (avg/stddev): 3348.0500/129.33
execution time (avg/stddev): 9.9981/0.00
3.一键自动化测试脚本bench.sh
总结一下 bench.sh 特点:
1、显示当前测试的各种系统信息;
2、取自世界多处的知名数据中心