Linux服务器常见运维性能测试(3)CPU测试super_pi、sysbench

这篇具有很好参考价值的文章主要介绍了Linux服务器常见运维性能测试(3)CPU测试super_pi、sysbench。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

最近需要测试一批服务器的相关硬件性能,以及在常规环境下的硬件运行稳定情况,需要持续拷机测试稳定性。所以找了一些测试用例。本次测试包括在服务器的高低温下性能记录及压力测试,高低电压下性能记录及压力测试,常规环境下CPU满载稳定运行的功率记录。
这个系列是根据这次测试项目的相关测试总结,关于各种常见性能测试及拷机软件的整理。
本章为系列3,主要介绍
系列往期:
Linux服务器常见运维性能测试(1)综合跑分unixbench、superbench
Linux服务器常见运维性能测试(2)内存测试mbw、stream

常见性能测试软件

综合测试:UnixBench(综合跑分),superbench(快速脚本)
内存测试:mbw(内存带宽测试),stream(读写响应测试)
CPU测试:super_pi(计算圆周率)、sysbench(CPU功能测试部分)
网络测试:netperf
IO测试:FIO、iometer
辅助监测:sensors、top、

CPU测试:super_pi (计算圆周率)

super_pi(π)一般用于进行压力测试,但同时也可以通过计算π所用时间评估CPU算力,参考CPU性能。其常用于硬件发烧友中对超频后的CPU进行压力测试,因其只用到基础的浮点运算,而不涉及其他的系统库环境,所以,很适合用于排查CPU物理问题。当系统出现不明原因的死机、缓慢、自动重启等故障,我们可用其协助分析是否CPU不稳定导致的。
官方下载地址:https://superpi.ilbello.com/
解压后直接运行即可

tar -jxvf super_pi.tar.bz2
./super_pi 20  #20为测试计算到小数点后的位数

linux cpu跑分,运维管理,服务器,运维,linux

该程序在 SMP 环境中,只能让 CPU 满载运行,所以,对于多 CPU 的环境,可同时用多个程序并发运行。super_pi同样也可以用于拷机测试稳定性,在运行期间CPU满载运行,可以持续关注设备运行稳定性和温度情况。
补充说明※
1、命令运行中使用的参数m,是指位数,表示要算2的多少次方位,如通常要算小数点后1M位(2^20次方);
2、m最大到25次方,若设置再大的值,会自动缩小到该值
例子:

Specified M(=30) is too large.  M is set to 25.
Start of PI calculation up to 33554432 decimal digits

3、因算法不同,该程序不能用于和Windows平台上的Super PI进行性能对比(实际上,快很多)


CPU测试:sysbench(CPU功能测试部分)

sysbench是一个模块化的、跨平台、多线程基准测试工具,主要用于评估测试各种不同系统参数下的数据库负载情况。其可以作为综合性能测试工具,它主要包括以下几种方式的测试:磁盘io性能、数据库性能、内存分配及传输速度等。
它主要包括以下几种方式的测试:
CPU运算性能
file I/O performance (磁盘IO性能)
scheduler performance (调度程序性能)
memory allocation and transfer speed (内存分配及传输速度)
POSIX threads implementation performance (POSIX线程性能)
database server performance (OLTP benchmark) (数据库服务器性能,OLTP基准测试)
sysbench作为综合性能测试工具有很多可以测试使用的功能,我们这次测试主要用其测试CPU性能。

下载安装

下载地址: https://github.com/akopytov/sysbench/archive/1.0.zip
解压安装: 解压得到sysbench-1.0文件夹,进入文件夹执行安装程序

./autogen.sh
如果报错:automake 1.10.x (aclocal) wasn't found, exiting   需要补充安装依赖包
#   安装依赖包   
yum install automake libtool -y
./configure --without-mysql  #由于我们使用sysbench只做CPU测试,不压mysql,所以放弃依赖mysql
make  #最后执行汇编安装
make install  #安装完毕

