MySQL pressure test tool mysqlslap test

Source: Internet
Author: User
Tags benchmark mixed socket

Here are some of the main parameters, more detailed instructions to the official manual. If it is the system itself or using the RPM package installed MySQL, install the mysql-client end of the package has mysqlslap this tool.
The following figure is the number of connection processes for MySQL when running the mysqlslap-a-C 500-i 10-uroot-p123456 test:

Various test parameter instances (with the MySQL root password followed by-p):
Single-thread testing. What the test did.
# mysqlslap-a-uroot-p123456

Multithreading test. Use –concurrency to simulate concurrent connections.
# MYSQLSLAP-A-C 100-uroot-p123456

Iterative testing. For averages that require multiple tests to be performed.
# 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 performance comparisons for different storage engines:
# mysqlslap-a--concurrency=50,100--number-of-queries 1000--iterations=5--engine=myisam,innodb--debug-info-uroot- p123456
Perform a test, 50 and 100 concurrent, and perform a 1000-time total query:
# mysqlslap-a--concurrency=50,100--number-of-queries 1000--debug-info-uroot-p123456
50 and 100 concurrent results of a test result (Benchmark), the more the number of concurrent, the longer the execution of all queries. For accuracy, multiple iterations can be tested several times:
# mysqlslap-a--concurrency=50,100--number-of-queries 1000--iterations=5--debug-info-uroot-p123456


Mysqlslap is an official MySQL-supplied stress testing tool. Here are some of the more important parameters:
–defaults-file, configuration file storage location
–concurrency, concurrent number
–engines, engine.
–iterations, number of iterations of the experiment
–socket,socket File Location

Automated Tests:

–auto-generate-sql, automatically generate test SQL
–auto-generate-sql-load-type, test the type of SQL. Type has mixed,update,write,key,read.
–number-of-queries, total number of SQL executed
–number-int-cols, number of int columns in the table
–number-char-cols, number of char columns in the table

You can use Mysqlslap--help to display the usage method:
Default options are read from the following files in the given order:
/ETC/MYSQL/MY.CNF/ETC/MY.CNF ~/.my.cnf
--concurrency represents concurrent quantities, multiple can be separated by commas, concurrency=10,50,100, and the number of concurrent connection threads is 10, 50, 100 concurrency.
--engines represents the engine to be tested, can have multiple, separated by delimiters.
The--iterations represents how many times you want to run these tests.
The--auto-generate-sql represents a test of SQL scripts generated by the system itself.
--auto-generate-sql-load-type represents whether the test is to be read or written or mixed (read,write,update,mixed)
--number-of-queries represents the total number of queries to run. The number of queries that each customer runs can be calculated with the total number of queries/concurrency.
The--debug-info represents information about the extra CPU and memory to be exported.
--number-int-cols: Create the number of int fields for the 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 Create the number of Char fields for the test table.
The schema of the--create-schema test Schema,mysql is database.
--query uses custom scripts to perform tests, such as a custom stored procedure or SQL statement that can be invoked to execute a test.
--only-print You can use this option if you want to print only to see what the SQL statement is.
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 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 did, add:--only-print
Benchmark
Average number of seconds to run all queries:25.225 seconds
Minimum number of seconds to run all queries:25.225 seconds
Maximum number of seconds to run all queries:25.225 seconds
Number of clients running queries:100
Average number of queries per client:0
The above indicates that 100 clients run at the same time for 25 seconds

Another example:
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

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.