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] option file groups.
72       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 via 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 allowable 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-schema=value
154
155           The schema in which to run the tests. This option was added in
156           MySQL 5.1.5.
157
158       ·   --csv[=file_name]
159
160           Generate output in comma-separated values format. The output goes
161           to the named file, or to the standard output if no file is given.
162           This option was added in MySQL 5.1.5.
163
164       ·   --debug[=debug_options], -# [debug_options]
165
166           Write a debugging log. A typical debug_options string is
167           ´d:t:o,file_name´. The default is ´d:t:o,/tmp/mysqlslap.trace´.
168
169       ·   --debug-check
170
171           Print some debugging information when the program exits. This
172           option was added in MySQL 5.1.21.
173
174       ·   --debug-info, -T
175
176           Print debugging information and memory and CPU usage statistics
177           when the program exits. This option was added in MySQL 5.1.21.
178
179       ·   --defaults-extra-file=filename
180
181           Set filename as the file to read default options from after the
182           global defaults files has been read.  Must be given as first
183           option.
184
185       ·   --defaults-file=filename
186
187           Set filename as the file to read default options from, override
188           global defaults files.  Must be given as first option.
189
190       ·   --delimiter=str, -F str
191
192           The delimiter to use in SQL statements supplied in files or via
193           command options.
194
195       ·   --detach=N
196
197           Detach (close and reopen) each connection after each N statements.
198           The default is 0 (connections are not detached). This option was
199           added in MySQL 5.1.21.
200
201       ·   --engine=engine_name, -e engine_name
202
203           The storage engine to use for creating tables.
204
205       ·   --host=host_name, -h host_name
206
207           Connect to the MySQL server on the given host.
208
209       ·   --init-command=str
210
211           SQL Command to execute when connecting to MySQL server. Will
212           automatically be re-executed when reconnecting.
213
214       ·   --iterations=N, -i N
215
216           The number of times to run the tests.
217
218       ·   --lock-directory=path
219
220           The directory to use for storing locks. This option was added in
221           MySQL 5.1.5 and removed in 5.1.18.
222
223       ·   --no-defaults
224
225           Do not read default options from any option file. This must be
226           given as the first argument.
227
228       ·   --no-drop
229
230           Do not drop the schema after the test.
231
232       ·   --number-char-cols=N, -x N
233
234           The number of VARCHAR columns to use if --auto-generate-sql is
235           specified.
236
237       ·   --number-int-cols=N, -y N
238
239           The number of INT columns to use if --auto-generate-sql is
240           specified.
241
242       ·   --number-of-queries=N
243
244           Limit each client to approximately this many queries. Query
245           counting takes into account the statement delimiter. For example,
246           if you invoke mysqlslap as follows, the ; delimiter is recognized
247           so that each instance of the query string counts as two queries. As
248           a result, 5 rows (not 10) are inserted.
249
250               shell> mysqlslap --delimiter=";" --number-of-queries=10
251                        --query="use test;insert into t values(null)"
252
253           This option was added in MySQL 5.1.5.
254
255       ·   --only-print
256
257           Do not connect to databases.  mysqlslap only prints what it would
258           have done. This option was added in MySQL 5.1.5.
259
260       ·   --password[=password], -p[password]
261
262           The password to use when connecting to the server. If you use the
263           short option form (-p), you cannot have a space between the option
264           and the password. If you omit the password value following the
265           --password or -p option on the command line, mysqlslap prompts for
266           one.
267
268           Specifying a password on the command line should be considered
269           insecure. See Section 5.3.2.2, “End-User Guidelines for Password
270           Security”. You can use an option file to avoid giving the password
271           on the command line.
272
273       ·   --pipe, -W
274
275           On Windows, connect to the server via a named pipe. This option
276           applies only if the server supports named-pipe connections.
277
278       ·   --port=port_num, -P port_num
279
280           The TCP/IP port number to use for the connection.
281
282       ·   --post-query=value
283
284           The file or string containing the statement to execute after the
285           tests have completed. This execution is not counted for timing
286           purposes. This option was added in MySQL 5.1.18.
287
288       ·   --shared-memory-base-name=name
289
290           On Windows, the shared-memory name to use, for connections made via
291           shared memory to a local server. This option applies only if the
292           server supports shared-memory connections.
293
294       ·   --print-defaults
295
296           Print the program argument list and exit.  This must be given as
297           the first argument.
298
299       ·   --post-system=str
300
301           The string to execute via system() after the tests have completed.
302           This execution is not counted for timing purposes. This option was
303           added in MySQL 5.1.21.
304
305       ·   --pre-query=value
306
307           The file or string containing the statement to execute before
308           running the tests. This execution is not counted for timing
309           purposes. This option was added in MySQL 5.1.18.
310
311       ·   --pre-system=str
312
313           The string to execute via system() before running the tests. This
314           execution is not counted for timing purposes. This option was added
315           in MySQL 5.1.21.
316
317       ·   --preserve-schema
318
319           Preserve the schema from the mysqlslap run. The --auto-generate-sql
320           and --create options disable this option. This option was added in
321           MySQL 5.1.5 and removed in MySQL 5.1.23.
322
323       ·   --protocol={TCP|SOCKET|PIPE|MEMORY}
324
325           The connection protocol to use for connecting to the server. It is
326           useful when the other connection parameters normally would cause a
327           protocol to be used other than the one you want. For details on the
328           allowable values, see Section 4.2.2, “Connecting to the MySQL
329           Server”.
330
331       ·   --query=value, -q value
332
333           The file or string containing the SELECT statement to use for
334           retrieving data.
335
336       ·   --silent, -s
337
338           Silent mode. No output.
339
340       ·   --slave
341
342           Follow master locks for other mysqlslap clients. Use this option if
343           you are trying to synchronize around one master server with
344           --lock-directory plus NFS. This option was added in MySQL 5.1.5 and
345           removed in 5.1.18.
346
347       ·   --socket=path, -S path
348
349           For connections to localhost, the Unix socket file to use, or, on
350           Windows, the name of the named pipe to use.
351
352       ·   --ssl*
353
354           Options that begin with --ssl specify whether to connect to the
355           server via SSL and indicate where to find SSL keys and
356           certificates. See Section 5.5.6.3, “SSL Command Options”.
357
358       ·   --use-threads
359
360           On Unix, the default is to use fork() calls and this option causes
361           pthread calls to be used instead. (On Windows, the default is to
362           use pthread calls and the option has no effect.) This option was
363           added in MySQL 5.1.6 and removed in 5.1.18.
364
365       ·   --user=user_name, -u user_name
366
367           The MySQL user name to use when connecting to the server.
368
369       ·   --verbose, -v
370
371           Verbose mode. Print more information about what the program does.
372           This option can be used multiple times to increase the amount of
373           information.
374
375       ·   --version, -V
376
377           Display version information and exit.
378
380       Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
381
382       This documentation is free software; you can redistribute it and/or
383       modify it only under the terms of the GNU General Public License as
384       published by the Free Software Foundation; version 2 of the License.
385
386       This documentation is distributed in the hope that it will be useful,
387       but WITHOUT ANY WARRANTY; without even the implied warranty of
388       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
389       General Public License for more details.
390
391       You should have received a copy of the GNU General Public License along
392       with the program; if not, write to the Free Software Foundation, Inc.,
393       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
394       http://www.gnu.org/licenses/.
395
396

SEE ALSO

398       For more information, please refer to the MySQL Reference Manual, which
399       may already be installed locally and which is also available online at
400       http://dev.mysql.com/doc/.
401

AUTHOR

403       Sun Microsystems, Inc. (http://www.mysql.com/).
404
405
406
407MySQL 5.1                         04/06/2010                      MYSQLSLAP(1)
Impressum