MySQL stress testing tool

Source: Internet
Author: User
Versions later than mysql5.1:

Http://mysql.isu.edu.tw/Downloads/MySQL-5.1/MySQL-client-community-5.1.29-0.rhel5.i386.rpm

The client has a tool named mysqlslap to perform stress testing on MySQL:

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 indicates the number of concurrent tasks. multiple tasks can be separated by commas (,). You can also use your own separator to separate them. The -- delimiter switch is used in this case.

-- Engines indicates the engine to be tested, which can be separated by separators.

-- Iterations indicates how many times the tests will be run.

-- Auto-generate-SQL indicates testing with the SQL script generated by the system.

-- Auto-generate-SQL-load-type indicates whether to test the read or write operations or whether the two operations are mixed (read, write, update, and mixed)

-- Number-of-queries indicates the total number of queries to be run. The number of queries run by each customer can be calculated by the total number of queries/number of concurrent queries. For example, the second to last result 2 = 200/100.

-- Debug-Info indicates that information about the CPU and memory needs to be output.

-- Number-int-cols: Number of int columns to create in table if specifying

-- Auto-generate-SQL.

-- Number-Char-cols indicates the same as above.

-- Create-schema indicates the mode defined by the user (in MySQL, the database is also used ).

-- Query the file or string containing the SELECT statement to use for retrieving data.

-- Only-print: If you only want to print the SQL statement, you can use this option.

Mysqlslap-h192.168.3.18-p3306 -- concurrency = 100 -- iterations = 1 -- auto-generate-SQL-add-autoincrement -- auto-generate-SQL-load-type = mixed -- engine = MyISAM -- number-of-queries = 10 -- debug-Info-umysql-p123

Or:

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 want to see what you have done, you can 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 it takes 25 seconds for 100 clients to run simultaneously.

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.