First, Mysqlslap Introduction
Mysqlslap is a MySQL5.1 benchmark benchmarking tool, similar to the Apache Bench load generation tool, which generates schemas, loads data, executes Benckmark and queries data, is simple, flexible, and easy to use. The tool can simulate multiple clients concurrently to issue query updates to the server, give performance test data and provide a variety of engine performance comparisons. Mysqlslap for MySQL performance optimization before and after providing intuitive verification basis, the author suggested that the system operators should master some common pressure testing tools, so as to more accurately grasp the online system can support the user flow limit and the pressure resistance and so on.
Ii. Introduction of parameters
--AUTO-GENERATE-SQL-A automatically generate MySQL test statements--auto-generate-sql-add-autoincrement add auto_increment fields--auto-gener Number of ate-sql-execute-number=# queries--auto-generate-sql-guid-primary add GUID field--auto-generate-sql-load-type=name Mixed: Mixed, update: Update, write: Write, key: read: Query--auto-generate-sql-secondary-indexes=# set Index field number-- auto-generate-sql-unique-query-number=# generate n different query SQL statements--auto-generate-sql-unique-write-number=# generate n different write SQL Statement--auto-generate-sql-write-number=# the number of SQL statements per thread--commit=# set each number of SQL statements submitted once--compress -C Enable Compression protocol--concurrency=#-C client Number (concurrency)--CREATE=NAME test SQL statement or file--creat E-schema=name test Data name--csv=name production CSV format data file--debug-# write debug log (Windows not available) such as: Mysqlslap-a-# "D:t:o,c:/debug.txt"--debug-check print debugging information after testing (Windows is not available)--debug-info-t Print memory and CPU related information--default-auth=plugin verification interpolationThe--DELIMITER=STR-F statement delimiter is the default; --detach=# after executing n statements disconnect--enable-cleartext-plugin enable plaintext authentication plug-in--ENGINE=ENGINE_NAME-E test Test engine such as: Mysqlslap-e "MyISAM" or "e-myisam,innodb"--help Help information--host=host_name-h database host--iter ations=#-I repeated run times--login-path=name login Profile--no-drop Test does not delete schema--number- char-cols=#-X Sets the number of varchar type fields--number-int-cols=#-y Sets the number of fields of type int--number-of-queries=# per A client runs the number of SQL statements--only-print only shows the SQL statement that will be run--delimiter option affects--password=password-p database password--pipe Enable pipe--plugin-dir=path Plug-in directory--port=port_num-p database Port--post-query=value The SQL statement executed after the test--POST-SYSTEM=STR the system statement executed after the test--pre-query=value the SQL statement executed before the test--pre-system=str System statements executed before testing--protocol=type link protocol TCP, socket, pipe--query=value-q Test SQL statements such as: Mysqlslap--query= "SELECT * from T1"--secure-auth do not send password to server--silent-s Do not show test (mute test)--socket=path-s Connection server socket--ssl-ca=file_name--ssl-capath=dir_name--ssl-cert=
file_name--ssl-cipher=cipher_list--ssl-crl=file_name--ssl-crlpath=dir_name--ssl-key=file_name --ssl-verify-server-cert--user=user_name-u database username--verbose-v output more information--version-v Version information
Three, simple example
1. Test 100, 200, 400 concurrent execute 10w SQL.
Note: The time it takes to report the output is mainly the time spent executing the query specified by –number-of-queries, where 100 concurrent, 200 concurrent, 400 concurrent executions of 10w call were performed. The default does not specify that the –iterations represents a repeat operation, and that the time it takes to repeat n this output is also a reaction to the time spent in a single cycle.
2. Generate CSV
Mysqlslap-a-E "Myisam,innodb"--csv= "C:/a.csv"
Iv. Summary
Mysqlslap mainly for the performance test of the database, and the automatic testing function is limited, and production reports are not detailed enough, so it is recommended to use Sysbench to do benchmark tests. The above is about Mysqlslap all introduction, hope to everyone's study or work to bring certain help, if there is doubt you can message exchange.