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

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: 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#



相关实践学习
通过性能测试PTS对云服务器ECS进行规格选择与性能压测
本文为您介绍如何利用性能测试PTS对云服务器ECS进行规格选择与性能压测。
相关文章
|
关系型数据库 MySQL 测试技术
|
关系型数据库 MySQL 测试技术
使用sysbench压测主机和数据库
交付服务器或数据库的时候,我们需要对服务器和数据库的性能有一定的了解。可以使用sysbench对系统做一些压测。
3905 0
|
关系型数据库 测试技术 OLTP
PosgreSQL快速参数调优和sysbench压测
关于PostgreSQL的性能调优可以参考《PostgreSQL 9.0 High Performance》,以及朱贤文在2014 PostgreSQL中国用户大会上分享的《高性能Postgres 最佳实践》。
1579 0
|
测试技术 Shell
如何用sysbench做好IO性能测试
sysbench 是一个非常经典的综合性能测试工具,通常都用它来做数据库的性能压测,但也可以用来做CPU,IO的性能测试。最近碰到一个客户比较轴,一定要用sysbench来测IO,不是很推荐用这个工具来测IO,倒不是说它有错误,工具本身没有任何问题,它的测试方法导致测试的数据会让人有些困惑:性能数据到底是不是这样呢,跟云厂商承诺的性能有关系嘛。
3846 0
|
关系型数据库 MySQL 测试技术
|
MySQL 关系型数据库 测试技术
|
关系型数据库 MySQL 测试技术
基于新版sysbench 1.0.8压测MySQL
0.前言    Sysbench的作者于2016年将十年未变的sysbench升级至1.0版本,较老版本有了非常大的改变。在使用过程中由于官方文档不太完善,遂有此文。 1.新特性    官方文档中的升级说明: 更好的性能和扩展性,比0.4版本快了3.44倍,比0.5版本快了6.44倍。
3952 0