mysqlmysqlslap压力测试_MySQL
Jun 01, 2016 pm 01:18 PM
mysql
pressure test
bitsCN.com
mysqlslap
简介
mysql 压力测试工具
选项
选项 简写 说明 --auto-generate-sql -a 自动生成MySQL测试语句 --auto-generate-sql-add-autoincrement 添加AUTO_INCREMENT字段 --auto-generate-sql-execute-number=# 查询的个数 --auto-generate-sql-guid-primary 添加GUID字段 --auto-generate-sql-load-type=name mixed:混合、update:更新、write:写入、key:读主键、read:查询 --auto-generate-sql-secondary-indexes=# 设置索引字段个数 --auto-generate-sql-unique-query-number=# 生成N条不同的query sql语句 --auto-generate-sql-unique-write-number=# 生成N条不同的write sql语句 --auto-generate-sql-write-number=# 每个线程write sql语句数量 --commit=# 设置每多少条sql语句提交一次 --compress -C 启用压缩协议 --concurrency=# -c 客户端数量(并发量) --create=name 测试的SQL语句或文件 --create-schema=name 测试的数据名 --csv=name 生产CSV格式数据文件 --debug -# 写调试日志(windows不可用) 如:mysqlslap -a -#"d:t:o,c:/debug.txt" --debug-check 测试后打印调试信息(windows不可用) --debug-info -T 打印内存和CPU的相关信息 --default-auth=plugin 验证插件 --delimiter=str -F 语句分隔符默认是 ; --detach=# 执行N条语句后断开重连 --enable-cleartext-plugin 启用明文身份验证插件 --engine=engine_name -e 测试引擎 如:mysqlslap -e"myisam"或-e"myisam,innodb" --help 帮助信息 --host=host_name -h 数据库host --iterations=# -i 迭代运行次数 --login-path=name 登陆配置文件 详见 --no-drop 测试后不删除schema --number-char-cols=# -x 设置VARCHAR类型字段数量 --number-int-cols=# -y 设置INT类型字段数量 --number-of-queries=# 每个客户端运行sql语句数量 受 --only-print 仅显示将被运行的SQL语句--delimiter选项影响 --password=password -p 数据库密码 --pipe 启用管道 --plugin-dir=path 插件目录 --port=port_num -P 数据库端口 --post-query=value 测试后执行的SQL语句 --post-system=str 测试后执行的系统语句 --pre-query=value 测试前执行的SQL语句 --pre-system=str 测试前执行的系统语句 --protocol=type 链接协议 tcp, socket, pipe --query=value -q 测试的SQL语句 如:mysqlslap -q"SELECT * FROM t1" --secure-auth 不要发送密码到服务器 --silent -s 不显示测试(静音测试) --socket=path -S 连接服务器的socket --ssl-ca=file_name --ssl-capath=dir_name --ssl-cert=file_name --ssl-cipher=cipher_list --ssl-crl=file_name --ssl-crlpath=dir_name --ssl-key=file_name --ssl-verify-server-cert --user=user_name -u 数据库用户名 --verbose -v 输出更多的信息 --version -V 版本信息例子
远程测试如:mysqlslap -a -h"192.168.1.139" -P3306 -p指定sql语句 如:mysqlslap --create-schema=test -q"select * from user"自动测试 如:mysqlslap -a显示测试sql语句 如:mysqlslap -a --only-print
报表
我们测试本地数据库引擎性能
mysqlslap -a -e"myisam,innodb" --csv="c:/a.csv"
c:/a.csv文件
我们转换成图表形式
可以看出 myisam,innodb 混合测试时myisam性能更好些 读写时间更少
常用选项
Windows默认配置文件读取顺序:C:/WINDOWS/my.ini
C:/WINDOWS/my.cnf
C:/my.ini
C:/my.cnf
F:/mysql/5.6.16/my.ini
F:/mysql/5.6.16/my.cnf
-h 数据库host
-u 数据库用户名
-p 数据库密码
-P 数据库端口
--create-schema=name 测试的数据名
--create=name 测试的SQL语句或文件
--no-drop 测试后不删除schema
--only-print 仅显示将被运行的SQL语句
-c 客户端数量(并发量) 如:mysqlslap -c"10"或-c"10,100,1000"
-e 测试引擎 如:mysqlslap -e"myisam"或-e"myisam,innodb"
--number-of-queries=# SQL语句执行总次数 如:mysqlslap -a --number-of-queries="10"
-q 测试的SQL语句 如:mysqlslap -q"SELECT * FROM t1"
-i 迭代运行次数 如:mysqlslap -a -i"3"
-T 显示内存和CPU信息并退出 如:mysqlslap -a -T
-F SQL语句分隔符
-s 不输出无回显运行
--csv[=name] 生产CSV格式数据文件
--commit=# 设置每多少条sql语句提交一次
--detach=# 设置每多少条sql语句重连服务器一次
-a,--auto-generate-sql 自动生成MySQL测试语句
--auto-generate-sql-add-autoincrement 添加AUTO_INCREMENT字段
--auto-generate-sql-execute-number=# 查询的个数
--auto-generate-sql-guid-primary 添加GUID字段
--auto-generate-sql-load-type=name mixed:混合、update:更新、write:写入、key:读主键、read:查询
--auto-generate-sql-secondary-indexes=# 设置索引字段个数
--auto-generate-sql-unique-query-number=# 生成N条不同的query sql语句
--auto-generate-sql-unique-write-number=# 生成N条不同的write sql语句
--auto-generate-sql-write-number=# 每个线程write sql语句数量
-x, --number-char-cols=name 设置VARCHAR类型字段数量 默认1
-y, --number-int-cols=name 设置INT 类型字段数量默认1
bitsCN.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot tools Tags

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP's big data structure processing skills

How to optimize MySQL query performance in PHP?

How to use MySQL backup and restore in PHP?

How to insert data into a MySQL table using PHP?

What are the application scenarios of Java enumeration types in databases?

How to fix mysql_native_password not loaded errors on MySQL 8.4

How to use MySQL stored procedures in PHP?

Performance optimization strategies for PHP array paging
