--number-of-queries=N 每个客户端执行SQL语句的次数。需要注意的是,每条SQL之间的;都会算作一次,例如--query="use test;insert into t values(null)"就是2次。 mysqlslap --delimiter=";" --number-of-queries=10 --query="use test;insert into t values(null)" 这个语句会执行5次INSERT操作
--concurrency=N, -c N 模拟客户端的并行度
--iterations=N, -i N 执行压力测试的次数
--create-schema=value 在哪个用户下执行压力测试
--commit=N 执行多少条SQL进行提交,默认没有提交
--auto-generate-sql, -a 当没有指定SQL语句的时候,自动生成SQL语句
--number-char-cols=N, -x N 自动生成SQL语句中,VARCHAR字段的个数
[root@localhost ~]# /software/bin/mysqlslap -h 192.168.78.141 --user=system --password=system --query="use fire;select * from test2" --number-of-queries=100000 -c 30 -i 10 --create-schema=neo --执行结果 Benchmark Average number of seconds to run all queries: 6.779 seconds Minimum number of seconds to run all queries: 6.607 seconds Maximum number of seconds to run all queries: 7.310 seconds Number of clients running queries: 30 Average number of queries per client: 3333
[root@localhost ~]# /software/bin/mysqlslap -h 192.168.78.141 --user=system --password=system --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-execute-number=100000 -- commit=10000 --create-schema=neo Benchmark Average number of seconds to run all queries: 16.332 seconds Minimum number of seconds to run all queries: 16.332 seconds Maximum number of seconds to run all queries: 16.332 seconds Number of clients running queries: 1 Average number of queries per client: 100000