From 1aa8d702e119edaa9c7da20ec74de2ab5111a936 Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Wed, 25 Feb 2015 17:22:48 +0300 Subject: [PATCH] Cleanup iperf graph reporting Change-Id: I820bcbb6f6568a338427f4cd33ee795b35e832fc --- README.rst | 6 +-- scenarios/networking/{same_net.hot => l2.hot} | 0 .../networking/{same_net.yaml => l2.yaml} | 3 +- .../{two_nets.hot => l3_east_west.hot} | 5 +++ scenarios/networking/l3_east_west.yaml | 26 +++++++++++ scenarios/networking/two_nets.yaml | 24 ---------- scenarios/networking/two_routers.hot | 5 +++ scenarios/networking/two_routers.yaml | 7 ++- shaker/engine/executors.py | 40 +++++++++-------- shaker/engine/report.template | 44 ++++++++++++------- shaker/engine/server.py | 4 +- tests/test_iperf_graph_executor.py | 26 +++++------ 12 files changed, 110 insertions(+), 80 deletions(-) rename scenarios/networking/{same_net.hot => l2.hot} (100%) rename scenarios/networking/{same_net.yaml => l2.yaml} (94%) rename scenarios/networking/{two_nets.hot => l3_east_west.hot} (96%) create mode 100644 scenarios/networking/l3_east_west.yaml delete mode 100644 scenarios/networking/two_nets.yaml diff --git a/README.rst b/README.rst index 6b8e5d6..c79afc6 100644 --- a/README.rst +++ b/README.rst @@ -7,9 +7,9 @@ Installation ------------ The tool consists of a single server running on master node and set of dynamically - provisioned agents. In order to run the server needs to know OpenStack parameters - (credentials, auth_url), they can be set via environment (e.g. by sourcing openrc file) - or via parameters. +provisioned agents. In order to run the server needs to know OpenStack parameters +(credentials, auth_url), they can be set via environment (e.g. by sourcing openrc file) +or via parameters. To install: 1. ``git clone git://git.openstack.org/stackforge/shaker`` diff --git a/scenarios/networking/same_net.hot b/scenarios/networking/l2.hot similarity index 100% rename from scenarios/networking/same_net.hot rename to scenarios/networking/l2.hot diff --git a/scenarios/networking/same_net.yaml b/scenarios/networking/l2.yaml similarity index 94% rename from scenarios/networking/same_net.yaml rename to scenarios/networking/l2.yaml index 72183bf..c16f069 100644 --- a/scenarios/networking/same_net.yaml +++ b/scenarios/networking/l2.yaml @@ -12,11 +12,12 @@ execution: title: Iperf TCP test class: iperf_graph time: 60 + mss: 1300 - title: Iperf UDP 5 threads class: iperf udp: 1 - mss: 1406 + mss: 1300 threads: 5 - title: Netperf TCP_STREAM diff --git a/scenarios/networking/two_nets.hot b/scenarios/networking/l3_east_west.hot similarity index 96% rename from scenarios/networking/two_nets.hot rename to scenarios/networking/l3_east_west.hot index 16b2d61..cc7d264 100644 --- a/scenarios/networking/two_nets.hot +++ b/scenarios/networking/l3_east_west.hot @@ -79,6 +79,10 @@ resources: port_range_min: 1, port_range_max: 65535}, {remote_ip_prefix: 0.0.0.0/0, + protocol: udp, + port_range_min: 1, + port_range_max: 65535}, + {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}] {% for group in groups %} @@ -124,6 +128,7 @@ resources: template: | #!/bin/sh screen -dmS shaker-agent shaker-agent --server-endpoint=$SERVER_ENDPOINT --debug + screen -dmS sudo nice -n -20 iperf -s --nodelay params: "$SERVER_ENDPOINT": { get_param: server_endpoint } diff --git a/scenarios/networking/l3_east_west.yaml b/scenarios/networking/l3_east_west.yaml new file mode 100644 index 0000000..815db9b --- /dev/null +++ b/scenarios/networking/l3_east_west.yaml @@ -0,0 +1,26 @@ +description: + This scenario launches pairs of in the different networks connected to one + router (L3 east-west) + +deployment: + template: scenarios/networking/l3_east_west.hot + vm_accommodation: [pair, single_room] + +execution: + tests: + - + title: Iperf TCP + class: iperf_graph + time: 60 + mss: 1300 + - + title: Iperf UDP 5 threads + class: iperf + udp: 1 + mss: 1300 + threads: 5 + - + title: Netperf TCP + class: netperf + method: TCP_STREAM + time: 60 diff --git a/scenarios/networking/two_nets.yaml b/scenarios/networking/two_nets.yaml deleted file mode 100644 index f1afc6b..0000000 --- a/scenarios/networking/two_nets.yaml +++ /dev/null @@ -1,24 +0,0 @@ -description: - This scenario launches pairs of VMs on the same compute node. VMs are in - the different networks connected in one router - -deployment: - template: scenarios/networking/two_nets.hot - vm_accommodation: [pair, double_room] - -execution: - size: 'quadratic_progression' - tests: - - - title: iperf TCP test - class: iperf - time: 60 - - - class: iperf - udp: 1 - mss: 1406 - threads: 5 - - - class: netperf - method: TCP_STREAM - time: 60 diff --git a/scenarios/networking/two_routers.hot b/scenarios/networking/two_routers.hot index 4f1eee8..28a7c53 100644 --- a/scenarios/networking/two_routers.hot +++ b/scenarios/networking/two_routers.hot @@ -85,6 +85,10 @@ resources: port_range_min: 1, port_range_max: 65535}, {remote_ip_prefix: 0.0.0.0/0, + protocol: udp, + port_range_min: 1, + port_range_max: 65535}, + {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}] {% for group in groups %} @@ -130,6 +134,7 @@ resources: template: | #!/bin/sh screen -dmS shaker-agent shaker-agent --server-endpoint=$SERVER_ENDPOINT --debug + screen -dmS sudo nice -n -20 iperf -s --nodelay params: "$SERVER_ENDPOINT": { get_param: server_endpoint } diff --git a/scenarios/networking/two_routers.yaml b/scenarios/networking/two_routers.yaml index ec297b9..247d49b 100644 --- a/scenarios/networking/two_routers.yaml +++ b/scenarios/networking/two_routers.yaml @@ -11,15 +11,18 @@ execution: size: 'quadratic_progression' tests: - - title: iperf TCP test - class: iperf + title: Iperf TCP + class: iperf_graph time: 60 + mss: 1300 - + title: Iperf UDP class: iperf udp: 1 mss: 1406 threads: 5 - + title: Netperf TCP class: netperf method: TCP_STREAM time: 60 diff --git a/shaker/engine/executors.py b/shaker/engine/executors.py index 25aa1c9..1ab6b86 100644 --- a/shaker/engine/executors.py +++ b/shaker/engine/executors.py @@ -81,6 +81,10 @@ class IperfExecutor(BaseExecutor): interval=interval and '--interval %s' % interval or '')) +def _calc_stats(array): + return dict(max=max(array), min=min(array), avg=sum(array) / len(array)) + + class IperfGraphExecutor(IperfExecutor): def get_command(self): self.test_definition['css'] = True @@ -91,32 +95,30 @@ class IperfGraphExecutor(IperfExecutor): result = super(IperfGraphExecutor, self).process_reply(message) samples = collections.defaultdict(list) + streams = {} + stream_count = 0 for row in csv.reader(result['stdout'].split('\n')): if row: thread = row[5] - samples[thread].append(dict( - time=float(row[6].split('-')[1]), - transfer=int(row[7]), - bandwidth=int(row[8]), - )) + if thread not in streams: + streams[thread] = stream_count + stream_count += 1 + + samples['time'].append(float(row[6].split('-')[1])) + samples['bandwidth_%s' % streams[thread]].append( + float(row[8]) / 1024 / 1024) + + # the last line is summary, remove its items + for arr in samples.values(): + arr.pop() result['samples'] = samples - # calc max, min, avg per thread - bandwidth_max = collections.defaultdict(float) - bandwidth_min = collections.defaultdict(float) - bandwidth_avg = collections.defaultdict(float) - - for thread, data in samples.items(): - arr = [s['bandwidth'] for s in samples[thread]] - bandwidth_max[thread] = max(arr) - bandwidth_min[thread] = min(arr) - bandwidth_avg[thread] = sum(arr) / len(arr) - - result['bandwidth_max'] = bandwidth_max - result['bandwidth_min'] = bandwidth_min - result['bandwidth_avg'] = bandwidth_avg + # todo calculate stats correctly for multiple threads + for stream in streams.values(): + result['stats'] = _calc_stats( + samples['bandwidth_%s' % stream]) return result diff --git a/shaker/engine/report.template b/shaker/engine/report.template index 553341d..e123cbb 100644 --- a/shaker/engine/report.template +++ b/shaker/engine/report.template @@ -18,8 +18,8 @@ - - + +