MARIADB-SLAP(1)

🌸 MARIADB-SLAP 🌸

okay so hi bestie πŸ’– we're deep in the MariaDB Database System manual, section 1, and today's main character is mariadb-slap ✨


πŸŽ€ NAME πŸŽ€

mariadb-slap β€” the load emulation client. and yes, the page literally says mariadb-slap is now a symlink to mariadb-slap 🫠 iconic, no notes.

✨ SYNOPSIS ✨

mariadb-slap [options]

πŸ’… DESCRIPTION πŸ’…

so mariadb-slap is a diagnostic program, and its whole thing is emulating client load against a MariaDB server and reporting the timing of every stage ⏱️. it works exactly like a whole crowd of clients are all up in the server's business at the same time 🫢.

you invoke it like this, bestie:

shell> mariadb-slap [options]

some options β€” like --create or --query β€” let you pass in a string containing an SQL statement, or a file containing statements. if you go the file route, by default it has to be one statement per line (that is, the implicit statement delimiter is the newline character, periodt). want something else? use --delimiter to pick a different delimiter, and then you can write statements that span multiple lines or stack multiple statements on a single line πŸ’…. oh and real talk: you cannot include comments in a file β€” mariadb-slap does not understand them 😭.

🌈 the three stages 🌈

mariadb-slap runs in three stages:

  1. Create schema, table, and optionally any stored programs or data you want to using for the test. This stage uses a single client connection.
  2. Run the load test. This stage can use many client connections.
  3. Clean up (disconnect, drop table if specified). This stage uses a single client connection.

πŸ¦‹ examples πŸ¦‹

one. supply your own create and query SQL statements, with 50 clients querying and 200 selects for each:

mariadb-slap --delimiter=";" \
  --create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)" \
  --query="SELECT * FROM a" --concurrency=50 --iterations=200