查看版本安装成功
linux cpu跑分,运维管理,服务器,运维,linux

sysbench综合测试功能

查看帮助文档

sysbench --help
Usage:
  sysbench [options]... [testname] [command]
 
Commands implemented by most tests: prepare run cleanup help
 
General options:
  --threads=N                     number of threads to use [1],创建测试线程的数目。默认为1.
  --events=N                      limit for total number of events [0],请求的最大数目,0代表不限制。
  --time=N                        limit for total execution time in seconds [10],最大执行时间,单位是s。默认是10s
  --forced-shutdown=STRING        number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off],超过max-time强制中断。默认是off。
  --thread-stack-size=SIZE        size of stack per thread [64K],每个线程的堆栈大小。默认是64K。
  --rate=N                        average transactions rate. 0 for unlimited rate [0]
  --report-interval=N             periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0],指定每多少秒在屏幕上输出一次结果
  --report-checkpoints=[LIST,...] dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. []
  --debug[=on|off]                print more debugging info [off],是否显示更多的调试信息。默认是off。
  --validate[=on|off]             perform validation checks where possible [off],#在可能情况下执行验证检查。默认是off。
  --help[=on|off]                 print help and exit [off],#帮助信息
  --version[=on|off]              print version and exit [off],#版本信息
  --config-file=FILENAME          File containing command line options
  --tx-rate=N                     deprecated alias for --rate [0]
  --max-requests=N                deprecated alias for --events [0]
  --max-time=N                    deprecated alias for --time [0]
  --num-threads=N                 deprecated alias for --threads [1]
 
Pseudo-Random Numbers Generator options:
  --rand-type=STRING random numbers distribution {uniform,gaussian,special,pareto} [special]
  --rand-spec-iter=N number of iterations used for numbers generation [12]
  --rand-spec-pct=N  percentage of values to be treated as 'special' (for special distribution) [1]
  --rand-spec-res=N  percentage of 'special' values to use (for special distribution) [75]
  --rand-seed=N      seed for random number generator. When 0, the current time is used as a RNG seed. [0]
  --rand-pareto-h=N  parameter h for pareto distribution [0.2]
 
Log options:
  --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3],日志级别,默认为3,5=debug,0=只包含重要信息
 
  --percentile=N       percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95]
  --histogram[=on|off] print latency histogram in report [off]
 
General database options:
 
  --db-driver=STRING  specifies database driver to use ('help' to get list of available drivers) [mysql]
  --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]
  --db-debug[=on|off] print database-specific debug information [off]
 
 
 
Compiled-in database drivers:
  mysql - MySQL driver
  pgsql - PostgreSQL driver
 
mysql options:
  --mysql-host=[LIST,...]          MySQL server host [localhost]
  --mysql-port=[LIST,...]          MySQL server port [3306]
  --mysql-socket=[LIST,...]        MySQL socket
  --mysql-user=STRING              MySQL user [sbtest]
  --mysql-password=STRING          MySQL password []
  --mysql-db=STRING                MySQL database name [sbtest]
  --mysql-ssl[=on|off]             use SSL connections, if available in the client library [off]
  --mysql-ssl-cipher=STRING        use specific cipher for SSL connections []
  --mysql-compression[=on|off]     use compression, if available in the client library [off]
  --mysql-debug[=on|off]           trace all client library calls [off]
  --mysql-ignore-errors=[LIST,...] list of errors to ignore, or "all" [1213,1020,1205]
  --mysql-dry-run[=on|off]         Dry run, pretend that all MySQL client API calls are successful without executing them [off]
 
pgsql options:
  --pgsql-host=STRING     PostgreSQL server host [localhost]
  --pgsql-port=N          PostgreSQL server port [5432]
  --pgsql-user=STRING     PostgreSQL user [sbtest]
  --pgsql-password=STRING PostgreSQL password []
  --pgsql-db=STRING       PostgreSQL database name [sbtest]
 
