Mysqlslap can be used to simulate server loads and output timing information. It is included in the release package of MySQL5.1. During testing, you can specify the number of concurrent connections or
Mysqlslap can be used to simulate server loads and output timing information. It is included in the MySQL 5.1 release package. During testing, you can specify the number of concurrent connections or
Mysqlslap can be used to simulate server loads and output timing information. It is included in the MySQL 5.1 release package. During testing, you can specify the number of concurrent connections and SQL statements. If no SQL statement is specified, mysqlslap automatically generates the SELECT statement for schema query.
Related reading:
Mysqlslap stress testing tool
Detailed description of MySQL performance stress testing tool mysqlslap
1. View help information.
[Root @ Betty libmysql] # mysqlslap -- help
Mysqlslap Ver 1.0 Distrib 5.6.10, for Linux (x86_64)
Copyright (c) 2005,201 3, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Run a query multiple times against the server.
Usage: mysqlslap [OPTIONS]
Default options are read from the following files in the given order:
/Etc/my. cnf/etc/mysql/my. cnf/usr/local/mysql/etc/my. cnf ~ /. My. cnf
The following groups are read: mysqlslap client
The following options may be given as the first argument:
-- Print-defaults Print the program argument list and exit.
-- No-defaults Don't read default options from any option file,
Cannot t for login file.
-- Defaults-file = # Only read default options from the given file #.
-- Defaults-extra-file = # Read this file after the global files are read.
-- Defaults-group-suffix = #
Also read groups with concat (group, suffix)
-- Login-path = # Read this path from the login file.
-?, -- Help Display this help and exit.
-A, -- auto-generate-SQL automatically generates test tables and data
Generate SQL where not supplied by file or command line.
-- Auto-generate-SQL-add-autoincrement add auto_increment Column
Add an AUTO_INCREMENT column to auto-generated tables.
-- Auto-generate-SQL-execute-number = # number of automatically generated queries
Set this number to generate a set number of queries
Run.
-- Auto-generate-SQL-guid-primary adds a GUID-based primary key.
Add GUID based primary keys to auto-generated tables.
-- Auto-generate-SQL-load-type = name indicates the type of the test statement. Optional values: read, key, write, update, and mixed (default)
Read: Query write: Insert key: read Primary key update: update primary key mixed: insert half Query
Specify test load type: mixed, update, write, key, or
Read; default is mixed.
-- Auto-generate-SQL-secondary-indexes = # increase the number of secondary indexes. The default value is 0.
Number of secondary indexes to add to auto-generated
Tables.
-- Auto-generate-SQL-unique-query-number = # number of Different queries. The default value is 10.
Number of unique queries to generate for automatic tests.
-- Auto-generate-SQL-unique-write-number = # The number of different inserts. The default value is 100.
Number of unique queries to generate
Auto-generate-SQL-write-number.
-- Auto-generate-SQL-write-number = #
Number of row inserts to perform for each thread (default
Is 100 ).
-- Commit = # How many DML records are submitted once?
Commit records every X number of statements.
-C, -- compress: if both the server and client support compression, the compressed information is transmitted.
Use compression in server/client protocol.
-C, -- concurrency = name: Simulate N clients to execute the select statement concurrently. Multiple values can be specified. Use commas (,) or the value specified by the -- delimiter parameter as the delimiter.
Number of clients to simulate for query to run.
-- Create = name specifies the. SQL file or string used to create the table.
File or string to use create tables.
-- Create-schema = name specifies the name of the database to be tested. in MySQL, schema is the database. The default value is mysqlslap.
Schema to run tests in.
-- Csv [= name] Generate CSV output to named file or to stdout if no file
Is named.
-#, -- Debug [= #] This is a non-debug version. Catch this and exit.
-- Debug-check memory and open file usage at exit.
-T, -- debug-info prints memory and CPU Information
Print some debug info at exit.
-- Default-auth = name Default authentication client-side plugin to use.
-F, -- delimiter = name: the SQL statement in the file uses the delimiter.
Delimiter to use in SQL statements supplied in file or
Command line.
-- Detach = # after each execution of N statements, the connection is closed and then re-opened.
Detach (close and reopen) connections after X number
Requests.
-- Enable-cleartext-plugin
Enable/disable the clear text authentication plugin.
-E, -- engine = name: The storage engine used to create the test table. You can specify multiple
Storage engine to use for creating the table.
-H, -- host = name Connect to host.
-I, -- iterations = # number of iterations
Number of times to run the tests.
-- No-drop Do not drop the schema after the test.
-X, -- number-char-cols = name: the number of columns in the test table that are automatically generated. The default value is 1.
Number of VARCHAR columns to create in table if
Specifying -- auto-generate-SQL.
-Y, -- number-int-cols = name: the number of columns in the test table that are automatically generated. The default value is 1.
Number of INT columns to create in table if specifying
-- Auto-generate-SQL.
-- Number-of-queries = # Total number of test queries (number of concurrent customers × number of queries per customer)
Limit each client to this number of queries (this is not
Exact ).
-- Only-print only outputs the simulated execution results, not actually executed
Do not connect to the databases, but instead print out
What wocould have been done.
-P, -- password [= name]
Password to use when connecting to server. If password is
Not given it's asked from the tty.
-- Plugin-dir = name Directory for client-side plugins.
-P, -- port = # Port number to use for connection.
-- Post-query = name: the file or string of the SQL statement executed after the test is completed. This process does not affect time calculation.
Query to run or file containing query to execute after
Tests have completed.
-- Post-system = name: The system statement executed after the test is completed. This process does not affect time calculation.
System () string to execute after tests have completed.
-- Pre-query = name: the file or string of the SQL statement executed before the test is executed. This process does not affect time calculation.
Query to run or file containing query to execute before
Running tests.
-- Pre-system = name: The system statement executed before the test is executed. This process does not affect time calculation.
System () string to execute before running tests.
-- Protocol = name The protocol to use for connection (tcp, socket, pipe,
Memory ).
-Q, -- query = name: Specify the custom. SQL script to run the test. For example, you can call a custom stored procedure or SQL statement to perform the test.
Query to run or file containing query to run.
-S, -- silent does not output
Run program in silent mode-no output.
-S, -- socket = name The socket file to use for connection.
-- Ssl Enable SSL for connection (automatically enabled
Other flags ).
-- Ssl-ca = name CA file in PEM format (check OpenSSL docs, implies
-- Ssl ).
-- Ssl-capath = name CA directory (check OpenSSL docs, implies -- ssl ).
-- Ssl-cert = name X509 cert in PEM format (implies -- ssl ).
-- Ssl-cipher = name SSL cipher to use (implies -- ssl ).
-- Ssl-key = name X509 key in PEM format (implies -- ssl ).
-- Ssl-crl = name Certificate revocation list (implies -- ssl ).
-- Ssl-crlpath = name Certificate revocation list path (implies -- ssl ).
-- Ssl-verify-server-cert
Verify server's "Common Name" in its cert against
Hostname used when connecting. This option is disabled
Default.
-U, -- user = name User for login if not current user.
-V, -- verbose output more information
More verbose output; you can use this multiple times
Get even more verbose output.
-V, -- version Output version information and exit.
[Root @ Betty libmysql] #