sysbench是给予LuaJIT的多线程性能测试工具。通常用于测试数据库性能,但是也可以创建抽象的负载负载用于测试多种场景:
oltp_*.lua
一系列OLTP类的数据库压测fileio
文件系统层对压测cpu
简单的CPU压测memory
内存访问压测threads
基于线程的调度器压测mutex
一个POSIX mutex压测
sysbench测试案例提供了多种平台的安装方法,例如,可以通过EPEL
sysbench GitHub文档提供方法:
curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash
sudo yum -y install sysbench
- 测试8个cpu的虚拟机性能
sysbench cpu --threads=8 --time=300 --cpu-max-prime=100000 run
cpu-max-prime
寻找最大素数
time
持续时间,默认是--time=0
表示不限制时间
输出举例
sysbench 1.0.9 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 8
Initializing random number generator from current time
Prime numbers limit: 100000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 278.78
General statistics:
total time: 300.0210s
total number of events: 83639
Latency (ms):
min: 27.98
avg: 28.69
max: 126.48
95th percentile: 33.12
sum: 2399991.83
Threads fairness:
events (avg/stddev): 10454.8750/37.61
execution time (avg/stddev): 299.9990/0.01