MySQL Benchmark Test Tool MySQLSlap instance

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.