mysqlslap is a diagnostic program designed to emulate client load for a MySQL server and to report the timing of each stage. It works as if multiple clients are accessing the server.
Use of MySQLSLAP for MySQL or MariaDB with Example:
Test the queries on their own not need to specify the database name
mysqlslap --delimiter=";" --create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)" --query="SELECT * FROM a" --concurrency=50 --iterations=200 --host="localhost" --user="root" --password="password"
Example:
C:\Program Files\MariaDB 10.6\bin>mysqlslap --delimiter=";" --create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)" --query="SELECT * FROM a" --concurrency=50 --iterations=200 --host="localhost" --user="root" --password="password"
Benchmark
Average number of seconds to run all queries: 0.084 seconds
Minimum number of seconds to run all queries: 0.016 seconds
Maximum number of seconds to run all queries: 1.078 seconds
Number of clients running queries: 50
Average number of queries per client: 1
Test Procedure call present in database ClassicModels database with concurrency 100
C:\Program Files\MariaDB 10.6\bin>mysqlslap --host=localhost --user=root --password=password --port=3307 --verbose --concurrency=100 --query="call splitfunction('a,b,c,d,e,f',',')" --create-schema=classicmodels
Benchmark
Average number of seconds to run all queries: 0.531 seconds
Minimum number of seconds to run all queries: 0.531 seconds
Maximum number of seconds to run all queries: 0.531 seconds
Number of clients running queries: 100
Average number of queries per client: 1
Test with iterations also same procedure:
C:\Program Files\MariaDB 10.6\bin>mysqlslap --host=localhost --user=root --password=password --port=3307 --verbose --concurrency=100 --iterations=100 --query="call splitfunction('a,b,c,d,e,f',',')" --create-schema=classicmodels
Benchmark
Average number of seconds to run all queries: 0.158 seconds
Minimum number of seconds to run all queries: 0.031 seconds
Maximum number of seconds to run all queries: 1.657 seconds
Number of clients running queries: 100
Average number of queries per client: 1
Test by autogenerated SQL:
C:\Program Files\MariaDB 10.6\bin>mysqlslap --host=localhost --user=root --password=password --auto-generate-sql --verbose --concurrency=100
Benchmark
Average number of seconds to run all queries: 0.203 seconds
Minimum number of seconds to run all queries: 0.203 seconds
Maximum number of seconds to run all queries: 0.203 seconds
Number of clients running queries: 100
Average number of queries per client: 0