From e0fa9c19101c6784c8fde8d4da7dbd8b7eb508c6 Mon Sep 17 00:00:00 2001 From: Anton Studenov Date: Wed, 26 Oct 2016 17:45:12 +0300 Subject: [PATCH] Benchmark for generate_random_name This patch adds scenario that runs generate_random_name in atomic and shows performance of this method. Change-Id: Iff2445f2d5c295a06bd2e72874280ecb1c4280f2 --- rally-jobs/plugins/rally_profile.py | 32 +++++++++++++++++++++++++++++ rally-jobs/rally.yaml | 32 +++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 rally-jobs/plugins/rally_profile.py diff --git a/rally-jobs/plugins/rally_profile.py b/rally-jobs/plugins/rally_profile.py new file mode 100644 index 00000000..09a2fb75 --- /dev/null +++ b/rally-jobs/plugins/rally_profile.py @@ -0,0 +1,32 @@ +# Copyright 2016: Mirantis Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +from rally.common import utils +from rally.task import atomic +from rally.task import scenario + + +@scenario.configure(name="RallyProfile.generate_names_in_atomic") +class GenerateNamesInAtomic(scenario.Scenario, utils.RandomNameGeneratorMixin): + + def run(self, number_of_names): + """Generate random names in atomic. + + :param number_of_names: int number of names to create + """ + with atomic.ActionTimer(self, "generate_%s_names" % number_of_names): + for i in range(number_of_names): + self.generate_random_name() diff --git a/rally-jobs/rally.yaml b/rally-jobs/rally.yaml index d160b790..c4675594 100644 --- a/rally-jobs/rally.yaml +++ b/rally-jobs/rally.yaml @@ -794,6 +794,38 @@ failure_rate: max: 0 + RallyProfile.generate_names_in_atomic: + - + args: + number_of_names: 100 + runner: + type: "constant" + times: 10 + concurrency: 5 + sla: + failure_rate: + max: 0 + - + args: + number_of_names: 1000 + runner: + type: "constant" + times: 10 + concurrency: 5 + sla: + failure_rate: + max: 0 + - + args: + number_of_names: 10000 + runner: + type: "constant" + times: 10 + concurrency: 5 + sla: + failure_rate: + max: 0 + CeilometerStats.get_stats: - runner: