Browse Source

Enrich sysbench-oltp scenario

* Collect latency stats
* Update report template

Change-Id: Ie29bc0a0b25261f0bdf966731aab8eb22c6880ba
Ilya Shakhat 3 years ago
parent
commit
03b81b9f4c

+ 15
- 0
performa/modules/sysbench_oltp.py View File

@@ -10,12 +10,21 @@ TEST_STATS = re.compile(
10 10
     '\s+total:\s+(?P<queries_total>\d+).*\n',
11 11
     flags=re.MULTILINE | re.DOTALL
12 12
 )
13
+LATENCY_STATS = re.compile(
14
+    '\s+per-request statistics:\s*\n'
15
+    '\s+min:\s+(?P<latency_min>[\d\.]+)ms\s*\n'
16
+    '\s+avg:\s+(?P<latency_avg>[\d\.]+)ms\s*\n'
17
+    '\s+max:\s+(?P<latency_max>[\d\.]+)ms\s*\n'
18
+    '\s+approx.+:\s+(?P<latency_95p>[\d\.]+)ms\s*\n',
19
+    flags=re.MULTILINE | re.DOTALL
20
+)
13 21
 PATTERNS = [
14 22
     r'sysbench (?P<version>[\d\.]+)',
15 23
     TEST_STATS,
16 24
     r'\s+transactions:\s+(?P<transactions>\d+).*\n',
17 25
     r'\s+deadlocks:\s+(?P<deadlocks>\d+).*\n',
18 26
     r'\s+total time:\s+(?P<duration>[\d\.]+).*\n',
27
+    LATENCY_STATS,
19 28
 ]
