1
.\" Title: \fBmysqlslap\fR
3
.\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/>
5
.\" Manual: MySQL Database System
8
.TH "\fBMYSQLSLAP\fR" "1" "05/23/2009" "MySQL 6.0" "MySQL Database System"
9
.\" disable hyphenation
11
.\" disable justification (adjust text to left margin only)
14
mysqlslap \- load emulation client
17
\fBmysqlslap [\fR\fB\fIoptions\fR\fR\fB]\fR
21
is a diagnostic program designed to emulate client load for a MySQL server and to report the timing of each stage. It works as if multiple clients are accessing the server.
29
shell> \fBmysqlslap [\fR\fB\fIoptions\fR\fR\fB]\fR
37
enable you to specify a string containing an SQL statement or a file containing statements. If you specify a file, by default it must contain one statement per line. (That is, the implicit statement delimiter is the newline character.) Use the
39
option to specify a different delimiter, which enables you to specify statements that span multiple lines or place multiple statements on a single line. You cannot include comments in a file;
41
does not understand them.
47
Create schema, table, and optionally any stored programs or data you want to using for the test. This stage uses a single client connection.
50
Run the load test. This stage can use many client connections.
53
Clean up (disconnect, drop table if specified). This stage uses a single client connection.
59
Supply your own create and query SQL statements, with 50 clients querying and 200 selects for each:
63
mysqlslap \-\-delimiter=";" \\
64
\-\-create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)" \\
65
\-\-query="SELECT * FROM a" \-\-concurrency=50 \-\-iterations=200
71
build the query SQL statement with a table of two
75
columns. Use five clients querying 20 times each. Do not create the table or insert the data (that is, use the previous test's schema and data):
79
mysqlslap \-\-concurrency=5 \-\-iterations=20 \\
80
\-\-number\-int\-cols=2 \-\-number\-char\-cols=3 \\
81
\-\-auto\-generate\-sql
85
Tell the program to load the create, insert, and query SQL statements from the specified files, where the
87
file has multiple table creation statements delimited by
89
and multiple insert statements delimited by
92
file will have multiple queries delimited by
93
\';'. Run all the load statements, then run all the queries in the query file with five clients (five times each):
97
mysqlslap \-\-concurrency=5 \\
98
\-\-iterations=5 \-\-query=query.sql \-\-create=create.sql \\
104
supports the options in the following list. It also reads option files and supports the options for processing them described at
105
Section\ 4.2.3.2.1, \(lqCommand\-Line Options that Affect Option\-File Handling\(rq.
111
Display a help message and exit.
114
\fB\-\-auto\-generate\-sql\fR,
117
Generate SQL statements automatically when they are not supplied in files or via command options.
120
\fB\-\-auto\-generate\-sql\-add\-autoincrement\fR
124
column to automatically generated tables.
127
\fB\-\-auto\-generate\-sql\-execute\-number=\fR\fB\fIN\fR\fR
129
Specify how many queries to generate automatically.
132
\fB\-\-auto\-generate\-sql\-guid\-primary\fR
134
Add a GUID\-based primary key to automatically generated tables.
137
\fB\-\-auto\-generate\-sql\-load\-type=\fR\fB\fItype\fR\fR
139
Specify the test load type. The allowable values are
143
(insert into tables),
147
(update primary keys), or
149
(half inserts, half scanning selects). The default is
153
\fB\-\-auto\-generate\-sql\-secondary\-indexes=\fR\fB\fIN\fR\fR
155
Specify how many secondary indexes to add to automatically generated tables. By default, none are added.
158
\fB\-\-auto\-generate\-sql\-select\-columns=\fR\fB\fIstr\fR\fR
160
The string to use for the select columns used in automatic tests. You can use this to determine the effect on performance of selecting or excluding particular columns. This option was added in MySQL 6.0.3.
163
\fB\-\-auto\-generate\-sql\-unique\-query\-number=\fR\fB\fIN\fR\fR
165
How many different queries to generate for automatic tests. For example, if you run a
167
test that performs 1000 selects, you can use this option with a value of 1000 to run 1000 unique queries, or with a value of 50 to perform 50 different selects. The default is 10.
170
\fB\-\-auto\-generate\-sql\-unique\-write\-number=\fR\fB\fIN\fR\fR
172
How many different queries to generate for
173
\fB\-\-auto\-generate\-sql\-write\-number\fR. The default is 10.
176
\fB\-\-auto\-generate\-sql\-write\-number=\fR\fB\fIN\fR\fR
178
How many row inserts to perform on each thread. The default is 100.
183
Run the full test case in an infinite loop. This option was added in MySQL 6.0.3.
186
\fB\-\-commit=\fR\fB\fIN\fR\fR
188
How many statements to execute before committing. The default is 0 (no commits are done).
194
Compress all information sent between the client and the server if both support compression.
197
\fB\-\-concurrency=\fR\fB\fIN\fR\fR,
198
\fB\-c \fR\fB\fIN\fR\fR
200
The number of clients to simulate when issuing the
205
\fB\-\-create=\fR\fB\fIvalue\fR\fR
207
The file or string containing the statement to use for creating the table.
210
\fB\-\-create\-schema=\fR\fB\fIvalue\fR\fR
212
The schema in which to run the tests.
215
\fB\-\-csv[=\fR\fB\fIfile_name\fR\fR\fB]\fR
217
Generate output in comma\-separated values format. The output goes to the named file, or to the standard output if no file is given.
220
\fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR,
221
\fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR
223
Write a debugging log. A typical
226
\'d:t:o,\fIfile_name\fR'. The default is
227
\'d:t:o,/tmp/mysqlslap.trace'.
230
\fB\-\-debug\-check\fR
232
Print some debugging information when the program exits.
235
\fB\-\-debug\-info\fR,
238
Print debugging information and memory and CPU usage statistics when the program exits.
241
\fB\-\-delimiter=\fR\fB\fIstr\fR\fR,
242
\fB\-F \fR\fB\fIstr\fR\fR
244
The delimiter to use in SQL statements supplied in files or via command options.
247
\fB\-\-delayed\-start=\fR\fB\fIN\fR\fR
249
The maximum delay in microseconds. Startup of each thread is delayed by a random number of microseconds up to this maximum. The default is 0. This option was added in MySQL 6.0.3.
252
\fB\-\-detach=\fR\fB\fIN\fR\fR
254
Detach (close and reopen) each connection after each
256
statements. The default is 0 (connections are not detached).
259
\fB\-\-engine=\fR\fB\fIengine_name\fR\fR,
260
\fB\-e \fR\fB\fIengine_name\fR\fR
262
The storage engine to use for creating tables.
265
\fB\-\-host=\fR\fB\fIhost_name\fR\fR,
266
\fB\-h \fR\fB\fIhost_name\fR\fR
268
Connect to the MySQL server on the given host.
271
\fB\-\-ignore\-sql\-errors\fR
273
Ignore SQL errors during the test run. By default, errors cause
275
to exit. This option was added in MySQL 6.0.4.
278
\fB\-\-iterations=\fR\fB\fIN\fR\fR,
279
\fB\-i \fR\fB\fIN\fR\fR
281
The number of times to run the tests.
284
\fB\-\-label=\fR\fB\fIstr\fR\fR
286
The label to use in printed and CSV output. This option was added in MySQL 6.0.3.
289
\fB\-\-number\-blob\-cols=\fR\fB\fIstr\fR\fR,
294
\fB\-\-auto\-generate\-sql\fR
296
\fB\-\-number\-blob\-cols=3:1024/2048\fR
299
columns with a random size between 1024 and 2048. This option was added in MySQL 6.0.3.
302
\fB\-\-number\-char\-cols=\fR\fB\fIN\fR\fR,
303
\fB\-x \fR\fB\fIN\fR\fR
308
\fB\-\-auto\-generate\-sql\fR
312
\fB\-\-number\-int\-cols=\fR\fB\fIN\fR\fR,
313
\fB\-y \fR\fB\fIN\fR\fR
318
\fB\-\-auto\-generate\-sql\fR
322
\fB\-\-number\-of\-queries=\fR\fB\fIN\fR\fR
324
Limit each client to approximately this number of queries.
327
\fB\-\-only\-print\fR
329
Do not connect to databases.
331
only prints what it would have done.
334
\fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR,
335
\fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR
337
The password to use when connecting to the server. If you use the short option form (\fB\-p\fR), you
339
have a space between the option and the password. If you omit the
345
option on the command line, you are prompted for one.
347
Specifying a password on the command line should be considered insecure. See
348
Section\ 5.5.6.2, \(lqEnd\-User Guidelines for Password Security\(rq.
354
On Windows, connect to the server via a named pipe. This option applies only for connections to a local server, and only if the server supports named\-pipe connections.
357
\fB\-\-port=\fR\fB\fIport_num\fR\fR,
358
\fB\-P \fR\fB\fIport_num\fR\fR
360
The TCP/IP port number to use for the connection.
363
\fB\-\-post\-query=\fR\fB\fIvalue\fR\fR
365
The file or string containing the statement to execute after the tests have completed. This execution is not counted for timing purposes.
368
\fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR
370
On Windows, the shared\-memory name to use, for connections made via shared memory to a local server. This option applies only if the server supports shared\-memory connections.
373
\fB\-\-post\-system=\fR\fB\fIstr\fR\fR
375
The string to execute via
377
after the tests have completed. This execution is not counted for timing purposes.
380
\fB\-\-pre\-query=\fR\fB\fIvalue\fR\fR
382
The file or string containing the statement to execute before running the tests. This execution is not counted for timing purposes. This option was added in MySQL 5.1.18.
385
\fB\-\-pre\-system=\fR\fB\fIstr\fR\fR
387
The string to execute via
389
before running the tests. This execution is not counted for timing purposes.
392
\fB\-\-preserve\-schema\fR
394
Preserve the schema from the
397
\fB\-\-auto\-generate\-sql\fR
400
options disable this option. This option was removed in MySQL 6.0.5.
403
\fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR
405
The connection protocol to use for connecting to the server. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want. For details on the allowable values, see
406
Section\ 4.2.2, \(lqConnecting to the MySQL Server\(rq.
409
\fB\-\-query=\fR\fB\fIvalue\fR\fR,
410
\fB\-q \fR\fB\fIvalue\fR\fR
412
The file or string containing the
414
statement to use for retrieving data.
417
\fB\-\-set\-random\-seed=\fR\fB\fIvalue\fR\fR,
419
The seed value for the randomizer.
425
Silent mode. No output.
430
Follow master locks for other
432
clients. Use this option if you are trying to synchronize around one master server with
433
\fB\-\-lock\-directory\fR
437
\fB\-\-socket=\fR\fB\fIpath\fR\fR,
438
\fB\-S \fR\fB\fIpath\fR\fR
441
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use.
446
Options that begin with
448
specify whether to connect to the server via SSL and indicate where to find SSL keys and certificates. See
449
Section\ 5.5.7.3, \(lqSSL Command Options\(rq.
452
\fB\-\-timer\-length=\fR\fB\fIN\fR\fR
454
The duration in seconds to run each test. Tests that run longer are terminated. This option was added in MySQL 6.0.3.
457
\fB\-\-user=\fR\fB\fIuser_name\fR\fR,
458
\fB\-u \fR\fB\fIuser_name\fR\fR
460
The MySQL user name to use when connecting to the server.
466
Verbose mode. Print more information about what the program does. This option can be used multiple times to increase the amount of information.
472
Display version information and exit.
475
Copyright 2007\-2008 MySQL AB, 2009 Sun Microsystems, Inc.
477
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
479
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
481
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110\-1301 USA or see http://www.gnu.org/licenses/.
483
For more information, please refer to the MySQL Reference Manual,
484
which may already be installed locally and which is also available
485
online at http://dev.mysql.com/doc/.
487
Sun Microsystems, Inc. (http://www.mysql.com/).