Compiled-in tests:#测试项目
  fileio - File I/O test
  cpu - CPU performance test
  memory - Memory functions speed test,#内存
  threads - Threads subsystem performance test,#线程
  mutex - Mutex performance test#互斥性能测试
 
See 'sysbench <testname> help' for a list of options for each test.

测试CPU的帮助文档

#sysbench --test=cpu help
--cpu-max-prime=N  最大质数发生器数量。默认是10000

测试IO的帮助文档

# sysbench --test=fileio help
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.17 (using system LuaJIT 2.0.4)
 
fileio options:
  --file-num=N                  number of files to create [128],创建测试文件的数量。默认是128
  --file-block-size=N           block size to use in all IO operations [16384],测试时文件块的大小。默认是16384(16K)
  --file-total-size=SIZE        total size of files to create [2G],测试文件的总大小。默认是2G
  --file-test-mode=STRING       文件测试模式{seqwr(顺序写), seqrewr(顺序读写), seqrd(顺序读), rndrd(随机读), rndwr(随机写), rndrw(随机读写)}                       
  --file-io-mode=STRING         文件操作模式{sync(同步),async(异步),fastmmap(快速map映射),slowmmap(慢map映射)}。默认是sync
  --file-async-backlog=N        number of asynchronous operatons to queue per thread [128]
  --file-extra-flags=[LIST,...] 使用额外的标志来打开文件{sync,dsync,direct} 。默认为空
  --file-fsync-freq=N           执行fsync()的频率。(0 – 不使用fsync())。默认是100
  --file-fsync-all[=on|off]     每执行完一次写操作就执行一次fsync。默认是off
  --file-fsync-end[=on|off]     在测试结束时才执行fsync。默认是on
  --file-fsync-mode=STRING      使用哪种方法进行同步{fsync, fdatasync}。默认是fsync
  --file-merged-requests=N      如果可以,合并最多的IO请求数(0 – 表示不合并)。默认是0
  --file-rw-ratio=N             测试时的读写比例,默认时为1.5,即可3:2。

测试内存的帮助文档

# sysbench --test=memory help
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.17 (using system LuaJIT 2.0.4)
 
memory options:
  --memory-block-size=SIZE  测试时内存块大小。默认是1K
  --memory-total-size=SIZE    传输数据的总大小。默认是100G
  --memory-scope=STRING    内存访问范围{global,local}。默认是global
  --memory-hugetlb=[on|off]  从HugeTLB池内存分配。默认是off
  --memory-oper=STRING     内存操作类型。{read, write, none} 默认是write
  --memory-access-mode=STRING存储器存取方式{seq,rnd} 默认是seq

测试线程的帮助文档

# sysbench threads help
sysbench 1.0.17 (using system LuaJIT 2.0.4)
 
threads options:
  --thread-yields=N number of yields to do per request [1000],每个请求产生多少个线程。默认是1000
  --thread-locks=N  number of locks per thread [8],每个线程的锁的数量。默认是8

sysben基本命令格式

sysbench [general-options]... --test=<test-name> [test-options]... command

General options: #通用选项
--num-threads=N         number of threads to use [1] #创建测试线程的数目。默认为1.
--max-requests=N         limit for total number of requests [10000] #请求的最大数目。默认为10000,0代表不限制。
--max-time=N         limit for total execution time in seconds [0] #最大执行时间,单位是s。默认是0,不限制。
--forced-shutdown=STRING         amount of time to wait after --max-time before forcing shutdown [off] #超过max-time强制中断。默认是off。
--thread-stack-size=SIZE         size of stack per thread [32K] #每个线程的堆栈大小。默认是32K。
--init-rng=[on|off]                 initialize random number generator [off] #在测试开始时是否初始化随机数发生器。默认是off。

