2. CPU性能测试
Sysbench采用寻找最大素数的方式测试CPU性能:
|
[root@RedHat ~]# sysbench --test=cpu help sysbench v0.4.8: multi-threaded system evaluation benchmark
cpu options: --cpu-max-prime=N upper limit for primes generator [10000]
[root@RedHat ~]# |
参数解析
|
参数名 |
描述 |
|
--cpu-max-prime=N |
素数的最大限制,默认为10000; |
测试案例
|
[root@RedHat ~]# sysbench --test=cpu --cpu-max-prime=20000 run sysbench v0.4.8: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Doing CPU performance benchmark Threads started! Done. Maximum prime number checked in CPU test: 20000 Test execution summary: total time: 124.1761s total number of events: 10000 total time taken by event execution: 123.3658 per-request statistics: min: 0.0051s avg: 0.0123s max: 0.1908s approx. 95 percentile: 0.0171s
Threads fairness: events (avg/stddev): 10000.0000/0.00 execution time (avg/stddev): 123.3658/0.00 [root@RedHat ~]# |
3.内存性能测试
|
[root@RedHat ~]# sysbench --test=memory help sysbench v0.4.8: multi-threaded system evaluation benchmark
memory options: --memory-block-size=SIZE size of memory block for test [1K] --memory-total-size=SIZE total size of data to transfer [100G] --memory-scope=STRING memory access scope {global,local} [global] --memory-hugetlb=[on|off] allocate memory from HugeTLB pool [off] --memory-oper=STRING type of memory operations {read, write, none} [write] --memory-access-mode=STRING memory access mode {seq,rnd} [seq]
[root@RedHat ~]# |
|
参数名 |
描述 |
|
--memory-block-size=SIZE |
内存块大小,默认为1K |
|
--memory-total-size=SIZE |
传输的数据量,默认为100G |
|
--memory-scope=STRING |
内存访问是局部local还是全局global,默认为global |
|
--memory-hugetlb=[on|off] |
从hugetlb中分配内存 |
|
--memory-oper=STRING |
内存操作类型read, write, none,默认为写 |
|
--memory-access-mode=STRING |
内存访问模式seq,rnd,默认为seq; |
|
[root@RedHat test]# sysbench --test=memory --memory-block-size=4k --memory-total-size=64M run |
4.线程性能测试
|
[root@RedHat ~]# sysbench --test=threads help sysbench v0.4.8: multi-threaded system evaluation benchmark
threads options: --thread-yields=N number of yields to do per request [1000] --thread-locks=N number of locks per thread [8]
[root@RedHat ~]# |
|
参数名 |
描述 |
|
--thread-yields=N |
内存块大小,默认为1K |
|
--thread-locks=N |
传输的数据量,默认为100G |
测试案例
|
[root@RedHat test]# sysbench --test=threads --num-threads=64 --thread-yields=100 --thread-locks=2 run sysbench v0.4.8: multi-threaded system evaluation benchmark
Running the test with following options: Number of threads: 64
Doing thread subsystem performance test Thread yields per test: 100 Locks used: 2 Threads started! Done.
Test execution summary: total time: 24.8159s total number of events: 10000 total time taken by event execution: 1575.5529 per-request statistics: min: 0.0002s avg: 0.1576s max: 2.0173s approx. 95 percentile: 0.5627s
Threads fairness: events (avg/stddev): 156.2500/12.62 execution time (avg/stddev): 24.6180/0.08
[root@RedHat test]# |
5互斥体性能测试
|
[root@RedHat ~]# sysbench --test=mutex help sysbench v0.4.8: multi-threaded system evaluation benchmark
mutex options: --mutex-num=N total size of mutex array [4096] --mutex-locks=N number of mutex locks to do per thread [50000] --mutex-loops=N number of empty loops to do inside mutex lock [10000]
[root@RedHat ~]# |
|
参数名 |
描述 |
|
--mutex-num=N |
互斥体数据大小,默认为4096 |
|
--mutex-locks=N |
每个线程上互斥锁的数目,默认为50000; |
|
--mutex-loops=N |
互斥锁内空循环的数目,默认为10000 |
测试案例
|
[root@RedHat test]# sysbench --test=mutex --num-threads=16 --mutex-num=1024 --mutex-locks=10000 --mutex-loops=5000 run sysbench v0.4.8: multi-threaded system evaluation benchmark
Running the test with following options: Number of threads: 16
Doing mutex performance test Threads started! Done.
Test execution summary: total time: 0.0482s total number of events: 16 total time taken by event execution: 0.2271 per-request statistics: min: 0.0015s avg: 0.0142s max: 0.0312s approx. 95 percentile: 0.0126s
Threads fairness: events (avg/stddev): 1.0000/0.00 execution time (avg/stddev): 0.0142/0.01 [root@RedHat test]# |
6 OLTP测试
不做分析了
