性能测试sysbench之cpu性能测试

1.sysbench安装:

     yum install sysbench

2.测试cpu的性能指标

  •  第一次:sysbench cpu run 表示使用一个thread执行一次cpu性能测试;测试结果如下:

sysbench 1.0.17 (using system LuaJIT 2.0.4)  //sysbench的版本

Running the test with following options:
Number of threads: 1   //使用单个线程处理
Initializing random number generator from current time
Prime numbers limit: 10000 //最多产生1000个素数

Initializing worker threads...

Threads started!

CPU speed:
    events per second:   711.74   //每秒可以处理711事件

General statistics:
    total time:                          10.0013s   //总共花费的时间(秒)
    total number of events:              7120   //共生产的事件数

Latency (ms):
         min:                                    1.36     //每个事件最小处理时间(毫秒)
         avg:                                    1.40     //平均每个事件的处理时间
         max:                                    3.38    //最大处理时间
         95th percentile:                        1.55   //95%的事件的处理时间
         sum:                                 9988.65    //总共的处理时间 

Threads fairness:
    events (avg/stddev):           7120.0000/0.00  //每个线程处理的总事件;标准方差(单线程无意义)
    execution time (avg/stddev):   9.9887/0.00  //每个线程处理的总时间,标准方差(单线程无意义)

  • 第二次:sysbench --threads=2 cpu run  使用两个线程测试cpu

sysbench 1.0.17 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 2 //两个线程
Initializing random number generator from current time


Prime numbers limit: 10000

Initializing worker threads...

Threads started!

CPU speed:
    events per second:  1399.61  //每秒处理1399.61个事件

General statistics:
    total time:                          10.0011s  //一共执行了10秒
    total number of events:              14001   //共产生14001个事件

Latency (ms):
         min:                                    1.28         //事件执行的最小时间(毫秒)
         avg:                                    1.43         //平均执行时间
         max:                                    4.16        //最大执行时间
         95th percentile:                        1.64   //95%事件均在1.64毫秒内完成
         sum:                                19975.20

Threads fairness:
    events (avg/stddev):           7000.5000/12.50  //两个线程的标准方差为12.50,该值越小,说明越稳定
    execution time (avg/stddev):   9.9876/0.00     //每个线程平均执行总时间

通过第1次与第2次的结果来看,增加一个线程基本可以多一倍的处理能力;我们继续增加线程

  • 第三次,执行sysbench --threads=3 cpu run

sysbench 1.0.17 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 3
Initializing random number generator from current time
Prime numbers limit: 10000

Initializing worker threads...

Threads started!

CPU speed:
    events per second:  1217.41

General statistics:
    total time:                          10.0007s
    total number of events:              12178

Latency (ms):
         min:                                    1.56
         avg:                                    2.46
         max:                                   14.25
         95th percentile:                        7.56
         sum:                                29947.76

Threads fairness:
    events (avg/stddev):           4059.3333/385.33
    execution time (avg/stddev):   9.9826/0.00

     通过第2次与第3次的结果相对比,发现多一个线程后每秒完成的事件稍有下降,并没有提升;我们继续增加一个线程进行第4次测试;

 

sysbench 1.0.17 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 4
Initializing random number generator from current time


Prime numbers limit: 10000

Initializing worker threads...

Threads started!

CPU speed:
    events per second:  1391.58

General statistics:
    total time:                          10.0017s
    total number of events:              13921

Latency (ms):
         min:                                    1.34
         avg:                                    2.87
         max:                                   15.37
         95th percentile:                        7.84
         sum:                                39916.69

Threads fairness:
    events (avg/stddev):           3480.2500/52.34
    execution time (avg/stddev):   9.9792/0.01
      4个线程的处理结果与2个3个的线程处理结果基本处于一样的处理结果,并没有明显的提升,因此这时可以基本确定, 本台测试服务器的cpu线程数应该是2个;为了验证是否准确,我们查看一下当前服务器的cpu情况:

      cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l 

通过结果查看,验证了我们通过sysbench的测试结果。

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值