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