1MYSQLSLAP(1) MariaDB Database System MYSQLSLAP(1)
2
3
4
6 mysqlslap - load emulation client
7
9 mysqlslap [options]
10
12 mysqlslap is a diagnostic program designed to emulate client load for a
13 MariaDB server and to report the timing of each stage. It works as if
14 multiple clients are accessing the server.
15
16 Invoke mysqlslap like this:
17
18 shell> mysqlslap [options]
19
20 Some options such as --create or --query enable you to specify a string
21 containing an SQL statement or a file containing statements. If you
22 specify a file, by default it must contain one statement per line.
23 (That is, the implicit statement delimiter is the newline character.)
24 Use the --delimiter option to specify a different delimiter, which
25 enables you to specify statements that span multiple lines or place
26 multiple statements on a single line. You cannot include comments in a
27 file; mysqlslap does not understand them.
28
29 mysqlslap runs in three stages:
30
31 1. Create schema, table, and optionally any stored programs or data
32 you want to using for the test. This stage uses a single client
33 connection.
34
35 2. Run the load test. This stage can use many client connections.
36
37 3. Clean up (disconnect, drop table if specified). This stage uses a
38 single client connection.
39
40 Examples:
41
42 Supply your own create and query SQL statements, with 50 clients
43 querying and 200 selects for each:
44
45 mysqlslap --delimiter=";" \
46 --create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)" \
47 --query="SELECT * FROM a" --concurrency=50 --iterations=200
48
49 Let mysqlslap build the query SQL statement with a table of two INT
50 columns and three VARCHAR columns. Use five clients querying 20 times
51 each. Do not create the table or insert the data (that is, use the
52 previous test´s schema and data):
53
54 mysqlslap --concurrency=5 --iterations=20 \
55 --number-int-cols=2 --number-char-cols=3 \
56 --auto-generate-sql
57
58 Tell the program to load the create, insert, and query SQL statements
59 from the specified files, where the create.sql file has multiple table
60 creation statements delimited by ´;´ and multiple insert statements
61 delimited by ´;´. The --query file will have multiple queries delimited
62 by ´;´. Run all the load statements, then run all the queries in the
63 query file with five clients (five times each):
64
65 mysqlslap --concurrency=5 \
66 --iterations=5 --query=query.sql --create=create.sql \
67 --delimiter=";"
68
69 mysqlslap supports the following options, which can be specified on the
70 command line or in the [mysqlslap] and [client] option file groups.
71 mysqlslap also supports the options for processing option files.
72
73 • --help, -?
74
75 Display a help message and exit.
76
77 • --auto-generate-sql, -a
78
79 Generate SQL statements automatically when they are not supplied in
80 files or via command options.
81
82 • --auto-generate-sql-add-autoincrement
83
84 Add an AUTO_INCREMENT column to automatically generated tables.
85
86 • --auto-generate-sql-execute-number=N
87
88 Specify how many queries to generate automatically.
89
90 • --auto-generate-sql-guid-primary
91
92 Add a GUID-based primary key to automatically generated tables.
93
94 • --auto-generate-sql-load-type=type
95
96 Specify the test load type. The allowable values are read (scan
97 tables), write (insert into tables), key (read primary keys),
98 update (update primary keys), or mixed (half inserts, half scanning
99 selects). The default is mixed.
100
101 • --auto-generate-sql-secondary-indexes=N
102
103 Specify how many secondary indexes to add to automatically
104 generated tables. By default, none are added.
105
106 • --auto-generate-sql-unique-query-number=N
107
108 How many different queries to generate for automatic tests. For
109 example, if you run a key test that performs 1000 selects, you can
110 use this option with a value of 1000 to run 1000 unique queries, or
111 with a value of 50 to perform 50 different selects. The default is
112 10.
113
114 • --auto-generate-sql-unique-write-number=N
115
116 How many different queries to generate for
117 --auto-generate-sql-write-number. The default is 10.
118
119 • --auto-generate-sql-write-number=N
120
121 How many row inserts to perform on each thread. The default is 100.
122
123 • --commit=N
124
125 How many statements to execute before committing. The default is 0
126 (no commits are done).
127
128 • --compress, -C
129
130 Compress all information sent between the client and the server if
131 both support compression.
132
133 • --concurrency=N, -c N
134
135 The number of clients to simulate when issuing the SELECT
136 statement.
137
138 • --create=value
139
140 The file or string containing the statement to use for creating the
141 table.
142
143 • --create-schema=value
144
145 The schema in which to run the tests.
146
147 • --csv[=file_name]
148
149 Generate output in comma-separated values format. The output goes
150 to the named file, or to the standard output if no file is given.
151
152 • --debug[=debug_options], -# [debug_options]
153
154 Write a debugging log. A typical debug_options string is
155 ´d:t:o,file_name´. The default is ´d:t:o,/tmp/mysqlslap.trace´.
156
157 • --debug-check
158
159 Print some debugging information when the program exits.
160
161 • --debug-info, -T
162
163 Print debugging information and memory and CPU usage statistics
164 when the program exits.
165
166 • --default-auth=name
167
168 Default authentication client-side plugin to use.
169
170 • --defaults-extra-file=filename
171
172 Set filename as the file to read default options from after the
173 global defaults files has been read. Must be given as first
174 option.
175
176 • --defaults-file=filename
177
178 Set filename as the file to read default options from, override
179 global defaults files. Must be given as first option.
180
181 • --delimiter=str, -F str
182
183 The delimiter to use in SQL statements supplied in files or via
184 command options.
185
186 • --detach=N
187
188 Detach (close and reopen) each connection after each N statements.
189 The default is 0 (connections are not detached).
190
191 • --engine=engine_name, -e engine_name
192
193 Comma separated list of storage engines to use for creating the
194 table. The test is run for each engine. You can also specify an
195 option for an engine after a colon, for example
196 memory:max_row=2300.
197
198 • --host=host_name, -h host_name
199
200 Connect to the MariaDB server on the given host.
201
202 • --init-command=str
203
204 SQL Command to execute when connecting to MariaDB server. Will
205 automatically be re-executed when reconnecting.
206
207 • --iterations=N, -i N
208
209 The number of times to run the tests.
210
211 • --no-defaults
212
213 Do not read default options from any option file. This must be
214 given as the first argument.
215
216 • --no-drop
217
218 Do not drop any schema created during the test after the test is
219 complete.
220
221 • --number-char-cols=N, -x N
222
223 The number of VARCHAR columns to use if --auto-generate-sql is
224 specified.
225
226 • --number-int-cols=N, -y N
227
228 The number of INT columns to use if --auto-generate-sql is
229 specified.
230
231 • --number-of-queries=N
232
233 Limit each client to approximately this many queries. Query
234 counting takes into account the statement delimiter. For example,
235 if you invoke mysqlslap as follows, the ; delimiter is recognized
236 so that each instance of the query string counts as two queries. As
237 a result, 5 rows (not 10) are inserted.
238
239 shell> mysqlslap --delimiter=";" --number-of-queries=10
240 --query="use test;insert into t values(null)"
241
242 • --only-print
243
244 Do not connect to databases. mysqlslap only prints what it would
245 have done.
246
247 • --password[=password], -p[password]
248
249 The password to use when connecting to the server. If you use the
250 short option form (-p), you cannot have a space between the option
251 and the password. If you omit the password value following the
252 --password or -p option on the command line, mysqlslap prompts for
253 one.
254
255 Specifying a password on the command line should be considered
256 insecure. You can use an option file to avoid giving the password
257 on the command line.
258
259 • --pipe, -W
260
261 On Windows, connect to the server via a named pipe. This option
262 applies only if the server supports named-pipe connections.
263
264 • --plugin-dir=dir_name
265
266 Directory for client-side plugins.
267
268 • --port=port_num, -P port_num
269
270 The TCP/IP port number to use for the connection.
271
272 • --post-query=value
273
274 The file or string containing the statement to execute after the
275 tests have completed. This execution is not counted for timing
276 purposes.
277
278 • --post-system=str
279
280 The string to execute via system() after the tests have completed.
281 This execution is not counted for timing purposes.
282
283 • --pre-query=value
284
285 The file or string containing the statement to execute before
286 running the tests. This execution is not counted for timing
287 purposes.
288
289 • --pre-system=str
290
291 The string to execute via system() before running the tests. This
292 execution is not counted for timing purposes.
293
294 • --print-defaults
295
296 Print the program argument list and exit. This must be given as
297 the first argument.
298
299 • --protocol={TCP|SOCKET|PIPE|MEMORY}
300
301 The connection protocol to use for connecting to the server. It is
302 useful when the other connection parameters normally would cause a
303 protocol to be used other than the one you want.
304
305 • --query=value, -q value
306
307 The file or string containing the SELECT statement to use for
308 retrieving data.
309
310 • --shared-memory-base-name=name
311
312 On Windows, the shared-memory name to use, for connections made via
313 shared memory to a local server. This option applies only if the
314 server supports shared-memory connections.
315
316 • --silent, -s
317
318 Silent mode. No output.
319
320 • --socket=path, -S path
321
322 For connections to localhost, the Unix socket file to use, or, on
323 Windows, the name of the named pipe to use.
324
325 • --ssl
326
327 Enable SSL for connection (automatically enabled with other flags).
328 Disable with --skip-ssl.
329
330 • --ssl-ca=name
331
332 CA file in PEM format (check OpenSSL docs, implies --ssl).
333
334 • --ssl-capath=name
335
336 CA directory (check OpenSSL docs, implies --ssl).
337
338 • --ssl-cert=name
339
340 X509 cert in PEM format (check OpenSSL docs, implies --ssl).
341
342 • --ssl-cipher=name
343
344 SSL cipher to use (check OpenSSL docs, implies --ssl).
345
346 • --ssl-key=name
347
348 X509 key in PEM format (check OpenSSL docs, implies --ssl).
349
350 • --ssl-crl=name
351
352 Certificate revocation list (check OpenSSL docs, implies --ssl).
353
354 • --ssl-crlpath=name
355
356 Certificate revocation list path (check OpenSSL docs, implies
357 --ssl).
358
359 • --ssl-verify-server-cert
360
361 Verify server's "Common Name" in its cert against hostname used
362 when connecting. This option is disabled by default.
363
364 • --user=user_name, -u user_name
365
366 The MariaDB user name to use when connecting to the server.
367
368 • --verbose, -v
369
370 Verbose mode. Print more information about what the program does.
371 This option can be used multiple times to increase the amount of
372 information.
373
374 • --version, -V
375
376 Display version information and exit.
377
379 Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.,
380 2010-2019 MariaDB Foundation
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-1335 USA or see
394 http://www.gnu.org/licenses/.
395
396
398 For more information, please refer to the MariaDB Knowledge Base,
399 available online at https://mariadb.com/kb/
400
402 MariaDB Foundation (http://www.mariadb.org/).
403
404
405
406MariaDB 10.5 27 June 2019 MYSQLSLAP(1)