1
2Overview
3--------
4
5The stress script is designed to perform testing of the MySQL server in
6a multi-threaded environment.
7
8All functionality regarding stress testing is implemented in the
9mysql-stress-test.pl script.
10
11The stress script allows:
12
13 - To stress test the mysqltest binary test engine.
14 - To stress test the regular test suite and any additional test suites
15   (such as mysql-test-extra-5.0).
16 - To specify files with lists of tests both for initialization of
17   stress db and for further testing itself.
18 - To define the number of threads to be concurrently used in testing.
19 - To define limitations for the test run. such as the number of tests or
20   loops for execution or duration of testing, delay between test
21   executions, and so forth.
22 - To get a readable log file that can be used for identification of
23   errors that occur during testing.
24
25There are two ways to run the mysql-stress-test.pl script:
26
27 - For most cases, it is enough to use the options below for starting
28   the stress test from the mysql-test-run wrapper. In this case, the
29   server is run automatically, all preparation steps are performed,
30   and after that the stress test is started.
31
32 - In advanced case, you can run the mysql-stress-test.pl script directly.
33   But this requires that you perform some preparation steps and to specify
34   a bunch of options as well, so this invocation method may be a bit
35   complicated.
36
37Usage
38-----
39
40The following mysql-test-run options are specific to stress-testing:
41
42--stress
43  Enable stress mode
44
45--stress-suite=<suite name>
46  Test suite name to use in stress testing.  We assume that all suites
47  are located in the mysql-test/suite directory.
48  There is one special suite name - <main|default> that corresponds
49  to the regular test suite located in the mysql-test directory.
50
51--stress-threads=<number of threads>
52  The number of threads to use in stress testing.
53
54--stress-tests-file=<filename with list of tests>
55  The file that contains the list of tests (without .test suffix) to use in
56  stress testing. The default filename is stress_tests.txt and the default
57  location of this file is suite/<suite name>/stress_tests.txt
58
59--stress-init-file=<filename with list of tests>
60  The file that contains list of tests (without .test suffix) to use in
61  stress testing for initialization of the stress db. These tests will be
62  executed only once before starting the test itself. The default filename
63  is stress_init.txt and the default location of this file is
64  suite/<suite name>/stress_init.txt
65
66--stress-mode=<method which will be used for choosing tests from the list>
67  Possible values are: random(default), seq
68
69  There are two possible modes that affect the order of test selection
70  from the list:
71    - In random mode, tests are selected in random order
72    - In seq mode, each thread executes tests in a loop one by one in
73	  the order specified in the list file.
74
75--stress-test-count=<number>
76  Total number of tests that will be executed concurrently by all threads
77
78--stress-loop-count=<number>
79  Total number of loops in seq mode that will be executed concurrently
80  by all threads
81
82--stress-test-duration=<number>
83  Duration of stress testing in seconds
84
85Examples
86--------
87
881. Example of a simple command line to start a stress test:
89
90 mysql-test-run --stress alias
91
92Runs a stress test with default values for number of threads and number
93of tests, with test 'alias' from suite 'main'.
94
952. Using in stress testing tests from other suites:
96
97 - mysql-test-run --stress --stress-threads=10 --stress-test-count=1000 \
98                 --stress-suite=example  --stress-tests-file=testslist.txt
99
100   Runs a stress test with 10 threads, executes 1000 tests by all
101   threads, tests are used from suite 'example', the list of tests is
102   taken from file 'testslist.txt'
103
104 - mysql-test-run --stress --stress-threads=10 --stress-test-count=1000 \
105                  --stress-suite=example sum_distinct
106
107   Runs stress test with 10 threads, executes 1000 tests by all
108   threads, tests are used from suite 'example', the list of tests
109   contains only one test 'sum_distinct'
110
1113. Debugging of issues found with stress test
112
113 Right now, the stress test is not fully integrated in mysql-test-run
114 and does not support the --gdb option. To debug issues found with the
115 stress test, you must start the MySQL server separately under a debugger
116 and then run the stress test like this:
117
118 - mysql-test-run --extern --stress --stress-threads=10 \
119                  --stress-test-count=1000 --stress-suite=example \
120                  sum_distinct
121