Use the following syntax:
# Mysqlslap [Options]
Common parameters [Options] Detailed description:
--auto-generate-sql,-a automatically generates test tables and data, indicating that the concurrency pressure is tested using the SQL script generated by the Mysqlslap tool itself. The type of the
--auto-generate-sql-load-type=type test statement. Represents whether the environment to be tested is a read or write operation or a mixture of the two. The values are: Read,key,write,update and mixed (default). The
--auto-generate-sql-add-auto-increment represents the automatic addition of the Auto_increment column to the generated table, starting with version 5.1.18.
--number-char-cols=n,-x N auto-generated test table contains the number of character types of the column, the default 1
--number-int-cols=n, the y-N auto-generated test table contains how many number types of columns, the default 1
-- Number-of-queries=n total number of test queries (number of concurrent customers x per customer query)
--query=name,-q executes the test using a custom script, such as a custom stored procedure or SQL statement that can be invoked to perform the test. The
--create-schema represents a custom test library name, and the Schema,mysql schema in the test is database.
--commint=n How many DML are submitted once.
--compress,-c compressed information is passed if both server and client support are compressed.
--concurrency=n,-c N represents the concurrency, which is how many clients perform a select at the same time. You can specify more than one value, either as a delimiter or as a comma or as the value specified by the--delimiter parameter. For example:--concurrency=100,200,500.
--engine=engine_name,-e engine_name represents the engine to be tested, can have multiple, separated by delimiters. For example:--engines=myisam,innodb. The number of iterations that the
--iterations=n,-I N tests perform, represents how many times to run each test in a different concurrency environment. The
--only-print only prints test statements and does not actually execute.
--detach=n breaks the re-connection after executing N statements.
--debug-info,-t print memory and CPU related information.
Description
The test process needs to generate a test table, insert the test data, the MYSQLSLAP can be generated automatically, by default generate a Mysqlslap schema, if already exist, first delete. You can use--only-print to print the actual test process, leaving no traces in the database after the entire test is complete.
Various test parameter instances (-P followed by the root password of MySQL):
Single thread testing. What the test did.
# mysqlslap-a-uroot-p123456
Multithreaded testing. Use –concurrency to simulate concurrent connections.
# MYSQLSLAP-A-C 100-uroot-p123456
Iterative testing. Used to perform tests that require multiple executions to get an average.
# mysqlslap-a-I 10-uroot-p123456
# Mysqlslap---auto-generate-sql-add-autoincrement-a-uroot-p123456
# mysqlslap-a--auto-generate-sql-load-type=read-uroot-p123456
# mysqlslap-a--auto-generate-secondary-indexes=3-uroot-p123456
# mysqlslap-a--auto-generate-sql-write-number=1000-uroot-p123456
# mysqlslap--create-schema world-q "SELECT COUNT (*) from City"-uroot-p123456
# MYSQLSLAP-A-E innodb-uroot-p123456
# mysqlslap-a--number-of-queries=10-uroot-p123456
Test the performance of the different storage engines at the same time:
# mysqlslap-a--concurrency=50,100--number-of-queries--iterations=5--engine=myisam,innodb--debug-info-uroot- p123456
Perform a test, respectively, 50 and 100 concurrently, and perform 1000 total queries:
# mysqlslap-a--concurrency=50,100--number-of-queries--debug-info-uroot-p123456
50 and 100 concurrently get a test result (Benchmark), the more concurrent the number, the longer it takes to complete all queries. For the sake of accuracy, multiple iterations can be tested several times:
# mysqlslap-a--concurrency=50,100--number-of-queries--iterations=5--debug-info-uroot-p123456
MySQL comes with a performance stress test tool Mysqlslap Detailed