--test=STRING         test to run #指定测试类型。
fileio
cpu
memory
threads
mutex

--debug=[on|off]         print more debugging info [off] #是否显示更多的调试信息。默认是off。 --validate=[on|off]         perform validation checks where possible [off] #在可能情况下执行验证检查。默认是off。

--help=[on|off]         print help and exit #帮助信息。 --version=[on|off] print version and exit #版本信息。

--report-interval         --指定每多少秒在屏幕上输出一次结果

--日志选项

--verbosity=N         --日志级别,默认为3,5=debug,0=只包含重要信息

Compiled-in tests: #测试项目

fileio - File I/O test #IO
cpu - CPU performance test #CPU
memory - Memory functions speed test #内存
threads - Threads subsystem performance test #线程
mutex - Mutex performance test #互斥性能测试
oltp - OLTP test # 数据库,事务处理

执行CPU测试

常用参数
–cpu-max-prime: 素数生成数量的上限
–threads: 线程数
–time: 运行时长,单位秒
–events: event上限次数

执行测试:文章来源地址https://www.toymoban.com/news/detail-785747.html

测试场景1:默认开启一个线程
sysbench cpu --time=60 run
[root@localhost ~]# sysbench cpu --time=60 run
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)

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:   836.83			//	CPU速度

General statistics:
    total time:                          60.0004s  //运行时间60s
    total number of events:              50212		//60s内共执行50212次event

Latency (ms):
         min:                                    1.18 	//最小耗时1.18ms
         avg:                                    1.19	//平均耗时1.19ms
         max:                                    2.76	//最大耗时2.76ms
         95th percentile:                        1.21	//95%在1.21ms内完成
         sum:                                59975.10	

Threads fairness:
    events (avg/stddev):           50212.0000/0.00
    execution time (avg/stddev):   59.9751/0.00
测试场景2:开启8个线程
sysbench cpu --time=60 --threads=8 run
[root@localhost ~]# sysbench cpu --time=60 --threads=8 run
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)

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:  3329.87			//CPU速度

General statistics:
    total time:                          60.0012s		//运行时间60s
    total number of events:              199802			//60s内所有线程共执行199802次event

Latency (ms):
         min:                                    1.18	//最小耗时1.18ms
         avg:                                    2.40	//平均耗时2.40ms
         max:                                   67.19	//最大耗时67.19ms
         95th percentile:                       11.24	//95%在11.24ms内完成
         sum:                               479692.58

Threads fairness:
    events (avg/stddev):           24975.2500/87.36
    execution time (avg/stddev):   59.9616/0.01

