MySQL Benchmark Test Tool MySQLSlap instance
MySQLSlap is a benchmark tool provided by MySQL. It can be used without installation. The following describes how to use MySQLSlap to perform basic MySQL tests on the server.
1. cd/usr/local/mysql/bin/
Go to the bin directory of the mysql installation directory and install mysql in/usr/local.
2. mysqlslap -- concurrency = 1, 50, 100 -- iterations = 3 -- number-int-cols = 5
-- Number-char-cols = 5 -- auto-generate-SQL
-- Auto-generate-SQL-add-autoincrement -- engine = myisam, innodb
-- Number-of-queries = 10 -- create-schema = dbtest-uroot-pphp
Run the mysqlslap command with the corresponding parameters and mysql username and password. The results of the current test are displayed, as shown in:
Because -- engine = myisam and innodb are specified in the parameter, the benchmark test is performed for the two engines separately. The test results are roughly translated as follows:
Running engine InnoDB
Average number of seconds for running all queries: 0.936 seconds
Minimum number of seconds for running all queries: 0.865 seconds
Maximum number of seconds for running all queries: 1.017 seconds
Number of running queries: 100
Average queries per connection: 0
3. Add the -- only-print parameter to view the specific SQL Execution:
Mysqlslap -- concurrency = 1, 50, 100 -- iterations = 3 -- number-int-cols = 5
-- Number-char-cols = 5 -- auto-generate-SQL
-- Auto-generate-SQL-add-autoincrement -- engine = myisam, innodb
-- Number-of-queries = 10 -- create-schema = dbtest-uroot-pphp -- only-print | more
The output result is as follows:
We can see that a database is created, and some inserted and queried SQL statements are automatically generated for execution to generate the test results, and then delete the database.
Common MySQLSlap parameters:
1. -- auto-generate-SQL: the system automatically generates an SQL script for testing.
2. -- auto-generate-SQL-add-autoincrement add auto-incremental ID to the generated table
3. -- atuo-generate-SQL-load-type specifies the query type used in the test.
4. -- auto-generate-SQL-write-number indicates the data volume generated during data initialization.
5. -- concurrency: specifies the number of concurrent threads.
6. -- engine: Specifies the storage engine for the table to be tested. You can use commas to separate multiple storage engines.
7, -- no-drop: Specify not to clean test data
8, -- iterations: specify the number of test runs
9. -- number-of-queries: specify the number of queries executed by each thread.
10. -- debug-info: Specify the output of additional memory and CPU statistics
11. -- number-int-cols: number of INT-type columns in the test table
12. -- number-char-cols: number of varchar types contained in the test table
13. -- create-schema: Specifies the name of the database used for testing.
14. -- query specifies the script for custom SQL
15. -- only-print does not run the test script, but prints the generated script.
This article permanently updates link: https://www.bkjia.com/Linux/2018-03/151159.htm