Simple mysqlslap stress testing tutorial

Source: Internet
Author: User
Mysqlslap is a stress testing tool officially provided by MySQL since version 5.1.4. Simulate multiple concurrent clients to access MySQL for stress testing, and provide detailed data performance reports for "high-load attack MySQL. In addition, it can compare the performance difference of concurrent pressure of multiple storage engines in the same environment. Its syntax is as follows: shell>/usr/local/MySQL/bin/mysqlslap [Options] common parameter [Options] Details: -- concurrency indicates the number of concurrent jobs, multiple IDs can be separated by commas. For example, -- concurrency = 50,200,500 -- engines indicates the engine to be tested. Multiple engines can be separated by separators. For example, -- engines = MyISAM, InnoDB, memory -- iterations indicates the number of times a test is run in different Concurrent Environments. -- Auto-generate-SQL indicates that the SQL script generated by mysqlslap is used to test the concurrency pressure. -- Auto-generate-SQL-add-auto-increment indicates that the auto_increment column is automatically added to the generated table, starting with version 5.1.18, -- auto-generate-SQL-load-type indicates whether the test environment is a combination of read, write, update, and mixed) -- number-of-queries indicates the total number of queries to be run. -- Debug-Info indicates that information about the CPU and memory needs to be output. -- Number-int-cols indicates the number of integer attributes in the example table. -- Number-Char-cols indicates the vachar type attributes in the example table. -- Create-schema indicates the name of the custom test database. -- Query indicates a custom test SQL script. Note: during the test, a test table is generated and test data is inserted. This mysqlslap can be automatically generated. By default, a schema of mysqlslap is generated. if it already exists, delete it first. You can use-only-print to print the actual test process. After the test is completed, no trace is left in the database. Lab procedure: Exercise 1: Single-threaded testing. Test what was done.>. /Bin/mysqlslap-a-uroot-p111111 multi-thread test. Use -- concurrency to simulate concurrent connections.> ./Bin/mysqlslap-a-c 100-uroot-p111111 iteration test. Used to obtain the average value after multiple tests.>. /Bin/mysqlslap-a-I 10-uroot-p111111 Exercise 2:>. /bin/mysqlslap-auto-generate-SQL-add-autoincrement-a-uroot-p111111>. /bin/mysqlslap-a-auto-generate-SQL-load-type = read-uroot-p111111>. /bin/mysqlslap-a-auto-generate-secondary-indexes = 3-uroot-p111111>. /bin/mysqlslap-a-auto-generate-SQL-Write-number = 1000-uroot-p111111>. /bin/mysqlslap -- create-schema world-Q "select count (*) from City "-Uroot-p111111>. /bin/mysqlslap-a-e InnoDB-uroot-p111111>. /bin/mysqlslap-A -- number-of-queries = 10-uroot-p111111 Exercise 3: perform a test with 50 concurrent queries and 100 concurrent queries respectively. Execute 1000 total queries:>. /bin/mysqlslap-A -- concurrency = 50,100 -- number-of-queries 1000 -- debug-Info-uroot-p11111150 and 100 concurrency respectively get a test result (benchmark ), the more concurrency, the longer the query execution time. For accuracy, you can perform multiple iteration tests:>. /bin/mysqlslap-A -- concurrency = 50,100 -- number-of-queries 1000 -- iterations = 5 -- debug-Info-uroot-p111111 test and compare the performance of different storage engines: >. /bin/mysqlslap-A -- concurrency = 50,100 -- number-of-queries 1000 -- iterations = 5 -- engine = MyISAM, InnoDB -- debug-Info-uroot-p111111

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.