点击"Python测试和开发"关注我

后台回复1024,解锁无限快乐!

安装sysbench

安装命令:

apt install sysbench

我的虚机CPU信息:

root@phyger-xubuntu:/home/phyger# lscpu
架构:           x86_64
CPU 运行模式:32-bit, 64-bit
字节序:         Little Endian
CPU:             1
在线 CPU 列表:0
每个核的线程数: 1
每个座的核数:   1
座:             1
NUMA 节点:1
厂商 ID:AuthenticAMD
CPU 系列:18
型号:           1
型号名称:       AMD A6-3420M APU with Radeon(tm) HD Graphics
步进:           0
CPU MHz:1497.273
BogoMIPS:       2994.54
超管理器厂商:   KVM
虚拟化类型:     完全
L1d 缓存:64K
L1i 缓存:64K
L2 缓存:1024K
NUMA 节点0 CPU: 0

执行测试

执行测试:

测试场景1:默认开启一个线程
sysbench cpu --time=60 run
测试场景2:开启8个线程
sysbench cpu --time=60 --threads=8 run

结果分析:

root@phyger-xubuntu:/home/phyger# sysbench cpu --time=60 run
sysbench 1.0.11 (using system LuaJIT 2.1.0-beta3)


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




Prime numbers limit: 10000


Initializing worker threads...


Threads started!


CPU speed:
    events per second:   155.34


General statistics:
    total time:                          60.0063s
    total number of events:              9322


Latency (ms):
         min:                                  1.90
         avg:                                  6.42
         max:                                 88.96
         95th percentile:                     13.22
         sum:                              59848.38


Threads fairness:
    events (avg/stddev):           9322.0000/0.00
    execution time (avg/stddev):   59.8484/0.00


root@phyger-xubuntu:/home/phyger# sysbench cpu --time=60 --threads=8 run
sysbench 1.0.11 (using system LuaJIT 2.1.0-beta3)


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




Prime numbers limit: 10000


Initializing worker threads...


Threads started!


CPU speed:
    events per second:   150.10


General statistics:
    total time:                          60.0250s
    total number of events:              9010


Latency (ms):
         min:                                  1.88
         avg:                                 53.08
         max:                                701.98
         95th percentile:                    108.68
         sum:                             478274.87


Threads fairness:
    events (avg/stddev):           1126.2500/8.00
    execution time (avg/stddev):   59.7844/0.13

默认一个线程,默认最大质数生成器数为:10000

CPU speed:  155.34

开启八个线程,默认最大质数生成器数为:10000

CPU speed:  150.10

对标业界主流云厂商:

由于测试使用的是virtualbox在老古董笔记本上虚拟的虚拟机,所以性能相差甚远。

往期推荐

用Python制作gif动态图

超实用!【高频Linux命令速查手册】

Python一秒搭建ftp服务器,帮助你在局域网共享文件

点亮在看!

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