服务器的测试工具
直接在CMD运行即可:
基础语法就是:mysqlslap选项
典型的测试选项如下:
C:\Users\Jay>mysqlslap --help
mysqlslap Ver 1.0 Distrib 5.7.21, for Win64 (x86_64)
Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Run a query multiple times against the server.
Usage: mysqlslap [OPTIONS]
1.自动生成SQL测试
C:\Users\Jay>mysqlslap --auto-generate-sql -u root -p
Enter password: **********
Benchmark
Average number of seconds to run all queries: 0.016 seconds
Minimum number of seconds to run all queries: 0.016 seconds
Maximum number of seconds to run all queries: 0.016 seconds
Number of clients running queries: 1
Average number of queries per client: 0
2.并发测试
C:\Users\Jay>mysqlslap --auto-generate-sql --concurrency=100 -u root -p
Enter password: **********
Benchmark
Average number of seconds to run all queries: 0.265 seconds
Minimum number of seconds to run all queries: 0.265 seconds
Maximum number of seconds to run all queries: 0.265 seconds
Number of clients running queries: 100
Average number of queries per client: 0
3.多轮测试
C:\Users\Jay>mysqlslap --auto-generate-sql --concurrency=400 --iterations=10 -u root -p
Enter password: **********
Benchmark
Average number of seconds to run all queries: 2.793 seconds
Minimum number of seconds to run all queries: 2.375 seconds
Maximum number of seconds to run all queries: 3.438 seconds
Number of clients running queries: 400
Average number of queries per client: 0
4.存储引擎测试
C:\Users\Jay>mysqlslap --auto-generate-sql --concurrency=400 --iterations=3 --engine=myisam -u root -p
Enter password: **********
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 2.135 seconds
Minimum number of seconds to run all queries: 2.094 seconds
Maximum number of seconds to run all queries: 2.172 seconds
Number of clients running queries: 400
Average number of queries per client: 0
C:\Users\Jay>mysqlslap --auto-generate-sql --concurrency=400 --iterations=3 --engine=innodb -u root -p
Enter password: **********
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 3.120 seconds
Minimum number of seconds to run all queries: 2.328 seconds
Maximum number of seconds to run all queries: 3.610 seconds
Number of clients running queries: 400
Average number of queries per client: 0
网友评论