Reference documents:
Http://dev.mysql.com/doc/refman/5.1/en/mysqlslap.html
Http://www.ningoo.net/html/2008/mysql_load_test_tool_mysqlslap.html
After mysql5.1 version: The client has a tool mysqlslap can stress test mysql:
You can use Mysqlslap--help to show how to use:
Default options is read from the following files in the given order:/ETC/MYSQL/MY.CNF/ETC/MY.CNF ~/.MY.CNF
--concurrency represents the number of concurrent, multiple can be separated by commas, concurrency=10,50,100, the number of concurrent connection threads are 10, 50, 100 concurrency respectively.
--engines represents the engine to be tested, can have multiple, separated by delimiters. --iterations represents how many times to run these tests. The--auto-generate-sql represents a SQL script generated by the system itself. Whether the--auto-generate-sql-load-type represents a read or write or a mix of both (read,write,update,mixed)--number-of-queries represents the total number of queries to run. The number of queries that each client runs can be calculated using the total number of queries/concurrency. The--debug-info represents the additional output of CPU and memory related information. --number-int-cols: The number of int fields to create a test table--auto-generate-sql-add-autoincrement: Represents the automatic addition of auto_increment columns to the generated table, starting with version 5.1.18-- Number-char-cols the number of char fields that created the test table. The schema of the--create-schema test Schema,mysql is database. --query uses a custom script to perform tests, such as a custom stored procedure or SQL statement that can be invoked to perform the test. --only-print If you just want to print and see what the SQL statement is, you can use this option.
mysqlslap-umysql-p123--concurrency=100--iterations=1--auto-generate-sql--auto-generate-sql-add-autoincrement-- Auto-generate-sql-load-type=mixed--engine=myisam--number-of-queries=10--debug-info
Or:
Specify the database and SQL statements:
mysqlslap-h192.168.3.18-p4040--concurrency=100--iterations=1 --create-schema= ' test ' --query = ' select * from test; ' --number-of-queries=10--debug-info-umysql-p123
If you look at what you've done, add:--only-print
Benchmark Average number of seconds to run all queries:25.225 seconds Minimum number of seconds to run Al L queries:25.225 seconds Maximum number of seconds to run all queries:25.225 seconds number of clients R Unning queries:100 Average Number of queries per client:0
The above indicates that 100 clients run at the same time for 25 seconds
Again such as:
mysqlslap-uroot-p123456--concurrency=100--iterations=1--engine=myisam--create-schema= ' haodingdan112 '--query= ' SELECT * from order_boxing_transit where id = Ten '--number-of-queries=1--debug-info
MySQL pressure test tool mysqlslap explanation