2 .\" Title: \fBmysqlslap\fR
3 .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
4 .\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/>
6 .\" Manual: MySQL Database System
10 .TH "\FBMYSQLSLAP\FR" "1" "11/04/2013" "MySQL 5\&.1" "MySQL Database System"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
33 mysqlslap \- load emulation client
35 .HP \w'\fBmysqlslap\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u
36 \fBmysqlslap [\fR\fB\fIoptions\fR\fR\fB]\fR
40 is a diagnostic program designed to emulate client load for a MySQL server and to report the timing of each stage\&. It works as if multiple clients are accessing the server\&.
42 is available as of MySQL 5\&.1\&.4\&.
52 shell> \fBmysqlslap [\fR\fB\fIoptions\fR\fR\fB]\fR
62 enable you to specify a string containing an SQL statement or a file containing statements\&. If you specify a file, by default it must contain one statement per line\&. (That is, the implicit statement delimiter is the newline character\&.) Use the
64 option to specify a different delimiter, which enables you to specify statements that span multiple lines or place multiple statements on a single line\&. You cannot include comments in a file;
66 does not understand them\&.
79 Create schema, table, and optionally any stored programs or data to use for the test\&. This stage uses a single client connection\&.
90 Run the load test\&. This stage can use many client connections\&.
101 Clean up (disconnect, drop table if specified)\&. This stage uses a single client connection\&.
106 Supply your own create and query SQL statements, with 50 clients querying and 200 selects for each (enter the command on a single line):
112 mysqlslap \-\-delimiter=";"
113 \-\-create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)"
114 \-\-query="SELECT * FROM a" \-\-concurrency=50 \-\-iterations=200
122 build the query SQL statement with a table of two
126 columns\&. Use five clients querying 20 times each\&. Do not create the table or insert the data (that is, use the previous test\*(Aqs schema and data):
132 mysqlslap \-\-concurrency=5 \-\-iterations=20
133 \-\-number\-int\-cols=2 \-\-number\-char\-cols=3
134 \-\-auto\-generate\-sql
140 Tell the program to load the create, insert, and query SQL statements from the specified files, where the
142 file has multiple table creation statements delimited by
144 and multiple insert statements delimited by
147 file will have multiple queries delimited by
148 \*(Aq;\*(Aq\&. Run all the load statements, then run all the queries in the query file with five clients (five times each):
154 mysqlslap \-\-concurrency=5
155 \-\-iterations=5 \-\-query=query\&.sql \-\-create=create\&.sql
163 supports the following options, which can be specified on the command line or in the
167 groups of an option file\&.
169 also supports the options for processing option files described at
170 Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&.
180 .\" mysqlslap: help option
181 .\" help option: mysqlslap
185 Display a help message and exit\&.
196 .\" mysqlslap: auto-generate-sql option
197 .\" auto-generate-sql option: mysqlslap
198 \fB\-\-auto\-generate\-sql\fR,
201 Generate SQL statements automatically when they are not supplied in files or using command options\&.
212 .\" mysqlslap: auto-generate-sql-add-autoincrement option
213 .\" auto-generate-sql-add-autoincrement option: mysqlslap
214 \fB\-\-auto\-generate\-sql\-add\-autoincrement\fR
218 column to automatically generated tables\&. This option was added in MySQL 5\&.1\&.18\&.
229 .\" mysqlslap: auto-generate-sql-execute-number option
230 .\" auto-generate-sql-execute-number option: mysqlslap
231 \fB\-\-auto\-generate\-sql\-execute\-number=\fR\fB\fIN\fR\fR
233 Specify how many queries to generate automatically\&. This option was added in MySQL 5\&.1\&.18\&.
244 .\" mysqlslap: auto-generate-sql-guid-primary option
245 .\" auto-generate-sql-guid-primary option: mysqlslap
246 \fB\-\-auto\-generate\-sql\-guid\-primary\fR
248 Add a GUID\-based primary key to automatically generated tables\&. This option was added in MySQL 5\&.1\&.18\&.
259 .\" mysqlslap: auto-generate-sql-load-type option
260 .\" auto-generate-sql-load-type option: mysqlslap
261 \fB\-\-auto\-generate\-sql\-load\-type=\fR\fB\fItype\fR\fR
263 Specify the test load type\&. The permissible values are
267 (insert into tables),
271 (update primary keys), or
273 (half inserts, half scanning selects)\&. The default is
274 mixed\&. This option was added in MySQL 5\&.1\&.16\&.
285 .\" mysqlslap: auto-generate-sql-secondary-indexes option
286 .\" auto-generate-sql-secondary-indexes option: mysqlslap
287 \fB\-\-auto\-generate\-sql\-secondary\-indexes=\fR\fB\fIN\fR\fR
289 Specify how many secondary indexes to add to automatically generated tables\&. By default, none are added\&. This option was added in MySQL 5\&.1\&.18\&.
300 .\" mysqlslap: auto-generate-sql-unique-query-number option
301 .\" auto-generate-sql-unique-query-number option: mysqlslap
302 \fB\-\-auto\-generate\-sql\-unique\-query\-number=\fR\fB\fIN\fR\fR
304 How many different queries to generate for automatic tests\&. For example, if you run a
306 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\&. This option was added in MySQL 5\&.1\&.18\&.
317 .\" mysqlslap: auto-generate-sql-unique-write-number option
318 .\" auto-generate-sql-unique-write-number option: mysqlslap
319 \fB\-\-auto\-generate\-sql\-unique\-write\-number=\fR\fB\fIN\fR\fR
321 How many different queries to generate for
322 \fB\-\-auto\-generate\-sql\-write\-number\fR\&. The default is 10\&. This option was added in MySQL 5\&.1\&.18\&.
333 .\" mysqlslap: auto-generate-sql-write-number option
334 .\" auto-generate-sql-write-number option: mysqlslap
335 \fB\-\-auto\-generate\-sql\-write\-number=\fR\fB\fIN\fR\fR
337 How many row inserts to perform on each thread\&. The default is 100\&. This option was added in MySQL 5\&.1\&.16\&.
348 .\" mysqlslap: commit option
349 .\" commit option: mysqlslap
350 \fB\-\-commit=\fR\fB\fIN\fR\fR
352 How many statements to execute before committing\&. The default is 0 (no commits are done)\&. This option was added in MySQL 5\&.1\&.21\&.
363 .\" mysqlslap: compress option
364 .\" compress option: mysqlslap
368 Compress all information sent between the client and the server if both support compression\&.
379 .\" mysqlslap: concurrency option
380 .\" concurrency option: mysqlslap
381 \fB\-\-concurrency=\fR\fB\fIN\fR\fR,
382 \fB\-c \fR\fB\fIN\fR\fR
384 The number of clients to simulate when issuing the
397 .\" mysqlslap: create option
398 .\" create option: mysqlslap
399 \fB\-\-create=\fR\fB\fIvalue\fR\fR
401 The file or string containing the statement to use for creating the table\&.
412 .\" mysqlslap: create-schema option
413 .\" create-schema option: mysqlslap
414 \fB\-\-create\-schema=\fR\fB\fIvalue\fR\fR
416 The schema in which to run the tests\&. This option was added in MySQL 5\&.1\&.5\&.
422 .nr an-no-space-flag 1
430 \fB\-\-auto\-generate\-sql\fR
431 option is also given,
433 drops the schema at the end of the test run\&. To avoid this, use the
448 .\" mysqlslap: csv option
449 .\" csv option: mysqlslap
450 \fB\-\-csv[=\fR\fB\fIfile_name\fR\fR\fB]\fR
452 Generate output in comma\-separated values format\&. The output goes to the named file, or to the standard output if no file is given\&. This option was added in MySQL 5\&.1\&.5\&.
463 .\" mysqlslap: debug option
464 .\" debug option: mysqlslap
465 \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR,
466 \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR
468 Write a debugging log\&. A typical
471 \*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is
472 \*(Aqd:t:o,/tmp/mysqlslap\&.trace\*(Aq\&.
483 .\" mysqlslap: debug-check option
484 .\" debug-check option: mysqlslap
485 \fB\-\-debug\-check\fR
487 Print some debugging information when the program exits\&. This option was added in MySQL 5\&.1\&.21\&.
498 .\" mysqlslap: debug-info option
499 .\" debug-info option: mysqlslap
500 \fB\-\-debug\-info\fR,
503 Print debugging information and memory and CPU usage statistics when the program exits\&. This option was added in MySQL 5\&.1\&.21\&.
514 .\" mysqlslap: delimiter option
515 .\" delimiter option: mysqlslap
516 \fB\-\-delimiter=\fR\fB\fIstr\fR\fR,
517 \fB\-F \fR\fB\fIstr\fR\fR
519 The delimiter to use in SQL statements supplied in files or using command options\&.
530 .\" mysqlslap: detach option
531 .\" detach option: mysqlslap
532 \fB\-\-detach=\fR\fB\fIN\fR\fR
534 Detach (close and reopen) each connection after each
536 statements\&. The default is 0 (connections are not detached)\&. This option was added in MySQL 5\&.1\&.21\&.
547 .\" mysqlslap: engine option
548 .\" engine option: mysqlslap
549 \fB\-\-engine=\fR\fB\fIengine_name\fR\fR,
550 \fB\-e \fR\fB\fIengine_name\fR\fR
552 The storage engine to use for creating tables\&.
563 .\" mysqlslap: host option
564 .\" host option: mysqlslap
565 \fB\-\-host=\fR\fB\fIhost_name\fR\fR,
566 \fB\-h \fR\fB\fIhost_name\fR\fR
568 Connect to the MySQL server on the given host\&.
579 .\" mysqlslap: iterations option
580 .\" iterations option: mysqlslap
581 \fB\-\-iterations=\fR\fB\fIN\fR\fR,
582 \fB\-i \fR\fB\fIN\fR\fR
584 The number of times to run the tests\&.
595 .\" mysqlslap: lock-directory option
596 .\" lock-directory option: mysqlslap
597 \fB\-\-lock\-directory=\fR\fB\fIpath\fR\fR
599 The directory to use for storing locks\&. This option was added in MySQL 5\&.1\&.5 and removed in 5\&.1\&.18\&.
610 .\" mysqlslap: no-drop option
611 .\" no-drop option: mysqlslap
616 from dropping any schema it creates during the test run\&. This option was added in MySQL 5\&.1\&.57\&.
627 .\" mysqlslap: number-char-cols option
628 .\" number-char-cols option: mysqlslap
629 \fB\-\-number\-char\-cols=\fR\fB\fIN\fR\fR,
630 \fB\-x \fR\fB\fIN\fR\fR
635 \fB\-\-auto\-generate\-sql\fR
647 .\" mysqlslap: number-int-cols option
648 .\" number-int-cols option: mysqlslap
649 \fB\-\-number\-int\-cols=\fR\fB\fIN\fR\fR,
650 \fB\-y \fR\fB\fIN\fR\fR
655 \fB\-\-auto\-generate\-sql\fR
667 .\" mysqlslap: number-of-queries option
668 .\" number-of-queries option: mysqlslap
669 \fB\-\-number\-of\-queries=\fR\fB\fIN\fR\fR
671 Limit each client to approximately this many queries\&. Query counting takes into account the statement delimiter\&. For example, if you invoke
675 delimiter is recognized so that each instance of the query string counts as two queries\&. As a result, 5 rows (not 10) are inserted\&.
681 shell> \fBmysqlslap \-\-delimiter=";" \-\-number\-of\-queries=10\fR
682 \fB\-\-query="use test;insert into t values(null)"\fR
688 This option was added in MySQL 5\&.1\&.5\&.
699 .\" mysqlslap: only-print option
700 .\" only-print option: mysqlslap
701 \fB\-\-only\-print\fR
703 Do not connect to databases\&.
705 only prints what it would have done\&. This option was added in MySQL 5\&.1\&.5\&.
716 .\" mysqlslap: password option
717 .\" password option: mysqlslap
718 \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR,
719 \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR
721 The password to use when connecting to the server\&. If you use the short option form (\fB\-p\fR), you
723 have a space between the option and the password\&. If you omit the
729 option on the command line,
733 Specifying a password on the command line should be considered insecure\&. See
734 Section\ \&6.1.2.1, \(lqEnd-User Guidelines for Password Security\(rq\&. You can use an option file to avoid giving the password on the command line\&.
745 .\" mysqlslap: pipe option
746 .\" pipe option: mysqlslap
750 On Windows, connect to the server using a named pipe\&. This option applies only if the server supports named\-pipe connections\&.
761 .\" mysqlslap: port option
762 .\" port option: mysqlslap
763 \fB\-\-port=\fR\fB\fIport_num\fR\fR,
764 \fB\-P \fR\fB\fIport_num\fR\fR
766 The TCP/IP port number to use for the connection\&.
777 .\" mysqlslap: post-query option
778 .\" post-query option: mysqlslap
779 \fB\-\-post\-query=\fR\fB\fIvalue\fR\fR
781 The file or string containing the statement to execute after the tests have completed\&. This execution is not counted for timing purposes\&. This option was added in MySQL 5\&.1\&.18\&.
792 .\" mysqlslap: shared-memory-base-name option
793 .\" shared-memory-base-name option: mysqlslap
794 \fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR
796 On Windows, the shared\-memory name to use, for connections made using shared memory to a local server\&. This option applies only if the server supports shared\-memory connections\&.
807 .\" mysqlslap: post-system option
808 .\" post-system option: mysqlslap
809 \fB\-\-post\-system=\fR\fB\fIstr\fR\fR
811 The string to execute using
813 after the tests have completed\&. This execution is not counted for timing purposes\&. This option was added in MySQL 5\&.1\&.21\&.
824 .\" mysqlslap: pre-query option
825 .\" pre-query option: mysqlslap
826 \fB\-\-pre\-query=\fR\fB\fIvalue\fR\fR
828 The file or string containing the statement to execute before running the tests\&. This execution is not counted for timing purposes\&. This option was added in MySQL 5\&.1\&.18\&.
839 .\" mysqlslap: pre-system option
840 .\" pre-system option: mysqlslap
841 \fB\-\-pre\-system=\fR\fB\fIstr\fR\fR
843 The string to execute using
845 before running the tests\&. This execution is not counted for timing purposes\&. This option was added in MySQL 5\&.1\&.21\&.
856 .\" mysqlslap: preserve-schema option
857 .\" preserve-schema option: mysqlslap
858 \fB\-\-preserve\-schema\fR
860 Preserve the schema from the
863 \fB\-\-auto\-generate\-sql\fR
866 options disable this option\&. This option was added in MySQL 5\&.1\&.5 and removed in MySQL 5\&.1\&.23\&.
877 .\" mysqlslap: protocol option
878 .\" protocol option: mysqlslap
879 \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR
881 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\&. For details on the permissible values, see
882 Section\ \&4.2.2, \(lqConnecting to the MySQL Server\(rq\&.
893 .\" mysqlslap: query option
894 .\" query option: mysqlslap
895 \fB\-\-query=\fR\fB\fIvalue\fR\fR,
896 \fB\-q \fR\fB\fIvalue\fR\fR
898 The file or string containing the
900 statement to use for retrieving data\&.
911 .\" mysqlslap: silent option
912 .\" silent option: mysqlslap
916 Silent mode\&. No output\&.
927 .\" mysqlslap: slave option
928 .\" slave option: mysqlslap
931 Follow master locks for other
933 clients\&. Use this option if you are trying to synchronize around one master server with
934 \fB\-\-lock\-directory\fR
935 plus NFS\&. This option was added in MySQL 5\&.1\&.5 and removed in 5\&.1\&.18\&.
946 .\" mysqlslap: socket option
947 .\" socket option: mysqlslap
948 \fB\-\-socket=\fR\fB\fIpath\fR\fR,
949 \fB\-S \fR\fB\fIpath\fR\fR
952 localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&.
963 .\" mysqlslap: SSL options
964 .\" SSL options: mysqlslap
967 Options that begin with
969 specify whether to connect to the server using SSL and indicate where to find SSL keys and certificates\&. See
970 Section\ \&6.3.6.4, \(lqSSL Command Options\(rq\&.
981 .\" mysqlslap: use-threads option
982 .\" use-threads option: mysqlslap
983 \fB\-\-use\-threads\fR
985 On Unix, the default is to use
987 calls and this option causes
989 calls to be used instead\&. (On Windows, the default is to use
991 calls and the option has no effect\&.) This option was added in MySQL 5\&.1\&.6 and removed in 5\&.1\&.18\&.
1002 .\" mysqlslap: user option
1003 .\" user option: mysqlslap
1004 \fB\-\-user=\fR\fB\fIuser_name\fR\fR,
1005 \fB\-u \fR\fB\fIuser_name\fR\fR
1007 The MySQL user name to use when connecting to the server\&.
1012 \h'-04'\(bu\h'+03'\c
1018 .\" mysqlslap: verbose option
1019 .\" verbose option: mysqlslap
1023 Verbose mode\&. Print more information about what the program does\&. This option can be used multiple times to increase the amount of information\&.
1028 \h'-04'\(bu\h'+03'\c
1034 .\" mysqlslap: version option
1035 .\" version option: mysqlslap
1039 Display version information and exit\&.
1044 Copyright \(co 1997, 2013, Oracle and/or its affiliates. All rights reserved.
1046 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.
1048 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.
1050 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-1301 USA or see http://www.gnu.org/licenses/.
1053 For more information, please refer to the MySQL Reference Manual,
1054 which may already be installed locally and which is also available
1055 online at http://dev.mysql.com/doc/.
1057 Oracle Corporation (http://dev.mysql.com/).