Add omsimulator HA tests

This commit is contained in:
Ilya Shakhat 2016-03-17 17:47:03 +03:00
parent b11a1eb147
commit e41e4212d8
5 changed files with 189 additions and 6 deletions

View File

@ -33,13 +33,16 @@ from performa.engine import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
def generate_chart(chart_str, records_collection, doc_folder, tag): def generate_chart(chart_str, db, doc_folder, tag):
chart = yaml.safe_load(chart_str) chart = yaml.safe_load(chart_str)
pipeline = chart.get('pipeline') pipeline = chart.get('pipeline')
title = chart.get('title') title = chart.get('title')
fill = chart.get('fill') or False fill = chart.get('fill') or False
axes = chart.get('axes') or dict(x='x', y='y') axes = chart.get('axes') or dict(x='x', y='y')
collection_name = chart.get('collection') or 'records'
collection = db.get_collection(collection_name)
LOG.debug('Title: %s', title) LOG.debug('Title: %s', title)
pipeline.insert(0, {'$match': {'status': 'OK'}}) pipeline.insert(0, {'$match': {'status': 'OK'}})
@ -47,7 +50,7 @@ def generate_chart(chart_str, records_collection, doc_folder, tag):
if tag: if tag:
pipeline.insert(0, {'$match': {'tag': tag}}) pipeline.insert(0, {'$match': {'tag': tag}})
chart_data = records_collection.aggregate(pipeline) chart_data = collection.aggregate(pipeline)
lines = collections.defaultdict(list) lines = collections.defaultdict(list)
@ -66,7 +69,7 @@ def generate_chart(chart_str, records_collection, doc_folder, tag):
for k in y_keys: for k in y_keys:
lines[k].append((chart_rec['x'], chart_rec[k])) lines[k].append((chart_rec['x'], chart_rec[k]))
table += (' *\n' + table += (' *\n' +
'\n'.join(' - %.1f' % chart_rec[v] '\n'.join(' - %.1f' % (chart_rec[v] or 0)
for v in sorted(axes.keys())) + for v in sorted(axes.keys())) +
'\n') '\n')
@ -112,8 +115,6 @@ def generate_report(scenario, base_dir, mongo_url, db_name, doc_folder,
mongo_client = pymongo.MongoClient(**connection_params) mongo_client = pymongo.MongoClient(**connection_params)
db = mongo_client.get_database(db_name) db = mongo_client.get_database(db_name)
records_collection = db.get_collection('records')
report_definition = scenario['report'] report_definition = scenario['report']
report_template = report_definition['template'] report_template = report_definition['template']
@ -124,7 +125,7 @@ def generate_report(scenario, base_dir, mongo_url, db_name, doc_folder,
jinja_env = jinja2.Environment() jinja_env = jinja2.Environment()
jinja_env.filters['chart'] = functools.partial( jinja_env.filters['chart'] = functools.partial(
generate_chart, generate_chart,
records_collection=records_collection, db=db,
doc_folder=doc_folder, doc_folder=doc_folder,
tag=tag) tag=tag)

View File

@ -0,0 +1,47 @@
Oslo.messaging simulator HA report
----------------------------------
This report is result of `message_queue_performance`_ execution
with `Oslo.messaging Simulator`_
Test Case 1: RPC CALL Throughput Test
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**Messages sent by the client**
{{'''
title: RPC CALL sent messages
axes:
x: time
y: sent, msg
chart: line
collection: series
pipeline:
- { $match: { task: omsimulator, mode: call, name: client_0 }}
- { $project: { x: "$seq",
y: "$count"
}}
- { $sort: { x: 1 }}
''' | chart
}}
**Replies received by the client**
{{'''
title: RPC CALL round-trip messages
axes:
x: time
y: round-trip, msg
y2: latency, ms
chart: line
collection: series
pipeline:
- { $match: { task: omsimulator, mode: call, name: round_trip_0 }}
- { $project: { x: "$seq",
y: "$count",
y2: { $multiply: ["$latency", 1000] }
}}
- { $sort: { x: 1 }}
''' | chart
}}

View File

@ -0,0 +1,44 @@
title: OMSimulator HA test
description:
This scenario uses oslo.messaging simulator tool to execute MQ test plan.
parameters:
tester_hosts: List of hosts were omsimulator will be executed
rabbit_url: RabbitMQ address
setup:
-
hosts: {{ tester_hosts }}
tasks:
- apt: name=git
become: yes
- apt: name=daemon
become: yes
- name: installing omsimulator
git: repo=git://git.openstack.org/openstack/oslo.messaging
dest=/tmp/performa/oslo.messaging
- apt: name=python-dev
become: yes
- apt: name=python-pip
become: yes
- pip: name=virtualenv
become: yes
- pip: requirements=/tmp/performa/oslo.messaging/requirements.txt virtualenv=/tmp/performa/oslo.messaging/.venv
- pip: name=eventlet virtualenv=/tmp/performa/oslo.messaging/.venv
- command: /tmp/performa/oslo.messaging/.venv/bin/python setup.py install
args:
chdir: /tmp/performa/oslo.messaging
execution:
-
hosts: {{ tester_hosts }}
tasks:
- omsimulator:
mode: call
duration: 100
threads: 1
url: {{ rabbit_url }}
report:
template: omsimulator-ha-call.rst

View File

@ -0,0 +1,47 @@
Oslo.messaging simulator HA report
----------------------------------
This report is result of `message_queue_performance`_ execution
with `Oslo.messaging Simulator`_
Test Case 1: RPC CAST Throughput Test
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**Messages sent by the client**
{{'''
title: RPC CAST sent messages
axes:
x: time
y: sent, msg
chart: line
collection: series
pipeline:
- { $match: { task: omsimulator, mode: cast, name: client_0 }}
- { $project: { x: "$seq",
y: "$count"
}}
- { $sort: { x: 1 }}
''' | chart
}}
**Messages received by the server**
{{'''
title: RPC CAST received messages
axes:
x: time
y: round-trip, msg
y2: latency, ms
chart: line
collection: series
pipeline:
- { $match: { task: omsimulator, mode: cast, name: server }}
- { $project: { x: "$seq",
y: "$count",
y2: { $multiply: ["$latency", 1000] }
}}
- { $sort: { x: 1 }}
''' | chart
}}

View File

@ -0,0 +1,44 @@
title: OMSimulator HA test
description:
This scenario uses oslo.messaging simulator tool to execute MQ test plan.
parameters:
tester_hosts: List of hosts were omsimulator will be executed
rabbit_url: RabbitMQ address
setup:
-
hosts: {{ tester_hosts }}
tasks:
- apt: name=git
become: yes
- apt: name=daemon
become: yes
- name: installing omsimulator
git: repo=git://git.openstack.org/openstack/oslo.messaging
dest=/tmp/performa/oslo.messaging
- apt: name=python-dev
become: yes
- apt: name=python-pip
become: yes
- pip: name=virtualenv
become: yes
- pip: requirements=/tmp/performa/oslo.messaging/requirements.txt virtualenv=/tmp/performa/oslo.messaging/.venv
- pip: name=eventlet virtualenv=/tmp/performa/oslo.messaging/.venv
- command: /tmp/performa/oslo.messaging/.venv/bin/python setup.py install
args:
chdir: /tmp/performa/oslo.messaging
execution:
-
hosts: {{ tester_hosts }}
tasks:
- omsimulator:
mode: cast
duration: 100
threads: 1
url: {{ rabbit_url }}
report:
template: omsimulator-ha-cast.rst