1 # Copyright (c) 2015 Intel Research and Development Ireland Ltd.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 from experimental_framework.benchmarks import rfc2544_throughput_benchmark \
18 from experimental_framework import common
21 class MultiTenancyThroughputBenchmark(base.RFC2544ThroughputBenchmark):
23 def __init__(self, name, params):
24 base.RFC2544ThroughputBenchmark.__init__(self, name, params)
25 self.template_file = "{}{}".format(common.get_template_dir(),
26 'stress_workload.yaml')
27 self.stack_name = 'neighbour'
28 self.neighbor_stack_names = list()
30 def get_features(self):
31 features = super(MultiTenancyThroughputBenchmark, self).get_features()
32 features['description'] = \
33 'RFC 2544 Throughput calculation with ' \
34 'memory-bound noisy neighbors'
35 features['parameters'].append('num_of_neighbours')
36 features['parameters'].append('amount_of_ram')
37 features['parameters'].append('number_of_cores')
38 features['allowed_values']['num_of_neighbours'] = \
39 ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
40 features['allowed_values']['number_of_cores'] = \
41 ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
42 features['allowed_values']['amount_of_ram'] = \
43 ['256M', '1G', '2G', '3G', '4G', '5G', '6G', '7G', '8G', '9G',
45 features['default_values']['num_of_neighbours'] = '1'
46 features['default_values']['number_of_cores'] = '1'
47 features['default_values']['amount_of_ram'] = '256M'
52 Initialize the benchmark
55 common.replace_in_file(self.lua_file, 'local out_file = ""',
56 'local out_file = "' +
57 self.results_file + '"')
59 heat_param['cores'] = self.params['number_of_cores']
60 heat_param['memory'] = self.params['amount_of_ram']
61 for i in range(0, int(self.params['num_of_neighbours'])):
62 stack_name = self.stack_name + str(i)
63 common.DEPLOYMENT_UNIT.deploy_heat_template(self.template_file,
66 self.neighbor_stack_names.append(stack_name)
70 Finalizes the benchmark
73 common.replace_in_file(self.lua_file, 'local out_file = "' +
74 self.results_file + '"',
75 'local out_file = ""')
76 # destroy neighbor stacks
77 for stack_name in self.neighbor_stack_names:
78 common.DEPLOYMENT_UNIT.destroy_heat_template(stack_name)
79 self.neighbor_stack_names = list()