JavaScript must be enabled in order for you to see "WP Copy Data Protect" effect. However, it seems JavaScript is either disabled or not supported by your browser. To see full result of "WP Copy Data Protector", enable JavaScript by changing your browser options, then try again.

在RHEL 6.x上Execute關於CPU、Memory與Disk的SysBench壓力測試


最近剛好在ITHome看到新一代主流2路伺服器規格評比文章,裡面有提到SysBench這支壓力測試的工具,身為一個專業ㄚ宅測試員,怎麼可能會被人家問倒,因此趕緊來惡補一下,這邊有Gentoo對於SysBench的Wiki可以Ref,那實際操作勒,看下去就瞭囉,如下:
1) Install the relative packages(這邊是從Fedora的Mirror下載的,Hinet有SRC的套件)
#wget https://dl.fedoraproject.org/pub/epel/6/x86_64/sysbench-0.4.12-5.el6.x86_64.rpm
#wget ftp://mirror01.idc.hinet.net/epel/6Server/SRPMS/sysbench-0.4.12-5.el6.src.rpm
#rpm -ivh sysbench-0.4.12-5.el6.x86_64.rpm

2) Review the usage about the sysbench(可參考下列說明來下Parameter)
#sysbench -h
Usage:
sysbench [general-options]... --test= [test-options]... command
General options:
--num-threads=N number of threads to use [1]
--max-requests=N limit for total number of requests [10000]
--max-time=N limit for total execution time in seconds [0]
--forced-shutdown=STRING amount of time to wait after --max-time before forcing shutdown [off]
--thread-stack-size=SIZE size of stack per thread [32K]
--init-rng=[on|off] initialize random number generator [off]
--test=STRING test to run
--debug=[on|off] print more debugging info [off]
--validate=[on|off] perform validation checks where possible [off]
--help=[on|off] print help and exit
--version=[on|off] print version and exit
Compiled-in tests:
fileio - File I/O test
cpu - CPU performance test
memory - Memory functions speed test
threads - Threads subsystem performance test
mutex - Mutex performance test
oltp - OLTP test
Commands: prepare run cleanup help version
See 'sysbench --test= help' for a list of options for each test.

3) Benchmark the part of CPU(關於cpu-max-prime可設成20000/25000)
#cat /proc/cpuinfo | grep -i mhz | wc -l -> Gather the Num about cores
#sysbench --test=cpu --cpu-max-prime=2000 --num-threads=48 run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 48
Doing CPU performance benchmark
Threads started!
Done.
Maximum prime number checked in CPU test: 200
Test execution summary:
total time: 0.0128s
total number of events: 10001
total time taken by event execution: 0.4540
per-request statistics:
min: 0.01ms
avg: 0.05ms
max: 3.31ms
approx. 95 percentile: 0.01ms
Threads fairness:
events (avg/stddev): 208.3542/63.46
execution time (avg/stddev): 0.0095/0.00

4) Benchmark the part of Memory(可自行調整Block Size與Total Size)
#sysbench --test=memory --memory-block-size=8K --memory-total-size=1G --memory-oper=read run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 1
Doing memory operations speed test
Memory block size: 8K
Memory transfer size: 1024M
Memory operations type: read
Memory scope type: global
Threads started!
Done.
Operations performed: 131072 (2638669.56 ops/sec)
1024.00 MB transferred (20614.61 MB/sec)
Test execution summary:
total time: 0.0497s
total number of events: 131072
total time taken by event execution: 0.0364
per-request statistics:
min: 0.00ms
avg: 0.00ms
max: 0.05ms
approx. 95 percentile: 0.00ms
Threads fairness:
events (avg/stddev): 131072.0000/0.00
execution time (avg/stddev): 0.0364/0.00
#sysbench --test=memory --memory-block-size=8K --memory-total-size=1G run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 1
Doing memory operations speed test
Memory block size: 8K
Memory transfer size: 1024M
Memory operations type: write
Memory scope type: global
Threads started!
Done.
Operations performed: 131072 (811694.84 ops/sec)
1024.00 MB transferred (6341.37 MB/sec)
Test execution summary:
total time: 0.1615s
total number of events: 131072
total time taken by event execution: 0.1502
per-request statistics:
min: 0.00ms
avg: 0.00ms
max: 0.06ms
approx. 95 percentile: 0.00ms
Threads fairness:
events (avg/stddev): 131072.0000/0.00
execution time (avg/stddev): 0.1502/0.00

5) Benchmark the part of FileIO(可自行調整Threads與Total Size)
#sysbench --test=fileio --num-threads=48 --file-total-size=1G --file-test-mode=rndrw prepare
sysbench 0.4.12: multi-threaded system evaluation benchmark
128 files, 8192Kb each, 1024Mb total
Creating files for the test...
#sysbench --test=fileio --num-threads=48 --file-total-size=1G --file-test-mode=rndrw run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 48
Extra file open flags: 0
128 files, 8Mb each
1Gb total file size
Block size 16Kb
Number of random requests for random IO: 10000
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
Threads started!
Done.
Operations performed: 6053 Read, 4061 Write, 12867 Other = 22981 Total
Read 94.578Mb Written 63.453Mb Total transferred 158.03Mb (10.054Mb/sec)
643.44 Requests/sec executed
Test execution summary:
total time: 15.7187s
total number of events: 10114
total time taken by event execution: 68.5810
per-request statistics:
min: 0.01ms
avg: 6.78ms
max: 225.91ms
approx. 95 percentile: 50.57ms
Threads fairness:
events (avg/stddev): 210.7083/26.45
execution time (avg/stddev): 1.4288/0.31
#sysbench --test=fileio --num-threads=48 --file-total-size=1G --file-test-mode=rndrw cleanup
sysbench 0.4.12: multi-threaded system evaluation benchmark
Removing test files...

◎、以上就是在RHEL 6.x上Execute SysBench壓力測試的簡介,且使用Example的部分均參考Ssorc大大的文章,除此之外,這個工具還可以測MySQL的Performance,如果看倌們有興趣,可以自行玩味玩味一番,先到這,收工囉!

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
This site is protected by WP-CopyRightPro