测压工具sysbench

测压工具sysbench

linux下的cpu测压工具sysbench

[root@centos8 ~]#yum info sysbench
Last metadata expiration check: 0:55:37 ago on Mon 07 Feb 2022 01:45:25 PM CST.
Installed Packages
Name         : sysbench
Version      : 1.0.20
Release      : 5.el8
Architecture : x86_64
Size         : 636 k
Source       : sysbench-1.0.20-5.el8.src.rpm
Repository   : @System
From repo    : epel
Summary      : System performance benchmark
URL          : https://github.com/akopytov/sysbench/
License      : GPLv2+
Description  : SysBench is a modular, cross-platform and multi-threaded benchmark
             : tool for evaluating OS parameters that are important for a system
             : running a database under intensive load.
             :
             : The idea of this benchmark suite is to quickly get an impression about
             : system performance without setting up complex database benchmarks or
             : even without installing a database at all. Current features allow to
             : test the following system parameters:
             : - file I/O performance
             : - scheduler performance
             : - memory allocation and transfer speed
             : - POSIX threads implementation performance
             : - database server performance (OLTP benchmark)
             :
             : Primarily written for MySQL server benchmarking, SysBench will be
             : further extended to support multiple database backends, distributed
             : benchmarks and third-party plug-in modules.

SysBench是一个模块化、跨平台、多线程的基准测试工具,用于评估对系统很重要的操作系统参数的工具,在高负荷下运行数据库。
:这个基准测试套件的想法是快速获得一个印象,系统性能无需设置复杂的数据库基准或,甚至不需要安装数据库。
当前特性允许
:测试以下系统参数:
:—文件I/O性能
: -调度器性能
:—内存分配和传输速度
:—POSIX线程实现性能
: -数据库服务器性能(OLTP基准)
: SysBench主要是为MySQL服务器做基准测试而编写的
:进一步扩展,以支持多个数据库后端,分布式
:基准和第三方插件模块。

安装

[root@centos8 ~]#yum install -y sysbench

参数说明

--cpu-max-prime 素数生成数量得上限
默认值为10000
--threads=N 要使用的线程数
设置为1,则sysbench仅启动1个线程进行素数计算;设置为2,同时启动2个线程进行计算
默认值为1
--events=N 事件总数限制 一轮运算为一个event
若设置为100,则表示当完成100次event后,即使时间过剩,也停止运行
默认值为0,则表示不限event次数
相同event次数,比较的是谁用时更少
--time=N 以秒为单位的总执行实践限制
若设置为5,则sysbench会在5秒内循环往复进行素数计算,
从输出结果可以看到在5s内完成了几次
配合--cpu-max-prime=3,表示第一轮算得3个素数
若时间还有剩就再进行一轮素数计算,直到时间耗尽
每完成一轮就叫一个event
默认值为10
相同时间,比较得是谁完成得event多
 
--forced-shutdown=STRING 在--time限制之后限制关闭之前等待的秒数,off禁用

测试结果说明

#素数上限10000,时间10s,16个线程
[root@centos8 ~]#sysbench cpu --threads=16 run

sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 16 #指定线程数
Initializing random number generator from current time


Prime numbers limit: 10000 #每个线程产生的素数上限均为10000个

Initializing worker threads...

Threads started!

CPU speed:
    events per second: 19121.24 #所有线程每秒完成了19121.24次event

General statistics:
    total time:                          10.0015s #共耗时10秒
    total number of events:              191269 #10秒内所有线程一共完成了191269次event

Latency (ms):
         min:                                    0.69 #完成1次event的最小耗时0.69毫秒
         avg:                                    0.84 #完成所有event的平均耗时0.84毫秒
         max:                                   35.40 #完成1次event的最多耗时35.40毫秒
         95th percentile:                        0.97 #95%次event在0.97毫秒内完成
         sum:                               159890.04 #每个线程耗时10秒,16个线程叠加耗时就是159890.04毫秒

Threads fairness:
    events (avg/stddev):           11954.3125/148.28 #平均每个线程完成11954次event,标准差为2
    execution time (avg/stddev):   9.9931/0.00 #每个线程平均耗时9秒,标准差为2
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值