sysbench的压测工具的安装与使用

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
云数据库 RDS MySQL,高可用系列 2核4GB
简介: sysbench的压测工具的安装与使用

1.安装

yum install epel-release

yum install sysbench

2.测试

2.1测试cpu

[root@192-168-125-231 ~]# sysbench --test=cpu --cpu-max-prime=3000 run
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)

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


Prime numbers limit: 3000

Initializing worker threads...

Threads started!

CPU speed:
    events per second:  6729.13

General statistics:
    total time:                          10.0002s
    total number of events:              67306

Latency (ms):
         min:                                    0.14
         avg:                                    0.15
         max:                                   12.64
         95th percentile:                        0.15
         sum:                                 9984.03

Threads fairness:
    events (avg/stddev):           67306.0000/0.00
    execution time (avg/stddev):   9.9840/0.00

2.2 测试线程

[root@192-168-125-231 ~]# sysbench  --test=threads --num-threads=500 --thread-yields=100 --thread-locks=4 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.17 (using system LuaJIT 2.0.4)

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


Initializing worker threads...

Threads started!


General statistics:
    total time:                          10.1044s
    total number of events:              55605

Latency (ms):
         min:                                    0.14
         avg:                                   90.33
         max:                                 1128.22
         95th percentile:                      390.30
         sum:                              5022606.12

Threads fairness:
    events (avg/stddev):           111.2100/28.18
    execution time (avg/stddev):   10.0452/0.04

2.3 测试IO

--file-total-size 总的文件大小
生成需要的测试文件,完成后会在当前目录下生成很多小文件。


sysbench --test=fileio --num-threads=16 --file-total-size=2G --file-test-mode=rndrw prepare

2.3清理测试时生成的文件

[root@192-168-125-231 lys]# sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw cleanup
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.17 (using system LuaJIT 2.0.4)

Removing test files...

2.4 测试内存

[root@192-168-125-231 lys]# sysbench --test=memory --memory-block-size=8k --memory-total-size=1G run
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)

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


Running memory speed test with the following options:
  block size: 8KiB
  total size: 1024MiB
  operation: write
  scope: global

Initializing worker threads...

Threads started!

Total operations: 131072 (1477287.77 per second)

1024.00 MiB transferred (11541.31 MiB/sec)


General statistics:
    total time:                          0.0869s
    total number of events:              131072

Latency (ms):
         min:                                    0.00
         avg:                                    0.00
         max:                                    0.17
         95th percentile:                        0.00
         sum:                                   66.11

Threads fairness:
    events (avg/stddev):           131072.0000/0.00
    execution time (avg/stddev):   0.0661/0.00

测试mutex

[root@192-168-125-231 lys]# sysbench --test=mutex --num-threads=100 --mutex-num=1000 --mutex-locks=100000 --mutex-loops=10000 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.17 (using system LuaJIT 2.0.4)

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


Initializing worker threads...

Threads started!


General statistics:
    total time:                          37.6005s
    total number of events:              100

Latency (ms):
         min:                                36087.99
         avg:                                37003.16
         max:                                37517.95
         95th percentile:                    37144.33
         sum:                              3700315.95

Threads fairness:
    events (avg/stddev):           1.0000/0.00
    execution time (avg/stddev):   37.0032/0.30

测试OLTP


1,prepare阶段,生成需要的测试表

sysbench --test=oltp --mysql-table-engine=innodb --mysql-host=10.0.0.8 --mysql-db=testsysbench --oltp-table-size=500000 --mysql-user=root --mysql-password=Lad123456 prepare

2,run阶段

sysbench --num-threads=16 --test=oltp --mysql-table-engine=innodb --mysql-host=192.168.x.x --mysql-db=test --oltp-table-size=500000 --mysql-user=root --mysql-password=123456 run

3,清理测试时生成的测试表

sysbench --num-threads=16 --test=oltp --mysql-table-engine=innodb --mysql-host=192.168.x.x --mysql-db=test --oltp-table-size=500000 --mysql-user=root --mysql-password=123456 cleanup

7)测试表信息:

sysbench--num-threads=4 --test=oltp--oltp-reconnect-mode=random--mysql-table-engine=innodb --mysql-host=192.168.200.201 --mysql-db=rep_test --oltp-table-size=500000--mysql-user=zjy --mysql-password=1234#



相关文章
|
NoSQL 关系型数据库 MySQL
涉及rocketMQ,jemeter等性能测试服务器的安装记录
涉及rocketMQ,jemeter等性能测试服务器的安装记录
148 1
|
关系型数据库 MySQL 测试技术
压测工具sysbench的使用
压测工具sysbench的使用
1114 0
|
关系型数据库 MySQL 测试技术
sysbench 对MySQL压测100分钟的命令
使用 `sysbench` 对 MySQL 数据库进行性能测试(压测)时,首先确保 `sysbench` 和 MySQL 数据库已经安装,并且你有一个测试数据库可以使用。下面是一个针对 MySQL 数据库进行压测的示例命令,测试时长为 100 分钟(6000 秒)。 在运行此命令之前,请确保以下内容: - 使用适当的数据库连接参数(主机、端口、用户名、密码、数据库名)。 - 根据你的需求调整测试参数(如并发数、线程数、事务数等)。 以下是一个示例命令,使用 `sysbench` 对 MySQL 数据库进行压测 100 分钟: ```shell sysbench --db-driver=m
314 0
|
测试技术 Linux
百度搜索:蓝易云【【Linux】硬件性能测试工具安装。】
以上是一些常见的硬件性能测试工具,你可以根据需要选择适合的工具进行安装和使用。注意,在安装和运行这些工具时,请遵循官方文档和指南,并在测试过程中小心操作,以避免对系统造成不良影响。
197 1
|
关系型数据库 MySQL 测试技术
MySQL压测--TPCC安装,测试
今天我们来讲一下MySQL的压力测试工具,目前我接触到的主要有两种压力测试工具:TPCC,Sysbench,前者只适合MySQL数据库OLTP压力测试,而Sysbench功能就比较广泛,可以测试OS的CPU,Memory,IO,以及多种关系型数据库,如MySQL,PostgreSQL; 这篇博客主要讲解Tpcc 安装,测试。
2510 0
|
Java 测试技术 数据库连接
MyBatis基本用法 && 什么是自动化测试 && Spring事务和事务传播机制 && 性能测试概念和术语 && Loadrunner安装
MyBatis基本用法 && 什么是自动化测试 && Spring事务和事务传播机制 && 性能测试概念和术语 && Loadrunner安装
179 0
|
SQL Java 测试技术
2021-jmeter接口性能测试教学及实战(一):jmeter介绍及安装,为什么是jmeter而不是loadrunner?
2021-jmeter接口性能测试教学及实战(一):jmeter介绍及安装,为什么是jmeter而不是loadrunner?
434 0
2021-jmeter接口性能测试教学及实战(一):jmeter介绍及安装,为什么是jmeter而不是loadrunner?
|
Prometheus 监控 数据可视化
Linux下安装配置Grafana压测监控服务-安装Grafana
Linux下安装配置Grafana压测监控服务-安装Grafana
|
监控 测试技术 Linux
Linux下安装配置Grafana压测监控服务-安装InfluxDB
Linux下安装配置Grafana压测监控服务-安装InfluxDB