1MYSQLSLAP(1) MySQL 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 MySQL 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 to
32 use for the test. This stage uses a single client connection.
33
34 2. Run the load test. This stage can use many client connections.
35
36 3. Clean up (disconnect, drop table if specified). This stage uses a
37 single client connection.
38
39 Examples:
40
41 Supply your own create and query SQL statements, with 50 clients
42 querying and 200 selects for each (enter the command on a single line):
43
44 mysqlslap --delimiter=";"
45 --create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)"
46 --query="SELECT * FROM a" --concurrency=50 --iterations=200
47
48 Let mysqlslap build the query SQL statement with a table of two INT
49 columns and three VARCHAR columns. Use five clients querying 20 times
50 each. Do not create the table or insert the data (that is, use the
51 previous test's schema and data):
52
53 mysqlslap --concurrency=5 --iterations=20
54 --number-int-cols=2 --number-char-cols=3
55 --auto-generate-sql
56
57 Tell the program to load the create, insert, and query SQL statements
58 from the specified files, where the create.sql file has multiple table
59 creation statements delimited by ';' and multiple insert statements
60 delimited by ';'. The --query file will have multiple queries delimited
61 by ';'. Run all the load statements, then run all the queries in the
62 query file with five clients (five times each):
63
64 mysqlslap --concurrency=5
65 --iterations=5 --query=query.sql --create=create.sql
66 --delimiter=";"
67
68 mysqlslap supports the following options, which can be specified on the
69 command line or in the [mysqlslap] and [client] groups of an option
70 file. For information about option files used by MySQL programs, see
71 Section 4.2.2.2, “Using 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 using 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 permissible 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. 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 possible. See Section 4.2.6, “Connection Compression Control”.
132
133 As of MySQL 8.0.18, this option is deprecated. It will be removed
134 in a future MySQL version. See the section called “Legacy
135 Connection Compression Configuration”.
136
137 · --compression-algorithms=value The permitted compression algorithms
138 for connections to the server. The available algorithms are the
139 same as for the protocol_compression_algorithms system variable.
140 The default value is uncompressed.
141
142 For more information, see Section 4.2.6, “Connection Compression
143 Control”.
144
145 This option was added in MySQL 8.0.18.
146
147 · --concurrency=N, -c N
148
149 The number of parallel clients to simulate.
150
151 · --create=value
152
153 The file or string containing the statement to use for creating the
154 table.
155
156 · --create-schema=value
157
158 The schema in which to run the tests.
159
160 Note
161 If the --auto-generate-sql option is also given, mysqlslap
162 drops the schema at the end of the test run. To avoid this, use
163 the --no-drop option as well.
164
165 · --csv[=file_name]
166
167 Generate output in comma-separated values format. The output goes
168 to the named file, or to the standard output if no file is given.
169
170 · --debug[=debug_options], -# [debug_options]
171
172 Write a debugging log. A typical debug_options string is
173 d:t:o,file_name. The default is d:t:o,/tmp/mysqlslap.trace.
174
175 · --debug-check
176
177 Print some debugging information when the program exits.
178
179 · --debug-info, -T
180
181 Print debugging information and memory and CPU usage statistics
182 when the program exits.
183
184 · --default-auth=plugin
185
186 A hint about which client-side authentication plugin to use. See
187 Section 6.2.17, “Pluggable Authentication”.
188
189 · --defaults-extra-file=file_name
190
191 Read this option file after the global option file but (on Unix)
192 before the user option file. If the file does not exist or is
193 otherwise inaccessible, an error occurs. file_name is interpreted
194 relative to the current directory if given as a relative path name
195 rather than a full path name.
196
197 For additional information about this and other option-file
198 options, see Section 4.2.2.3, “Command-Line Options that Affect
199 Option-File Handling”.
200
201 · --defaults-file=file_name
202
203 Use only the given option file. If the file does not exist or is
204 otherwise inaccessible, an error occurs. file_name is interpreted
205 relative to the current directory if given as a relative path name
206 rather than a full path name.
207
208 Exception: Even with --defaults-file, client programs read
209 .mylogin.cnf.
210
211 For additional information about this and other option-file
212 options, see Section 4.2.2.3, “Command-Line Options that Affect
213 Option-File Handling”.
214
215 · --defaults-group-suffix=str
216
217 Read not only the usual option groups, but also groups with the
218 usual names and a suffix of str. For example, mysqlslap normally
219 reads the [client] and [mysqlslap] groups. If the
220 --defaults-group-suffix=_other option is given, mysqlslap also
221 reads the [client_other] and [mysqlslap_other] groups.
222
223 For additional information about this and other option-file
224 options, see Section 4.2.2.3, “Command-Line Options that Affect
225 Option-File Handling”.
226
227 · --delimiter=str, -F str
228
229 The delimiter to use in SQL statements supplied in files or using
230 command options.
231
232 · --detach=N
233
234 Detach (close and reopen) each connection after each N statements.
235 The default is 0 (connections are not detached).
236
237 · --enable-cleartext-plugin
238
239 Enable the mysql_clear_password cleartext authentication plugin.
240 (See Section 6.4.1.4, “Client-Side Cleartext Pluggable
241 Authentication”.)
242
243 · --engine=engine_name, -e engine_name
244
245 The storage engine to use for creating tables.
246
247 · --get-server-public-key
248
249 Request from the server the RSA public key that it uses for key
250 pair-based password exchange. This option applies to clients that
251 connect to the server using an account that authenticates with the
252 caching_sha2_password authentication plugin. For connections by
253 such accounts, the server does not send the public key to the
254 client unless requested. The option is ignored for accounts that do
255 not authenticate with that plugin. It is also ignored if RSA-based
256 password exchange is not needed, as is the case when the client
257 connects to the server using a secure connection.
258
259 If --server-public-key-path=file_name is given and specifies a
260 valid public key file, it takes precedence over
261 --get-server-public-key.
262
263 For information about the caching_sha2_password plugin, see
264 Section 6.4.1.3, “Caching SHA-2 Pluggable Authentication”.
265
266 · --host=host_name, -h host_name
267
268 Connect to the MySQL server on the given host.
269
270 · --iterations=N, -i N
271
272 The number of times to run the tests.
273
274 · --login-path=name
275
276 Read options from the named login path in the .mylogin.cnf login
277 path file. A “login path” is an option group containing options
278 that specify which MySQL server to connect to and which account to
279 authenticate as. To create or modify a login path file, use the
280 mysql_config_editor utility. See mysql_config_editor(1).
281
282 For additional information about this and other option-file
283 options, see Section 4.2.2.3, “Command-Line Options that Affect
284 Option-File Handling”.
285
286 · --no-drop
287
288 Prevent mysqlslap from dropping any schema it creates during the
289 test run.
290
291 · --no-defaults
292
293 Do not read any option files. If program startup fails due to
294 reading unknown options from an option file, --no-defaults can be
295 used to prevent them from being read.
296
297 The exception is that the .mylogin.cnf file, if it exists, is read
298 in all cases. This permits passwords to be specified in a safer way
299 than on the command line even when --no-defaults is used.
300 (.mylogin.cnf is created by the mysql_config_editor utility. See
301 mysql_config_editor(1).)
302
303 For additional information about this and other option-file
304 options, see Section 4.2.2.3, “Command-Line Options that Affect
305 Option-File Handling”.
306
307 · --number-char-cols=N, -x N
308
309 The number of VARCHAR columns to use if --auto-generate-sql is
310 specified.
311
312 · --number-int-cols=N, -y N
313
314 The number of INT columns to use if --auto-generate-sql is
315 specified.
316
317 · --number-of-queries=N
318
319 Limit each client to approximately this many queries. Query
320 counting takes into account the statement delimiter. For example,
321 if you invoke mysqlslap as follows, the ; delimiter is recognized
322 so that each instance of the query string counts as two queries. As
323 a result, 5 rows (not 10) are inserted.
324
325 shell> mysqlslap --delimiter=";" --number-of-queries=10
326 --query="use test;insert into t values(null)"
327
328 · --only-print
329
330 Do not connect to databases. mysqlslap only prints what it would
331 have done.
332
333 · --password[=password], -p[password]
334
335 The password of the MySQL account used for connecting to the
336 server. The password value is optional. If not given, mysqlslap
337 prompts for one. If given, there must be no space between
338 --password= or -p and the password following it. If no password
339 option is specified, the default is to send no password.
340
341 Specifying a password on the command line should be considered
342 insecure. To avoid giving the password on the command line, use an
343 option file. See Section 6.1.2.1, “End-User Guidelines for Password
344 Security”.
345
346 To explicitly specify that there is no password and that mysqlslap
347 should not prompt for one, use the --skip-password option.
348
349 · --pipe, -W
350
351 On Windows, connect to the server using a named pipe. This option
352 applies only if the server was started with the named_pipe system
353 variable enabled to support named-pipe connections. In addition,
354 the user making the connection must be a member of the Windows
355 group specified by the named_pipe_full_access_group system
356 variable.
357
358 · --plugin-dir=dir_name
359
360 The directory in which to look for plugins. Specify this option if
361 the --default-auth option is used to specify an authentication
362 plugin but mysqlslap does not find it. See Section 6.2.17,
363 “Pluggable Authentication”.
364
365 · --port=port_num, -P port_num
366
367 For TCP/IP connections, the port number to use.
368
369 · --post-query=value
370
371 The file or string containing the statement to execute after the
372 tests have completed. This execution is not counted for timing
373 purposes.
374
375 · --post-system=str
376
377 The string to execute using system() after the tests have
378 completed. This execution is not counted for timing purposes.
379
380 · --pre-query=value
381
382 The file or string containing the statement to execute before
383 running the tests. This execution is not counted for timing
384 purposes.
385
386 · --pre-system=str
387
388 The string to execute using system() before running the tests. This
389 execution is not counted for timing purposes.
390
391 · --print-defaults
392
393 Print the program name and all options that it gets from option
394 files.
395
396 For additional information about this and other option-file
397 options, see Section 4.2.2.3, “Command-Line Options that Affect
398 Option-File Handling”.
399
400 · --protocol={TCP|SOCKET|PIPE|MEMORY}
401
402 The connection protocol to use for connecting to the server. It is
403 useful when the other connection parameters normally result in use
404 of a protocol other than the one you want. For details on the
405 permissible values, see Section 4.2.4, “Connecting to the MySQL
406 Server Using Command Options”.
407
408 · --query=value, -q value
409
410 The file or string containing the SELECT statement to use for
411 retrieving data.
412
413 · --secure-auth
414
415 This option was removed in MySQL 8.0.3.
416
417 · --server-public-key-path=file_name
418
419 The path name to a file containing a client-side copy of the public
420 key required by the server for RSA key pair-based password
421 exchange. The file must be in PEM format. This option applies to
422 clients that authenticate with the sha256_password or
423 caching_sha2_password authentication plugin. This option is ignored
424 for accounts that do not authenticate with one of those plugins. It
425 is also ignored if RSA-based password exchange is not used, as is
426 the case when the client connects to the server using a secure
427 connection.
428
429 If --server-public-key-path=file_name is given and specifies a
430 valid public key file, it takes precedence over
431 --get-server-public-key.
432
433 For sha256_password, this option applies only if MySQL was built
434 using OpenSSL.
435
436 For information about the sha256_password and caching_sha2_password
437 plugins, see Section 6.4.1.2, “SHA-256 Pluggable Authentication”,
438 and Section 6.4.1.3, “Caching SHA-2 Pluggable Authentication”.
439
440 · --shared-memory-base-name=name
441
442 On Windows, the shared-memory name to use for connections made
443 using shared memory to a local server. The default value is MYSQL.
444 The shared-memory name is case-sensitive.
445
446 This option applies only if the server was started with the
447 shared_memory system variable enabled to support shared-memory
448 connections.
449
450 · --silent, -s
451
452 Silent mode. No output.
453
454 · --socket=path, -S path
455
456 For connections to localhost, the Unix socket file to use, or, on
457 Windows, the name of the named pipe to use.
458
459 On Windows, this option applies only if the server was started with
460 the named_pipe system variable enabled to support named-pipe
461 connections. In addition, the user making the connection must be a
462 member of the Windows group specified by the
463 named_pipe_full_access_group system variable.
464
465 · --sql-mode=mode
466
467 Set the SQL mode for the client session.
468
469 · --ssl*
470
471 Options that begin with --ssl specify whether to connect to the
472 server using SSL and indicate where to find SSL keys and
473 certificates. See the section called “Command Options for Encrypted
474 Connections”.
475
476 · --ssl-fips-mode={OFF|ON|STRICT} Controls whether to enable FIPS
477 mode on the client side. The --ssl-fips-mode option differs from
478 other --ssl-xxx options in that it is not used to establish
479 encrypted connections, but rather to affect which cryptographic
480 operations are permitted. See Section 6.5, “FIPS Support”.
481
482 These --ssl-fips-mode values are permitted:
483
484 · OFF: Disable FIPS mode.
485
486 · ON: Enable FIPS mode.
487
488 · STRICT: Enable “strict” FIPS mode.
489
490
491 Note
492 If the OpenSSL FIPS Object Module is not available, the only
493 permitted value for --ssl-fips-mode is OFF. In this case,
494 setting --ssl-fips-mode to ON or STRICT causes the client to
495 produce a warning at startup and to operate in non-FIPS mode.
496
497 · --tls-ciphersuites=ciphersuite_list
498
499 The permissible ciphersuites for encrypted connections that use
500 TLSv1.3. The value is a list of one or more colon-separated
501 ciphersuite names. The ciphersuites that can be named for this
502 option depend on the SSL library used to compile MySQL. For
503 details, see Section 6.3.2, “Encrypted Connection TLS Protocols and
504 Ciphers”.
505
506 This option was added in MySQL 8.0.16.
507
508 · --tls-version=protocol_list
509
510 The permissible TLS protocols for encrypted connections. The value
511 is a list of one or more comma-separated protocol names. The
512 protocols that can be named for this option depend on the SSL
513 library used to compile MySQL. For details, see Section 6.3.2,
514 “Encrypted Connection TLS Protocols and Ciphers”.
515
516 · --user=user_name, -u user_name
517
518 The user name of the MySQL account to use for connecting to the
519 server.
520
521 · --verbose, -v
522
523 Verbose mode. Print more information about what the program does.
524 This option can be used multiple times to increase the amount of
525 information.
526
527 · --version, -V
528
529 Display version information and exit.
530
531 · --zstd-compression-level=level The compression level to use for
532 connections to the server that use the zstd compression algorithm.
533 The permitted levels are from 1 to 22, with larger values
534 indicating increasing levels of compression. The default zstd
535 compression level is 3. The compression level setting has no effect
536 on connections that do not use zstd compression.
537
538 For more information, see Section 4.2.6, “Connection Compression
539 Control”.
540
541 This option was added in MySQL 8.0.18.
542
544 Copyright © 1997, 2019, Oracle and/or its affiliates. All rights
545 reserved.
546
547 This documentation is free software; you can redistribute it and/or
548 modify it only under the terms of the GNU General Public License as
549 published by the Free Software Foundation; version 2 of the License.
550
551 This documentation is distributed in the hope that it will be useful,
552 but WITHOUT ANY WARRANTY; without even the implied warranty of
553 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
554 General Public License for more details.
555
556 You should have received a copy of the GNU General Public License along
557 with the program; if not, write to the Free Software Foundation, Inc.,
558 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
559 http://www.gnu.org/licenses/.
560
561
563 For more information, please refer to the MySQL Reference Manual, which
564 may already be installed locally and which is also available online at
565 http://dev.mysql.com/doc/.
566
568 Oracle Corporation (http://dev.mysql.com/).
569
570
571
572MySQL 8.0 09/06/2019 MYSQLSLAP(1)