到了这里,关于Linux服务器常见运维性能测试(3)CPU测试super_pi、sysbench的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 轻量应用服务器性能如何?CPU带宽流量系统盘测评

    轻量应用服务器性能如何?腾讯云轻量应用服务器是一种轻量级搭建小型网站和应用的服务器,相对于其他更高性能配置的服务器CVM,性价比更高。虽然其性能不如高性能云服务器CVM,但对于小型网站和应用来说,能够提供基本的计算和存储资源,可以满足基础的业务需求,

    2024年02月10日
    浏览(41)
  • 腾讯云高性能计算集群CPU服务器处理器说明

    腾讯云高性能计算集群以裸金属云服务器为节点,通过RDMA互联,提供了高带宽和极低延迟的网络服务,能满足大规模高性能计算、人工智能、大数据推荐等应用的并行计算需求,腾讯云服务器网分享腾讯云服务器高性能计算集群CPU处理器说明: 腾讯云高性能计算集群新一代

    2024年02月15日
    浏览(33)
  • 性能测试平台 - 集分布式压测、服务器资源监控、远程连接Linux于一体的平台

    前情提要:   网上搜了一下开源性能测试平台或全链路压测平台,只找到了一个stressTestSystem,其他的都是一些垃圾公司的广告。至于使用体验,stressTestSystem没用过,不好评价。本文开源的性能测试平台,在实现功能的前提下,极大地考虑到了使用体验,功能“强大”且部

    2024年02月10日
    浏览(41)
  • 阿里云c8i服务器CPU、内存性能测评

    阿里云第八代云服务器ECS计算型c8i实例,CPU采用Intel Xeon Emerald Rapids或者Intel Xeon Sapphire Rapids,主频不低于2.7 GHz,全核睿频3.2,阿里云百科aliyunbaike.com分享阿里云c8i服务器CPU处理器型号、存储、网络、安全、使用场景和不同CPU内存配置的c8i服务器性能参数表: 阿里云服务器E

    2024年02月01日
    浏览(66)
  • 阿里云c8i服务器CPU性能、架构及费用测评

    阿里云第八代云服务器ECS计算型c8i实例,CPU采用Intel Xeon Emerald Rapids或者Intel Xeon Sapphire Rapids,主频不低于2.7 GHz,全核睿频3.2,阿里云百科aliyunbaike.com分享阿里云c8i服务器CPU处理器型号、存储、网络、安全、使用场景和不同CPU内存配置的c8i服务器性能参数表: 阿里云服务器E

    2024年01月24日
    浏览(32)
  • 腾讯云高IO型云服务器CPU型号处理器主频性能

    腾讯云服务器高IO型CVM实例CPU处理器主频性能说明,高IO型云服务器具有高随机IOPS、高吞吐量、低访问延时等特点,适合对硬盘读写和时延要求高的高性能数据库等I/O密集型应用,腾讯云服务器网分享高IO型云服务器IT5和IT3的CPU处理器说明: 高IO型CVM云服务器可选高IO型IT5和高

    2024年02月15日
    浏览(35)
  • 阿里云u1服务器通用算力型CPU处理器性能测评

    阿里云服务器u1通用算力型Universal实例高性价比,CPU采用Intel(R) Xeon(R) Platinum,主频是2.5 GHz,云服务器U1实例的基准vCPU算力与5代企业级实例持平,最高vCPU算力与6代企业级实例持平,提供2c-32c规格和1:1/2/4/8丰富配比,阿里云服务器u1适用于Web应用及网站,企业办公类应用,数据

    2024年02月05日
    浏览(32)
  • 腾讯云4核8G云服务器S5租用价格_CPU型号_网络性能

    腾讯云4核8G服务器CVM标准型S5实例性能测评,包括CPU型号、内存、系统盘、CVM实例规格性能测评,腾讯云4核8G租用优惠价格表,腾讯云服务器网分享腾讯云4核8G服务器CVM S5性能测评和租用费用: 目录 腾讯云4核8G服务器CVM S5性能测评 CVM 4核8G S5租用费用 4核8G云服务器可以选择腾

    2024年02月07日
    浏览(39)
  • 腾讯云SA3服务器AMD处理器CPU网络带宽性能详解

    腾讯云AMD服务器SA3实例CPU采用2.55GHz主频的AMD EPYCTM Milan处理器,睿频3.5GHz,搭载最新一代八通道DDR4,内存计算性能稳定,默认网络优化,最高内网收发能力达1900万pps,最高内网带宽可支持100Gbps 。腾讯云服务器网分享腾讯云AMD服务器SA3实例性能详解: 目录 腾讯云CVM服务器S

    2024年02月13日
    浏览(38)
  • 腾讯云轻量应用服务器:2核4G5M性能测评CPU带宽流量限制

    腾讯云2核4G5M轻量应用服务器配置上线了,这款轻量服务器5M公网带宽,每月500G免费流量,系统盘为60GB SSD盘,这款轻量服务器2023年4月报价出炉,一年168元、三年628元,如果选择免费赠送3个月是198元15个月,腾讯云百科来详细说下腾讯云轻量2核4G5M服务器配置、选择、限制条

    2024年02月10日
    浏览(68)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包