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