20 29
 TRANSFORM_FIELDS = {
21 30
     'queries_read': int,
@@ -25,6 +34,10 @@ TRANSFORM_FIELDS = {
25 34
     'duration': float,
26 35
     'transactions': int,
27 36
     'deadlocks': int,
37
+    'latency_min': float,
38
+    'latency_avg': float,
39
+    'latency_max': float,
40
+    'latency_95p': float,
28 41
 }
29 42
 
30 43
 
@@ -49,6 +62,7 @@ def main():
49 62
             threads=dict(type='int', default=10),
50 63
             duration=dict(type='int', default=10),
51 64
             mysql_host=dict(default='localhost'),
65
+            mysql_port=dict(type='int', default=3306),
52 66
             mysql_db=dict(default='sbtest'),
53 67
             oltp_table_name=dict(default='sbtest'),
54 68
             oltp_table_size=dict(type='int', default=100000),
@@ -63,6 +77,7 @@ def main():
63 77
            '--max-time=%(duration)s '
64 78
            '--max-requests=0 '
65 79
            '--mysql-host=%(mysql_host)s '
80
+           '--mysql-port=%(mysql_port)s '
66 81
            '--mysql-db=%(mysql_db)s '
67 82
            '--oltp-table-name=%(oltp_table_name)s '
68 83
            '--oltp-table-size=%(oltp_table_size)s '

+ 63
- 23
performa/scenarios/db/sysbench.rst View File

@@ -1,56 +1,96 @@
1 1
 Sysbench Report
2 2
 ---------------
3 3
 
4
-This is the report of execution test plan
5
-:ref:`sql_db_test_plan` with `Sysbench`_ tool.
4
+This scenario is executed with `Sysbench`_ tool. There is one instance of
5
+tool per tester node, each running in N threads.
6 6
 
7
-Results
8
-^^^^^^^
7
+Throughput
8
+^^^^^^^^^^
9 9
 
10
-**Queries per second depending on threads count**
10
+The following chart shows the number of queries, read queries and transactions
11
+depending on total thread count.
11 12
 
12 13
 {{'''
13
-    title: Queries per second
14
+    title: Throughput
14 15
     axes:
15 16
       x: threads
16
-      y: queries per sec
17
+      y1: queries per sec
17 18
       y2: read queries per sec
19
+      y3: transactions per sec
18 20
     chart: line
19 21
     pipeline:
20
-    - $match: { task: sysbench_oltp, status: OK }
21
-    - $group: { _id: { threads: "$threads" },
22
-                queries_total_per_sec: { $avg: { $divide: ["$queries_total", "$duration"] }},
23
-                queries_read_per_sec: { $avg: { $divide: ["$queries_read", "$duration"] }}
24
-              }
22
+    - $match: { task: sysbench_oltp }
23
+    - $group:
24
+        _id: { threads: { $multiply: [ "$threads", "$host_count" ] } }
25
+        queries_total_per_sec: { $sum: { $divide: ["$queries_total", "$duration"] }}
26
+        queries_read_per_sec: { $sum: { $divide: ["$queries_read", "$duration"] }}
27
+        transactions_per_sec: { $sum: { $divide: ["$transactions", "$duration"] }}
25 28
     - $project:
26 29
         x: "$_id.threads"
27
-        y: "$queries_total_per_sec"
30
+        y1: "$queries_total_per_sec"
28 31
         y2: "$queries_read_per_sec"
32
+        y3: "$transactions_per_sec"
29 33
 ''' | chart_and_table
30 34
 }}
31 35
 
32
-**Queries per second and mysqld CPU consumption depending on threads count**
36
+
37
+Throughput and server CPU consumption
38
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39
+
40
+The following chart shows how DB server CPU consumption depends on number
41
+of concurrent threads and throughput.
33 42
 
34 43
 {{'''
35
-    title: Queries and and CPU util per second
44
+    title: CPU consumption
36 45
     axes:
37 46
       x: threads
38
-      y: queries per sec
39
-      y2: mysqld CPU consumption, %
47
+      y1: queries per sec
48
+      y2: CPU, %
40 49
     chart: line
41 50
     pipeline:
42
-    - $match: { task: sysbench_oltp, status: OK }
43
-    - $group: { _id: { threads: "$threads" },
44
-                queries_total_per_sec: { $avg: { $divide: ["$queries_total", "$duration"] }},
45
-                mysqld_total: { $avg: "$mysqld_total" }
46
-              }
51
+    - $match: { task: sysbench_oltp }
52
+    - $group:
53
+        _id: { threads: { $multiply: [ "$threads", "$host_count" ] } }
54
+        queries_total_per_sec: { $sum: { $divide: ["$queries_total", "$duration"] }}
55
+        mysqld_total: { $avg: "$mysqld_total" }
47 56
     - $project:
48 57
         x: "$_id.threads"
49
-        y: "$queries_total_per_sec"
58
+        y1: "$queries_total_per_sec"
50 59
         y2: { $multiply: [ "$mysqld_total", 100 ] }
51 60
 ''' | chart_and_table
52 61
 }}
53 62
 
63
+
64
+Operation latency
65
+^^^^^^^^^^^^^^^^^
66
+
67
+The following chart shows how operation latency depends on number of
68
+concurrent threads.
69
+
70
+{{'''
71
+    title: Latency
72
+    axes:
73
+      x: threads
74
+      y1: min latency, ms
75
+      y2: avg latency, ms
76
+      y3: max latency, ms
77
+    chart: line
78
+    pipeline:
79
+    - $match: { task: sysbench_oltp }
80
+    - $group:
81
+        _id: { threads: { $multiply: [ "$threads", "$host_count" ] } }
82
+        latency_min: { $min: "$latency_min" }
83
+        latency_avg: { $avg: "$latency_avg" }
84
+        latency_max: { $max: "$latency_max" }
85
+    - $project:
86
+        x: "$_id.threads"
87
+        y1: "$latency_min"
88
+        y2: "$latency_avg"
89
+        y3: "$latency_max"
90
+''' | chart_and_table
91
+}}
92
+
93
+
54 94
 .. references:
55 95
 
56 96
 .. _Sysbench: https://github.com/akopytov/sysbench

+ 7
- 3
performa/scenarios/db/sysbench.yaml View File

@@ -6,6 +6,8 @@ description:
6 6
 parameters:
7 7
   tester_hosts: List of hosts were omsimulator will be executed
8 8
   mysql_hosts: List of hosts were MySQL runs
9
+  mysql_endpoint: Address of MySQL endpoint
10
+  mysql_port: MySQL port number
9 11
 
10 12
 setup:
11 13
   -
@@ -30,11 +32,12 @@ execution:
30 32
   -
31 33
     hosts: {{ tester_hosts }}
32 34
     matrix:
33
-      threads: [ 10, 20, 50, 70, 100, 150, 200, 300 ]
35
+      threads: [ 5, 10, 15, 20, 30, 40, 50 ]
34 36
     tasks:
35 37
     - sysbench_oltp:
36 38
         duration: 60
37
-        mysql_host: localhost
39
+        mysql_host: {{ mysql_endpoint }}
40
+        mysql_port: {{ mysql_port }}
38 41
         mysql_db: sbtest
39 42
   -
40 43
     hosts: {{ mysql_hosts }}
@@ -51,7 +54,8 @@ aggregation:
51 54
       values:
52 55
         pipeline:
53 56
         - { $match: { task: atop, status: OK, label: PRC, name: mysqld }}
54
-        - { $group: { _id: null, mysqld_sys: { $avg: "$sys" }, mysqld_user: { $avg: "$user" }, mysqld_total: { $avg: { $add: [ "$sys", "$user" ] }} }}
57
+        - { $group: { _id: "$host", mysqld_sys: { $avg: "$sys" }, mysqld_user: { $avg: "$user" }, mysqld_total: { $avg: { $add: [ "$sys", "$user" ] }} }}
58
+        - { $group: { _id: null, mysqld_sys: { $sum: "$mysqld_sys"}, mysqld_user: { $sum: "$mysqld_user" }, mysqld_total: { $sum: "$mysqld_total" }}}
55 59
 
56 60
 report:
57 61
   template: sysbench.rst

+ 0
- 5
performa/tests/omsimulator_sample.txt View File

@@ -1,5 +0,0 @@
1
-2016-02-29 10:33:51,044 INFO root Preparing 1 messages
2
-2016-02-29 10:33:51,046 INFO root Messages has been prepared
3
-2016-02-29 10:34:01,062 INFO root 5313 messages were sent for 10 seconds. Bandwidth was 530 msg/sec
4
-2016-02-29 10:34:01,062 INFO root 14897652 bytes were sent for 10 seconds. Bandwidth is 1487420 b/s
5
-2016-02-29 10:34:01,062 INFO root calls finished, wait 0 seconds

+ 4
- 0
performa/tests/test_sysbench.py View File

@@ -72,6 +72,10 @@ class TestSysbench(testtools.TestCase):
72 72
             'transactions': 665,
73 73
             'deadlocks': 0,
74 74
             'duration': 60.8074,
75
+            'latency_min': 876.31,
76
+            'latency_avg': 1816.63,
77
+            'latency_max': 3792.73,
78
+            'latency_95p': 2886.19,
75 79
         }
76 80
 
77 81
         self.assertEqual(expected, sysbench.parse_sysbench_oltp(OLTP_OUTPUT))

Loading…
Cancel
Save