The use of Mysqlslap for MySQL common benchmark test tools

Source: Internet
Author: User
Tags benchmark

The MYSQLSLAP is a standard test tool that comes with MySQL and is not required to be installed separately. Here's a note of the steps to do a basic MySQL test with Mysqlslap on the server.

1. cd/usr/local/mysql/bin/

Go to the bin directory of the MySQL installation directory and my MySQL is installed under/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 appropriate parameters and MySQL username and password. The results of the current test are then printed on the screen, as shown in:

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8C/13/wKioL1hhNqOw3OgoAAB8-bmmtEQ140.png-wh_500x0-wm_3 -wmp_4-s_2401582057.png "title=" Myisam.png "alt=" Wkiol1hhnqow3ogoaab8-bmmteq140.png-wh_50 "/>


650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/8C/13/wKioL1hhNrWBJ_hUAABbLiufEpo716.png-wh_500x0-wm_3 -wmp_4-s_1879424905.png "title=" Innodb.png "alt=" Wkiol1hhnrwbj_huaabbliufepo716.png-wh_50 "/>


Because--ENGINE=MYISAM,INNODB is specified in the parameters, the 2 engines are benchmarked separately. The test results are probably translated as follows:

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/8C/17/wKiom1hhN4nQvq4dAAAcvg1pIIU885.png-wh_500x0-wm_3 -wmp_4-s_2939938876.png "title=" Msg.png "alt=" Wkiom1hhn4nqvq4daaacvg1piiu885.png-wh_50 "/>

Running the engine InnoDB
Average number of seconds to run all queries: 0.936 seconds
Minimum number of seconds to run all queries: 0.865 seconds
Maximum number of seconds to run all queries: 1.017 seconds
Number of connections to a running query: 100
Average number of 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 results are as follows:

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/8C/13/wKioL1hhOHfCRdKiAAHgn-mhC_o984.png-wh_500x0-wm_3 -wmp_4-s_2857753938.png "title="--only-print.png "alt=" Wkiol1hhohfcrdkiaahgn-mhc_o984.png-wh_50 "/>

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/8C/17/wKiom1hhOOvz4FvMAAEIC1S3-XE109.png-wh_500x0-wm_3 -wmp_4-s_2261787814.png "title="--only-print2.png "alt=" Wkiom1hhoovz4fvmaaeic1s3-xe109.png-wh_50 "/>


As you can see, it is actually creating a library and then automatically generating some SQL statements for inserting and querying to execute, to generate the test results, and then to delete the library.


Mysqlslap Common parameter Description:

1.--auto-generate-sql: Test automatically generated by the system SQL script
2.--auto-generate-sql-add-autoincrement increase the self-increment ID in the generated table
3.--atuo-generate-sql-load-type specifies the type of query used in the test
4.--auto-generate-sql-write-number Specifies the amount of data generated when initializing data
5.--concurrency: Specify the number of concurrent threads
6.--engine: Specify the storage engine to test the table, you can split multiple storage engines with commas
7,--no-drop: Specifies that the test data is not cleaned
8,--iterations: Specifies the number of test runs
9.--number-of-queries: Specify the number of queries executed per thread
--debug-info specify additional memory and CPU statistics for output
11.--number-int-cols: Specifies the number of columns in the test table that contain int types
12.--number-char-cols: Specifies the number of varchar types contained in the test table
--create-schema: Specifies the name of the database used to perform the test
--query, a script for specifying a custom SQL
,--Only-print does not run the test script, but prints the generated script

The use of Mysqlslap for MySQL common benchmark test tools

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.