1、查看CPU个数和线程数
我是在1个物理CPU,4线程的虚拟机上做的测试
2、下面分别使用线程数2和4在虚拟机和PC服务器上做的测试
虚拟机线程数2
PC服务器线程数2
虚拟机线程数4
PC服务器线程数4
很明显在最大相应时间上差别是比较大的,在测试CPU的时候,需要关注的total time和response time,这里只是做一个比较而已,其实意义不大。
- root@pm1:/root# grep "physical id" /proc/cpuinfo
- physical id : 0
- physical id : 0
- physical id : 0
- physical id : 0
- root@pm1:/root# grep "processor" /proc/cpuinfo
- processor : 0
- processor : 1
- processor : 2
- processor : 3
2、下面分别使用线程数2和4在虚拟机和PC服务器上做的测试
虚拟机线程数2
- root@pm1:/root# sysbench --test=cpu --num-threads=2 --cpu-max-prime=50000 run
- sysbench 0.5: multi-threaded system evaluation benchmark
-
- Running the test with following options:
- Number of threads: 2
- Random number generator seed is 0 and will be ignored
-
-
- Primer numbers limit: 50000
-
- Threads
-
-
- General statistics:
- total time: 55.5011s
- total number of events: 10000
- total time taken by event execution: 110.8806s
- response time:
- min: 8.79ms
- avg: 11.09ms
- max: 58.89ms
- approx. 95 percentile: 13.64ms
-
- Threads fairness:
- events (avg/stddev): 5000.0000/2.00
- execution time (avg/stddev): 55.4403/0.00
- [root@ ~]# sysbench --test=cpu --num-threads=2 --cpu-max-prime=50000 run
- sysbench 0.5: multi-threaded system evaluation benchmark
-
- Running the test with following options:
- Number of threads: 2
- Random number generator seed is 0 and will be ignored
-
-
- Primer numbers limit: 50000
-
- Threads
-
-
- General statistics:
- total time: 46.5507s
- total number of events: 10000
- total time taken by event execution: 93.0934s
- response time:
- min: 9.24ms
- avg: 9.31ms
- max: 13.10ms
- approx. 95 percentile: 9.46ms
-
- Threads fairness:
- events (avg/stddev): 5000.0000/13.00
- execution time (avg/stddev): 46.5467/0.00
- root@pm1:/root# sysbench --test=cpu --num-threads=4 --cpu-max-prime=50000 run
- sysbench 0.5: multi-threaded system evaluation benchmark
-
- Running the test with following options:
- Number of threads: 4
- Random number generator seed is 0 and will be ignored
-
-
- Primer numbers limit: 50000
-
- Threads
-
-
- General statistics:
- total time: 36.6124s
- total number of events: 10000
- total time taken by event execution: 146.2491s
- response time:
- min: 9.57ms
- avg: 14.62ms
- max: 126.70ms
- approx. 95 percentile: 17.99ms
-
- Threads fairness:
- events (avg/stddev): 2500.0000/18.81
- execution time (avg/stddev): 36.5623/0.02
- [root@ ~]# sysbench --test=cpu --num-threads=4 --cpu-max-prime=50000 run
- sysbench 0.5: multi-threaded system evaluation benchmark
-
- Running the test with following options:
- Number of threads: 4
- Random number generator seed is 0 and will be ignored
-
-
- Primer numbers limit: 50000
-
- Threads
-
-
- General statistics:
- total time: 23.2432s
- total number of events: 10000
- total time taken by event execution: 92.9494s
- response time:
- min: 9.24ms
- avg: 9.29ms
- max: 13.87ms
- approx. 95 percentile: 9.46ms
-
- Threads fairness:
- events (avg/stddev): 2500.0000/12.51
- execution time (avg/stddev): 23.2374/0.00
很明显在最大相应时间上差别是比较大的,在测试CPU的时候,需要关注的total time和response time,这里只是做一个比较而已,其实意义不大。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12219480/viewspace-1742487/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12219480/viewspace-1742487/