1MYSQLSLAP(1)                 MySQL Database System                MYSQLSLAP(1)
2
3
4

NAME

6       mysqlslap - load emulation client
7

SYNOPSIS

9       mysqlslap [options]
10

DESCRIPTION

12       mysqlslap is a diagnostic program designed to emulate client load for a
13       MySQL server and to report the timing of each stage. It works as if
14       multiple clients are accessing the server.  mysqlslap is available as
15       of MySQL 5.1.4.
16
17       Invoke mysqlslap like this:
18
19           shell> mysqlslap [options]
20
21       Some options such as --create or --query enable you to specify a string
22       containing an SQL statement or a file containing statements. If you
23       specify a file, by default it must contain one statement per line.
24       (That is, the implicit statement delimiter is the newline character.)
25       Use the --delimiter option to specify a different delimiter, which
26       enables you to specify statements that span multiple lines or place
27       multiple statements on a single line. You cannot include comments in a
28       file; mysqlslap does not understand them.
29
30       mysqlslap runs in three stages:
31
32        1. Create schema, table, and optionally any stored programs or data
33           you want to using for the test. This stage uses a single client
34           connection.
35
36        2. Run the load test. This stage can use many client connections.
37
38        3. Clean up (disconnect, drop table if specified). This stage uses a
39           single client connection.
40
41       Examples:
42
43       Supply your own create and query SQL statements, with 50 clients
44       querying and 200 selects for each:
45
46           mysqlslap --delimiter=";" \
47             --create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)" \
48             --query="SELECT * FROM a" --concurrency=50 --iterations=200
49
50       Let mysqlslap build the query SQL statement with a table of two INT
51       columns and three VARCHAR columns. Use five clients querying 20 times
52       each. Do not create the table or insert the data (that is, use the
53       previous test´s schema and data):
54
55           mysqlslap --concurrency=5 --iterations=20 \
56             --number-int-cols=2 --number-char-cols=3 \
57             --auto-generate-sql
58
59       Tell the program to load the create, insert, and query SQL statements
60       from the specified files, where the create.sql file has multiple table
61       creation statements delimited by ´;´ and multiple insert statements
62       delimited by ´;´. The --query file will have multiple queries delimited
63       by ´;´. Run all the load statements, then run all the queries in the
64       query file with five clients (five times each):
65
66           mysqlslap --concurrency=5 \
67             --iterations=5 --query=query.sql --create=create.sql \
68             --delimiter=";"
69
70       mysqlslap supports the following options, which can be specified on the
71       command line or in the [mysqlslap] and [client] groups of an option
72       file.  mysqlslap also supports the options for processing option files
73       described at Section 4.2.3.3.1, “Command-Line Options that Affect
74       Option-File Handling”.
75
76       ·   --help, -?
77
78           Display a help message and exit.
79
80       ·   --auto-generate-sql, -a
81
82           Generate SQL statements automatically when they are not supplied in
83           files or using command options.
84
85       ·   --auto-generate-sql-add-autoincrement
86
87           Add an AUTO_INCREMENT column to automatically generated tables.
88           This option was added in MySQL 5.1.18.
89
90       ·   --auto-generate-sql-execute-number=N
91
92           Specify how many queries to generate automatically. This option was
93           added in MySQL 5.1.18.
94
95       ·   --auto-generate-sql-guid-primary
96
97           Add a GUID-based primary key to automatically generated tables.
98           This option was added in MySQL 5.1.18.
99
100       ·   --auto-generate-sql-load-type=type
101
102           Specify the test load type. The permissible values are read (scan
103           tables), write (insert into tables), key (read primary keys),
104           update (update primary keys), or mixed (half inserts, half scanning
105           selects). The default is mixed. This option was added in MySQL
106           5.1.16.
107
108       ·   --auto-generate-sql-secondary-indexes=N
109
110           Specify how many secondary indexes to add to automatically
111           generated tables. By default, none are added. This option was added
112           in MySQL 5.1.18.
113
114       ·   --auto-generate-sql-unique-query-number=N
115
116           How many different queries to generate for automatic tests. For
117           example, if you run a key test that performs 1000 selects, you can
118           use this option with a value of 1000 to run 1000 unique queries, or
119           with a value of 50 to perform 50 different selects. The default is
120           10. This option was added in MySQL 5.1.18.
121
122       ·   --auto-generate-sql-unique-write-number=N
123
124           How many different queries to generate for
125           --auto-generate-sql-write-number. The default is 10. This option
126           was added in MySQL 5.1.18.
127
128       ·   --auto-generate-sql-write-number=N
129
130           How many row inserts to perform on each thread. The default is 100.
131           This option was added in MySQL 5.1.16.
132
133       ·   --commit=N
134
135           How many statements to execute before committing. The default is 0
136           (no commits are done). This option was added in MySQL 5.1.21.
137
138       ·   --compress, -C
139
140           Compress all information sent between the client and the server if
141           both support compression.
142
143       ·   --concurrency=N, -c N
144
145           The number of clients to simulate when issuing the SELECT
146           statement.
147
148       ·   --create=value
149
150           The file or string containing the statement to use for creating the
151           table.
152
153       ·   --create-and-drop-schema=value
154
155           The schema in which to run the tests.  mysqlslap drops the schema
156           at the end of the test run. This option was added in MySQL 5.1.57.
157
158       ·   --create-schema=value
159
160           The schema in which to run the tests. This option was added in
161           MySQL 5.1.5.
162
163               Note
164               If the --auto-generate-sql option is also given, mysqlslap
165               drops the schema at the end of the test run. To avoid this, use
166               the --create-and-drop-schema option instead.
167
168       ·   --csv[=file_name]
169
170           Generate output in comma-separated values format. The output goes
171           to the named file, or to the standard output if no file is given.
172           This option was added in MySQL 5.1.5.
173
174       ·   --debug[=debug_options], -# [debug_options]
175
176           Write a debugging log. A typical debug_options string is
177           ´d:t:o,file_name´. The default is ´d:t:o,/tmp/mysqlslap.trace´.
178
179       ·   --debug-check
180
181           Print some debugging information when the program exits. This
182           option was added in MySQL 5.1.21.
183
184       ·   --debug-info, -T
185
186           Print debugging information and memory and CPU usage statistics
187           when the program exits. This option was added in MySQL 5.1.21.
188
189       ·   --delimiter=str, -F str
190
191           The delimiter to use in SQL statements supplied in files or using
192           command options.
193
194       ·   --detach=N
195
196           Detach (close and reopen) each connection after each N statements.
197           The default is 0 (connections are not detached). This option was
198           added in MySQL 5.1.21.
199
200       ·   --engine=engine_name, -e engine_name
201
202           The storage engine to use for creating tables.
203
204       ·   --host=host_name, -h host_name
205
206           Connect to the MySQL server on the given host.
207
208       ·   --iterations=N, -i N
209
210           The number of times to run the tests.
211
212       ·   --lock-directory=path
213
214           The directory to use for storing locks. This option was added in
215           MySQL 5.1.5 and removed in 5.1.18.
216
217       ·   --number-char-cols=N, -x N
218
219           The number of VARCHAR columns to use if --auto-generate-sql is
220           specified.
221
222       ·   --number-int-cols=N, -y N
223
224           The number of INT columns to use if --auto-generate-sql is
225           specified.
226
227       ·   --number-of-queries=N
228
229           Limit each client to approximately this many queries. Query
230           counting takes into account the statement delimiter. For example,
231           if you invoke mysqlslap as follows, the ; delimiter is recognized
232           so that each instance of the query string counts as two queries. As
233           a result, 5 rows (not 10) are inserted.
234
235               shell> mysqlslap --delimiter=";" --number-of-queries=10
236                        --query="use test;insert into t values(null)"
237
238           This option was added in MySQL 5.1.5.
239
240       ·   --only-print
241
242           Do not connect to databases.  mysqlslap only prints what it would
243           have done. This option was added in MySQL 5.1.5.
244
245       ·   --password[=password], -p[password]
246
247           The password to use when connecting to the server. If you use the
248           short option form (-p), you cannot have a space between the option
249           and the password. If you omit the password value following the
250           --password or -p option on the command line, mysqlslap prompts for
251           one.
252
253           Specifying a password on the command line should be considered
254           insecure. See Section 5.3.2.2, “End-User Guidelines for Password
255           Security”. You can use an option file to avoid giving the password
256           on the command line.
257
258       ·   --pipe, -W
259
260           On Windows, connect to the server using a named pipe. This option
261           applies only if the server supports named-pipe connections.
262
263       ·   --port=port_num, -P port_num
264
265           The TCP/IP port number to use for the connection.
266
267       ·   --post-query=value
268
269           The file or string containing the statement to execute after the
270           tests have completed. This execution is not counted for timing
271           purposes. This option was added in MySQL 5.1.18.
272
273       ·   --shared-memory-base-name=name
274
275           On Windows, the shared-memory name to use, for connections made
276           using shared memory to a local server. This option applies only if
277           the server supports shared-memory connections.
278
279       ·   --post-system=str
280
281           The string to execute using system() after the tests have
282           completed. This execution is not counted for timing purposes. This
283           option was added in MySQL 5.1.21.
284
285       ·   --pre-query=value
286
287           The file or string containing the statement to execute before
288           running the tests. This execution is not counted for timing
289           purposes. This option was added in MySQL 5.1.18.
290
291       ·   --pre-system=str
292
293           The string to execute using system() before running the tests. This
294           execution is not counted for timing purposes. This option was added
295           in MySQL 5.1.21.
296
297       ·   --preserve-schema
298
299           Preserve the schema from the mysqlslap run. The --auto-generate-sql
300           and --create options disable this option. This option was added in
301           MySQL 5.1.5 and removed in MySQL 5.1.23.
302
303       ·   --protocol={TCP|SOCKET|PIPE|MEMORY}
304
305           The connection protocol to use for connecting to the server. It is
306           useful when the other connection parameters normally would cause a
307           protocol to be used other than the one you want. For details on the
308           permissible values, see Section 4.2.2, “Connecting to the MySQL
309           Server”.
310
311       ·   --query=value, -q value
312
313           The file or string containing the SELECT statement to use for
314           retrieving data.
315
316       ·   --silent, -s
317
318           Silent mode. No output.
319
320       ·   --slave
321
322           Follow master locks for other mysqlslap clients. Use this option if
323           you are trying to synchronize around one master server with
324           --lock-directory plus NFS. This option was added in MySQL 5.1.5 and
325           removed in 5.1.18.
326
327       ·   --socket=path, -S path
328
329           For connections to localhost, the Unix socket file to use, or, on
330           Windows, the name of the named pipe to use.
331
332       ·   --ssl*
333
334           Options that begin with --ssl specify whether to connect to the
335           server using SSL and indicate where to find SSL keys and
336           certificates. See Section 5.5.6.3, “SSL Command Options”.
337
338       ·   --use-threads
339
340           On Unix, the default is to use fork() calls and this option causes
341           pthread calls to be used instead. (On Windows, the default is to
342           use pthread calls and the option has no effect.) This option was
343           added in MySQL 5.1.6 and removed in 5.1.18.
344
345       ·   --user=user_name, -u user_name
346
347           The MySQL user name to use when connecting to the server.
348
349       ·   --verbose, -v
350
351           Verbose mode. Print more information about what the program does.
352           This option can be used multiple times to increase the amount of
353           information.
354
355       ·   --version, -V
356
357           Display version information and exit.
358
360       Copyright © 1997, 2011, Oracle and/or its affiliates. All rights
361       reserved.
362
363       This documentation is free software; you can redistribute it and/or
364       modify it only under the terms of the GNU General Public License as
365       published by the Free Software Foundation; version 2 of the License.
366
367       This documentation is distributed in the hope that it will be useful,
368       but WITHOUT ANY WARRANTY; without even the implied warranty of
369       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
370       General Public License for more details.
371
372       You should have received a copy of the GNU General Public License along
373       with the program; if not, write to the Free Software Foundation, Inc.,
374       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
375       http://www.gnu.org/licenses/.
376
377

SEE ALSO

379       For more information, please refer to the MySQL Reference Manual, which
380       may already be installed locally and which is also available online at
381       http://dev.mysql.com/doc/.
382

AUTHOR

384       Oracle Corporation (http://dev.mysql.com/).
385
386
387
388MySQL 5.1                         10/26/2011                      MYSQLSLAP(1)
Impressum