two. let mariadb-slap build the query SQL statement with a table of two INT columns and three VARCHAR columns. use five clients querying 20 times each. do not create the table or insert the data (that is, use the previous test's schema and data):

mariadb-slap --concurrency=5 --iterations=20 \
  --number-int-cols=2 --number-char-cols=3 \
  --auto-generate-sql

three. tell the program to load the create, insert, and query SQL statements from the specified files, where the create.sql file has multiple table creation statements delimited by ; and multiple insert statements delimited by ;. the --query file will have multiple queries delimited by ;. run all the load statements, then run all the queries in the query file with five clients (five times each):

mariadb-slap --concurrency=5 \
  --iterations=5 --query=query.sql --create=create.sql \
  --delimiter=";"

okay now the fun part πŸ’– mariadb-slap supports the following options, and you can drop them on the command line or in the [mariadb-slap] and [client] option file groups. mariadb-slap also supports the options for processing option files ✨.

  • --help, -? β€” display a help message and exit. the classic "what do I do" button 🫢
  • --auto-generate-sql, -a β€” generate SQL statements automatically when they are not supplied in files or via command options. it just makes stuff up for you, slay ✨
  • --auto-generate-sql-add-autoincrement β€” add an AUTO_INCREMENT column to automatically generated tables.
  • --auto-generate-sql-execute-number=N β€” specify how many queries to generate automatically.
  • --auto-generate-sql-guid-primary β€” add a GUID-based primary key to automatically generated tables.
  • --auto-generate-sql-load-type=type β€” specify the test load type. the allowable values are read (scan tables), write (insert into tables), key (read primary keys), update (update primary keys), or mixed (half inserts, half scanning selects). the default is mixed.
  • --auto-generate-sql-secondary-indexes=N β€” specify how many secondary indexes to add to automatically generated tables. by default, none are added.
  • --auto-generate-sql-unique-query-number=N β€” how many different queries to generate for automatic tests. for example, if you run a key test that performs 1000 selects, you can use this option with a value of 1000 to run 1000 unique queries, or with a value of 50 to perform 50 different selects. the default is 10.
  • --auto-generate-sql-unique-write-number=N β€” how many different queries to generate for --auto-generate-sql-write-number. the default is 10.
  • --auto-generate-sql-write-number=N β€” how many row inserts to perform on each thread. the default is 100.
  • --commit=N β€” how many statements to execute before committing. the default is 0 (no commits are done).
  • --compress, -C β€” compress all information sent between the client and the server, if both support compression.
  • --concurrency=N, -c N β€” the number of clients to simulate when issuing the SELECT statement.
  • --create=value β€” the file or string containing the statement to use for creating the table.
  • --create-schema=value β€” the schema in which to run the tests.
  • --csv[=file_name] β€” generate output in comma-separated values format. the output goes to the named file, or to the standard output if no file is given.
  • --debug[=debug_options], -# [debug_options] β€” write a debugging log. a typical debug_options string is 'd:t:o,file_name'. the default is 'd:t:o,/tmp/mariadb-slap.trace'.
  • --debug-check β€” print some debugging information when the program exits.
  • --debug-info, -T β€” print debugging information and memory and CPU usage statistics when the program exits.
  • --default-auth=name β€” default authentication client-side plugin to use.
  • --defaults-extra-file=filename β€” set filename as the file to read default options from after the global defaults files has been read. must be given as first option.
  • --defaults-file=filename β€” set filename as the file to read default options from, override global defaults files. must be given as first option.
  • --delimiter=str, -F str β€” the delimiter to use in SQL statements supplied in files or via command options.
  • --detach=N β€” detach (close and reopen) each connection after each N statements. the default is 0 (connections are not detached).
  • --engine=engine_name, -e engine_name β€” comma separated list of storage engines to use for creating the table. the test is run for each engine. you can also specify an option for an engine after a colon, for example memory:max_row=2300. 🧚
  • --host=host_name, -h host_name β€” connect to the MariaDB server on the given host.
  • --init-command=str β€” SQL Command to execute when connecting to MariaDB server. will automatically be re-executed when reconnecting.
  • --iterations=N, -i N β€” the number of times to run the tests.
  • --no-defaults β€” do not read default options from any option file. this must be given as the first argument.
  • --no-drop β€” do not drop any schema created during the test after the test is complete.
  • --number-char-cols=N, -x N β€” the number of VARCHAR columns to use if --auto-generate-sql is specified.
  • --number-int-cols=N, -y N β€” the number of INT columns to use if --auto-generate-sql is specified.
  • --number-of-queries=N β€” limit each client to approximately this many queries. query counting takes into account the statement delimiter. for example, if you invoke mariadb-slap as follows, the ; delimiter is recognized so that each instance of the query string counts as two queries. as a result, 5 rows (not 10) are inserted:
shell> mariadb-slap --delimiter=";" --number-of-queries=10
         --query="use test;insert into t values(null)"
  • --only-print β€” do not connect to databases. mariadb-slap only prints what it would have done. pure imagination ✨
  • --password[=password], -p[password] β€” the password to use when connecting to the server. if you use the short option form (-p), you cannot have a space between the option and the password. if you omit the password value following the --password or -p option on the command line, mariadb-slap prompts for one.
specifying a password on the command line should be considered insecure. you can use an option file to avoid giving the password on the command line 😭
  • --pipe, -W β€” on Windows, connect to the server via a named pipe. this option applies only if the server supports named-pipe connections.
  • --plugin-dir=dir_name β€” directory for client-side plugins.
  • --port=port_num, -P port_num β€” the TCP/IP port number to use for the connection. forces --protocol=tcp when specified on the command line without other connection properties.
  • --post-query=value β€” the file or string containing the statement to execute after the tests have completed. this execution is not counted for timing purposes.
  • --post-system=str β€” the string to execute via system() after the tests have completed. this execution is not counted for timing purposes.
  • --pre-query=value β€” the file or string containing the statement to execute before running the tests. this execution is not counted for timing purposes.
  • --pre-system=str β€” the string to execute via system() before running the tests. this execution is not counted for timing purposes.
  • --print-defaults β€” print the program argument list and exit. this must be given as the first argument.
  • --protocol={TCP|SOCKET|PIPE|MEMORY} β€” the connection protocol to use for connecting to the server. it is useful when the other connection parameters normally would cause a protocol to be used other than the one you want. iykyk πŸ’…
  • --query=value, -q value β€” the file or string containing the SELECT statement to use for retrieving data.
  • --shared-memory-base-name=name β€” on Windows, the shared-memory name to use, for connections made via shared memory to a local server. this option applies only if the server supports shared-memory connections.
  • --silent, -s β€” silent mode. no output. shhh 🀫
  • --socket=path, -S path β€” for connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use. forces --protocol=socket when specified on the command line without other connection properties; on Windows, forces --protocol=pipe.
  • --ssl β€” enable SSL for connection (automatically enabled with other flags). disable with --skip-ssl.
  • --ssl-ca=name β€” CA file in PEM format (check OpenSSL docs, implies --ssl).
  • --ssl-capath=name
  • CA directory β€” check the OpenSSL docs for the deets, and heads up, this one implies --ssl. πŸ”
  • --ssl-cert=name β€” the X509 cert, in PEM format (check the OpenSSL docs, implies --ssl).
  • --ssl-cipher=name β€” which SSL cipher to use (check the OpenSSL docs, implies --ssl).
  • --ssl-key=name β€” the X509 key, in PEM format (check the OpenSSL docs, implies --ssl).
  • --ssl-crl=name β€” certificate revocation list (check the OpenSSL docs, implies --ssl).
  • --ssl-crlpath=name β€” certificate revocation list path (check the OpenSSL docs, implies --ssl).
  • --ssl-verify-server-cert β€” verifies the server's "Common Name" in its cert against the hostname you used when connecting. Lowkey important and it is disabled by default, so if you want it, you gotta ask for it bestie. πŸ™ˆ
  • --user=user_name, -u user_name β€” the MariaDB user name to use when connecting to the server. it's giving "who am i today". πŸ‘‘
  • --verbose, -v β€” verbose mode, aka it prints more info about what the program is doing. You can stack this option multiple times to keep upping the amount of info. the way it just keeps yapping (affectionate). πŸ”₯
  • --version, -V β€” display version information and exit. that's it, that's the whole job, and honestly? slay. ✨

Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation

This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. (no cap, that's the actual legal vibe 🫢)

You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA or see http://www.gnu.org/licenses/.


🌈 SEE ALSO 🌈

For more information, please refer to the MariaDB Documentation, available online at https://mariadb.com/docs/


🌸 AUTHOR 🌸

MariaDB Foundation (http://www.mariadb.org/).


and that's the whole page, bestie πŸŽ€ this was MariaDB 11.8, dated 5 March 2025, filed under MARIADB-SLAP(1) β€” go forth and slay your connections πŸ’…βœ¨

πŸ“¦ where this page comes from