Use of mysql stress test tool mysqlslap

mysql benchmark stress test
mysqlslap mysql test tool sysbench
mysql test tool

The mysql benchmark tool mysqlslap
installs
the benchmark tool that comes with the mysql server without installation.
Features
can simulate server load and output related statistics.
You can specify or automatically generate query statements.

Common parameters

--auto-generate-sql 由系统自动生成sql脚本进行测试
--auto-generate-sql-add-autoincrement 在生成的表中增加自增ID(innodb是聚集索引这个参数很重要)
--auto-generate-sql-load-type 指定测试中使用的查询类型
--auto-generate-sql-write-number 指定初始化数据时生成的数据量
--concurrency 指定并发线程的数量
--engine 指定要测试表的存储引擎,可以用逗号分割多个存储引擎
--no-drop 指定不清理测试数据,默认清理
--iterations 指定测试运行的次数(指定这个不能指定--no-drop参数,这两个是冲突的)
--number-of-queries 指定每一个线程执行的查询数量
--debug-info 指定输出额外的内存及CPU统计信息
--number-int-cols 指定测试表中包含的int类型列的数量
--number-char-cols 指定测试表中包含的varchar类型的数量
--create-schema 指定用于执行测试的数据库的名字
--query 用于指定自定义的SQL的脚本
--only-print 并不运行测试脚本,而是把生成的脚本打印出来

For the installation of mysqlslap tool, check
mysqlslap --help

help can view all command line parameters
Insert picture description here

Test case

mysqlslap -uroot -p --concurrency=1,50,100,200 --iterations=3 --number-int-cols=5 --number-char-cols=5 --auto-generate-sql --auto-generate-sql-add-autoincrement --engine=myisam,innodb --number-of-queries=10 --create-schema=sbtest

The test results are as follows
Insert picture description here
: in the case of single concurrency:
myisam time is 0.035 seconds and innodb time is 0.036 seconds
. In the case of multi-threading, the time for each SQL to perform 50, 100, 200 threads is as follows
: 50: myisam time is 0.218 seconds and innodb time is 0.130 seconds
100 : Myisam time is 0.797 seconds innodb time is 0.557 seconds
200: myisam time is 1.917 seconds innodb time is 1.151 seconds
The query performance of the stress test InnoDB is better than myisam.
Insert picture description here
Print out the test SQL data for viewing
–only-print Print test data
–only- print>filename save test data

mysqlslap -uroot -p --concurrency=1,50,100,200 --iterations=3 --number-int-cols=5 --number-char-cols=5 --auto-generate-sql --auto-generate-sql-add-autoincrement --engine=myisam,innodb --number-of-queries=10 --create-schema=sbtest --only-print >1.sql

Guess you like

Origin blog.csdn.net/rankiy/article/details/102793304