root@VM-64-10-debian:~# mysqlslap --concurrency=100 --iterations 10 -a --auto-generate-sql-add-autoincrement --engine=innodb --number-of-queries=1000 -h172.1.100.10 -uroot -p
Enter password:
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.046 seconds
Minimum number of seconds to run all queries: 0.042 seconds
Maximum number of seconds to run all queries: 0.049 seconds
Number of clients running queries: 100
Average number of queries per client: 10
root@VM-64-10-debian:~#
root@VM-64-10-debian:~# mysqlslap --concurrency=100,200 --iterations 10 -a --auto-generate-sql-add-autoincrement --engine=innodb --number-of-queries=1000 -h172.16.0.40 -uroot -p
Enter password:
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.046 seconds
Minimum number of seconds to run all queries: 0.045 seconds
Maximum number of seconds to run all queries: 0.048 seconds
Number of clients running queries: 100
Average number of queries per client: 10
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.037 seconds
Minimum number of seconds to run all queries: 0.034 seconds
Maximum number of seconds to run all queries: 0.052 seconds
Number of clients running queries: 200
Average number of queries per client: 5
root@VM-64-10-debian:~#
root@VM-64-10-debian:~# cat create.sql
CREATE TABLE a (b int);INSERT INTO a VALUES (23);
root@VM-64-10-debian:~# cat query.sql
SELECT * FROM a;
SELECT b FROM a;
root@VM-64-10-debian:~#
root@VM-64-10-debian:~# mysqlslap --concurrency=100,200 --query=query.sql --create=create.sql --delimiter=";" --engine=innodb --number-of-queries=1000 -h172.16.0.40 -uroot -p
Enter password:
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.045 seconds
Minimum number of seconds to run all queries: 0.045 seconds
Maximum number of seconds to run all queries: 0.045 seconds
Number of clients running queries: 100
Average number of queries per client: 10
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.023 seconds
Minimum number of seconds to run all queries: 0.023 seconds
Maximum number of seconds to run all queries: 0.023 seconds
Number of clients running queries: 200
Average number of queries per client: 5
root@VM-64-10-debian:~#
小结
市面上可用的 MySQL 压测工具非常多,各个工具都有优劣,多了解一些工具,然后根据实际需求选择最合适的工具就能以最效率的方式完成需要的压力测试。
以上就是Mysql官方性能测试工具mysqlslap的使用简介的详细内容,更多关于mysqlslap的使用的资料请关注脚本之家其它相关文章!