A Load Emulation Client for MySQL


The mysqlslap utility is a diagnostic program that has designed to emulate client load for a MySQL server and report the timing of every stage. It works as though multiple clients are accessing the server.

Invoking mysqlslap

mysqlslap can be invoked using the below command −

shell> mysqlslap [options]

Some options are: --create or --query that would enable the user to specify a string that contains an SQL statement or a file containing statements.

Stages

mysqlslap runs in three stages. They are −

  • Create schema, table, and any stored programs or data to use (it is optional) for the test. This stage uses a single client connection.

  • Run the load test. This stage can use multiple client connections.

  • Clean up, i.e disconnect, drop table if specified. This stage uses a single client connection.

Options

This utility supports the following options, and they can be specified on the command line or in the [mysqlslap] and [client] groups of an option file.

--pre-query=value

It is the file or string that contains the statement to be executed before running the tests. This execution is not counted for timing purposes.

--pre-system=str

It is the string that is used to execute using system() before running the tests. This execution is not counted for timing purposes.

--print-defaults

It is used to print the program name and all options that it receives from option files.

--query=value, -q value

It is the file or string containing the SELECT statement that needs to be used to retrieve data.

--sql-mode=mode

It sets the SQL mode for the client session.

Updated on: 10-Mar-2021

151 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements