1MYSQLSLAP(1) MySQL Database System MYSQLSLAP(1)
2
3
4
6 mysqlslap - a 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 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 should contain multiple queries
61 delimited by ';'. Run all the load statements, then run all the queries
62 in the 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, -? Display a help message and exit.
74
75 • --auto-generate-sql, -a Generate SQL statements automatically when
76 they are not supplied in files or using command options.
77
78 • --auto-generate-sql-add-autoincrement Add an AUTO_INCREMENT column
79 to automatically generated tables.
80
81 • --auto-generate-sql-execute-number=N Specify how many queries to
82 generate automatically.
83
84 • --auto-generate-sql-guid-primary Add a GUID-based primary key to
85 automatically generated tables.
86
87 • --auto-generate-sql-load-type=type Specify the test load type. The
88 permissible values are read (scan tables), write (insert into
89 tables), key (read primary keys), update (update primary keys), or
90 mixed (half inserts, half scanning selects). The default is mixed.
91
92 • --auto-generate-sql-secondary-indexes=N Specify how many secondary
93 indexes to add to automatically generated tables. By default, none
94 are added.
95
96 • --auto-generate-sql-unique-query-number=N How many different
97 queries to generate for automatic tests. For example, if you run a
98 key test that performs 1000 selects, you can use this option with a
99 value of 1000 to run 1000 unique queries, or with a value of 50 to
100 perform 50 different selects. The default is 10.
101
102 • --auto-generate-sql-unique-write-number=N How many different
103 queries to generate for --auto-generate-sql-write-number. The
104 default is 10.
105
106 • --auto-generate-sql-write-number=N How many row inserts to perform.
107 The default is 100.
108
109 • --commit=N How many statements to execute before committing. The
110 default is 0 (no commits are done).
111
112 • --compress, -C Compress all information sent between the client and
113 the server if possible. See Section 4.2.8, “Connection Compression
114 Control”.
115
116 As of MySQL 8.0.18, this option is deprecated. Expect it to be
117 removed in a future version of MySQL. See the section called
118 “Configuring Legacy Connection Compression”.
119
120 • --compression-algorithms=value The permitted compression algorithms
121 for connections to the server. The available algorithms are the
122 same as for the protocol_compression_algorithms system variable.
123 The default value is uncompressed.
124
125 For more information, see Section 4.2.8, “Connection Compression
126 Control”.
127
128 This option was added in MySQL 8.0.18.
129
130 • --concurrency=N, -c N The number of parallel clients to simulate.
131
132 • --create=value The file or string containing the statement to use
133 for creating the table.
134
135 • --create-schema=value The schema in which to run the tests.
136
137 Note
138 If the --auto-generate-sql option is also given, mysqlslap
139 drops the schema at the end of the test run. To avoid this, use
140 the --no-drop option as well.
141
142 • --csv[=file_name] Generate output in comma-separated values format.
143 The output goes to the named file, or to the standard output if no
144 file is given.
145
146 • --debug[=debug_options], -# [debug_options] Write a debugging log.
147 A typical debug_options string is d:t:o,file_name. The default is
148 d:t:o,/tmp/mysqlslap.trace.
149
150 This option is available only if MySQL was built using WITH_DEBUG.
151 MySQL release binaries provided by Oracle are not built using this
152 option.
153
154 • --debug-check Print some debugging information when the program
155 exits.
156
157 This option is available only if MySQL was built using WITH_DEBUG.
158 MySQL release binaries provided by Oracle are not built using this
159 option.
160
161 • --debug-info, -T Print debugging information and memory and CPU
162 usage statistics when the program exits.
163
164 This option is available only if MySQL was built using WITH_DEBUG.
165 MySQL release binaries provided by Oracle are not built using this
166 option.
167
168 • --default-auth=plugin A hint about which client-side authentication
169 plugin to use. See Section 6.2.17, “Pluggable Authentication”.
170
171 • --defaults-extra-file=file_name Read this option file after the
172 global option file but (on Unix) before the user option file. If
173 the file does not exist or is otherwise inaccessible, an error
174 occurs. If file_name is not an absolute path name, it is
175 interpreted relative to the current directory.
176
177 For additional information about this and other option-file
178 options, see Section 4.2.2.3, “Command-Line Options that Affect
179 Option-File Handling”.
180
181 • --defaults-file=file_name Use only the given option file. If the
182 file does not exist or is otherwise inaccessible, an error occurs.
183 If file_name is not an absolute path name, it is interpreted
184 relative to the current directory.
185
186 Exception: Even with --defaults-file, client programs read
187 .mylogin.cnf.
188
189 For additional information about this and other option-file
190 options, see Section 4.2.2.3, “Command-Line Options that Affect
191 Option-File Handling”.
192
193 • --defaults-group-suffix=str Read not only the usual option groups,
194 but also groups with the usual names and a suffix of str. For
195 example, mysqlslap normally reads the [client] and [mysqlslap]
196 groups. If this option is given as --defaults-group-suffix=_other,
197 mysqlslap also reads the [client_other] and [mysqlslap_other]
198 groups.
199
200 For additional information about this and other option-file
201 options, see Section 4.2.2.3, “Command-Line Options that Affect
202 Option-File Handling”.
203
204 • --delimiter=str, -F str The delimiter to use in SQL statements
205 supplied in files or using command options.
206
207 • --detach=N Detach (close and reopen) each connection after each N
208 statements. The default is 0 (connections are not detached).
209
210 • --enable-cleartext-plugin Enable the mysql_clear_password cleartext
211 authentication plugin. (See Section 6.4.1.4, “Client-Side Cleartext
212 Pluggable Authentication”.)
213
214 • --engine=engine_name, -e engine_name The storage engine to use for
215 creating tables.
216
217 • --get-server-public-key Request from the server the RSA public key
218 that it uses for key pair-based password exchange. This option
219 applies to clients that connect to the server using an account that
220 authenticates with the caching_sha2_password authentication plugin.
221 For connections by such accounts, the server does not send the
222 public key to the client unless requested. The option is ignored
223 for accounts that do not authenticate with that plugin. It is also
224 ignored if RSA-based password exchange is not needed, as is the
225 case when the client connects to the server using a secure
226 connection.
227
228 If --server-public-key-path=file_name is given and specifies a
229 valid public key file, it takes precedence over
230 --get-server-public-key.
231
232 For information about the caching_sha2_password plugin, see
233 Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.
234
235 • --host=host_name, -h host_name Connect to the MySQL server on the
236 given host.
237
238 • --iterations=N, -i N The number of times to run the tests.
239
240 • --login-path=name Read options from the named login path in the
241 .mylogin.cnf login path file. A “login path” is an option group
242 containing options that specify which MySQL server to connect to
243 and which account to authenticate as. To create or modify a login
244 path file, use the mysql_config_editor utility. See
245 mysql_config_editor(1).
246
247 For additional information about this and other option-file
248 options, see Section 4.2.2.3, “Command-Line Options that Affect
249 Option-File Handling”.
250
251 • --no-drop Prevent mysqlslap from dropping any schema it creates
252 during the test run.
253
254 • --no-defaults Do not read any option files. If program startup
255 fails due to reading unknown options from an option file,
256 --no-defaults can be used to prevent them from being read.
257
258 The exception is that the .mylogin.cnf file is read in all cases,
259 if it exists. This permits passwords to be specified in a safer way
260 than on the command line even when --no-defaults is used. To create
261 .mylogin.cnf, use the mysql_config_editor utility. See
262 mysql_config_editor(1).
263
264 For additional information about this and other option-file
265 options, see Section 4.2.2.3, “Command-Line Options that Affect
266 Option-File Handling”.
267
268 • --number-char-cols=N, -x N The number of VARCHAR columns to use if
269 --auto-generate-sql is specified.
270
271 • --number-int-cols=N, -y N The number of INT columns to use if
272 --auto-generate-sql is specified.
273
274 • --number-of-queries=N Limit each client to approximately this many
275 queries. Query counting takes into account the statement delimiter.
276 For example, if you invoke mysqlslap as follows, the ; delimiter is
277 recognized so that each instance of the query string counts as two
278 queries. As a result, 5 rows (not 10) are inserted.
279
280 mysqlslap --delimiter=";" --number-of-queries=10
281 --query="use test;insert into t values(null)"
282
283 • --only-print Do not connect to databases. mysqlslap only prints
284 what it would have done.
285
286 • --password[=password], -p[password] The password of the MySQL
287 account used for connecting to the server. The password value is
288 optional. If not given, mysqlslap prompts for one. If given, there
289 must be no space between --password= or -p and the password
290 following it. If no password option is specified, the default is to
291 send no password.
292
293 Specifying a password on the command line should be considered
294 insecure. To avoid giving the password on the command line, use an
295 option file. See Section 6.1.2.1, “End-User Guidelines for Password
296 Security”.
297
298 To explicitly specify that there is no password and that mysqlslap
299 should not prompt for one, use the --skip-password option.
300
301 • --pipe, -W On Windows, connect to the server using a named pipe.
302 This option applies only if the server was started with the
303 named_pipe system variable enabled to support named-pipe
304 connections. In addition, the user making the connection must be a
305 member of the Windows group specified by the
306 named_pipe_full_access_group system variable.
307
308 • --plugin-dir=dir_name The directory in which to look for plugins.
309 Specify this option if the --default-auth option is used to specify
310 an authentication plugin but mysqlslap does not find it. See
311 Section 6.2.17, “Pluggable Authentication”.
312
313 • --port=port_num, -P port_num For TCP/IP connections, the port
314 number to use.
315
316 • --post-query=value The file or string containing the statement to
317 execute after the tests have completed. This execution is not
318 counted for timing purposes.
319
320 • --post-system=str The string to execute using system() after the
321 tests have completed. This execution is not counted for timing
322 purposes.
323
324 • --pre-query=value The file or string containing the statement to
325 execute before running the tests. This execution is not counted for
326 timing purposes.
327
328 • --pre-system=str The string to execute using system() before
329 running the tests. This execution is not counted for timing
330 purposes.
331
332 • --print-defaults Print the program name and all options that it
333 gets from option files.
334
335 For additional information about this and other option-file
336 options, see Section 4.2.2.3, “Command-Line Options that Affect
337 Option-File Handling”.
338
339 • --protocol={TCP|SOCKET|PIPE|MEMORY} The transport protocol to use
340 for connecting to the server. It is useful when the other
341 connection parameters normally result in use of a protocol other
342 than the one you want. For details on the permissible values, see
343 Section 4.2.7, “Connection Transport Protocols”.
344
345 • --query=value, -q value The file or string containing the SELECT
346 statement to use for retrieving data.
347
348 • --server-public-key-path=file_name The path name to a file in PEM
349 format containing a client-side copy of the public key required by
350 the server for RSA key pair-based password exchange. This option
351 applies to clients that authenticate with the sha256_password or
352 caching_sha2_password authentication plugin. This option is ignored
353 for accounts that do not authenticate with one of those plugins. It
354 is also ignored if RSA-based password exchange is not used, as is
355 the case when the client connects to the server using a secure
356 connection.
357
358 If --server-public-key-path=file_name is given and specifies a
359 valid public key file, it takes precedence over
360 --get-server-public-key.
361
362 For sha256_password, this option applies only if MySQL was built
363 using OpenSSL.
364
365 For information about the sha256_password and caching_sha2_password
366 plugins, see Section 6.4.1.3, “SHA-256 Pluggable Authentication”,
367 and Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.
368
369 • --shared-memory-base-name=name On Windows, the shared-memory name
370 to use for connections made using shared memory to a local server.
371 The default value is MYSQL. The shared-memory name is
372 case-sensitive.
373
374 This option applies only if the server was started with the
375 shared_memory system variable enabled to support shared-memory
376 connections.
377
378 • --silent, -s Silent mode. No output.
379
380 • --socket=path, -S path For connections to localhost, the Unix
381 socket file to use, or, on Windows, the name of the named pipe to
382 use.
383
384 On Windows, this option applies only if the server was started with
385 the named_pipe system variable enabled to support named-pipe
386 connections. In addition, the user making the connection must be a
387 member of the Windows group specified by the
388 named_pipe_full_access_group system variable.
389
390 • --sql-mode=mode Set the SQL mode for the client session.
391
392 • --ssl* Options that begin with --ssl specify whether to connect to
393 the server using encryption and indicate where to find SSL keys and
394 certificates. See the section called “Command Options for Encrypted
395 Connections”.
396
397 • --ssl-fips-mode={OFF|ON|STRICT} Controls whether to enable FIPS
398 mode on the client side. The --ssl-fips-mode option differs from
399 other --ssl-xxx options in that it is not used to establish
400 encrypted connections, but rather to affect which cryptographic
401 operations to permit. See Section 6.8, “FIPS Support”.
402
403 These --ssl-fips-mode values are permitted:
404
405 • OFF: Disable FIPS mode.
406
407 • ON: Enable FIPS mode.
408
409 • STRICT: Enable “strict” FIPS mode.
410
411
412 Note
413 If the OpenSSL FIPS Object Module is not available, the only
414 permitted value for --ssl-fips-mode is OFF. In this case,
415 setting --ssl-fips-mode to ON or STRICT causes the client to
416 produce a warning at startup and to operate in non-FIPS mode.
417
418 • --tls-ciphersuites=ciphersuite_list The permissible ciphersuites
419 for encrypted connections that use TLSv1.3. The value is a list of
420 one or more colon-separated ciphersuite names. The ciphersuites
421 that can be named for this option depend on the SSL library used to
422 compile MySQL. For details, see Section 6.3.2, “Encrypted
423 Connection TLS Protocols and Ciphers”.
424
425 This option was added in MySQL 8.0.16.
426
427 • --tls-version=protocol_list The permissible TLS protocols for
428 encrypted connections. The value is a list of one or more
429 comma-separated protocol names. The protocols that can be named for
430 this option depend on the SSL library used to compile MySQL. For
431 details, see Section 6.3.2, “Encrypted Connection TLS Protocols and
432 Ciphers”.
433
434 • --user=user_name, -u user_name The user name of the MySQL account
435 to use for connecting to the server.
436
437 • --verbose, -v Verbose mode. Print more information about what the
438 program does. This option can be used multiple times to increase
439 the amount of information.
440
441 • --version, -V Display version information and exit.
442
443 • --zstd-compression-level=level The compression level to use for
444 connections to the server that use the zstd compression algorithm.
445 The permitted levels are from 1 to 22, with larger values
446 indicating increasing levels of compression. The default zstd
447 compression level is 3. The compression level setting has no effect
448 on connections that do not use zstd compression.
449
450 For more information, see Section 4.2.8, “Connection Compression
451 Control”.
452
453 This option was added in MySQL 8.0.18.
454
456 Copyright © 1997, 2021, Oracle and/or its affiliates.
457
458 This documentation is free software; you can redistribute it and/or
459 modify it only under the terms of the GNU General Public License as
460 published by the Free Software Foundation; version 2 of the License.
461
462 This documentation is distributed in the hope that it will be useful,
463 but WITHOUT ANY WARRANTY; without even the implied warranty of
464 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
465 General Public License for more details.
466
467 You should have received a copy of the GNU General Public License along
468 with the program; if not, write to the Free Software Foundation, Inc.,
469 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
470 http://www.gnu.org/licenses/.
471
472
474 For more information, please refer to the MySQL Reference Manual, which
475 may already be installed locally and which is also available online at
476 http://dev.mysql.com/doc/.
477
479 Oracle Corporation (http://dev.mysql.com/).
480
481
482
483MySQL 8.0 09/04/2021 MYSQLSLAP(1)