From 3ec863360930e617537832cf006828e55a73852b Mon Sep 17 00:00:00 2001 From: Stephen C Phillips <steve@scphillips.com> Date: Fri, 25 May 2018 12:11:27 +0100 Subject: [PATCH] Updates to E2ESim (WIP) --- clmctest/monitoring/E2ESim.py | 84 +++++++++++++------- clmctest/monitoring/LineProtocolGenerator.py | 8 +- 2 files changed, 61 insertions(+), 31 deletions(-) diff --git a/clmctest/monitoring/E2ESim.py b/clmctest/monitoring/E2ESim.py index a8974f8..1a62443 100644 --- a/clmctest/monitoring/E2ESim.py +++ b/clmctest/monitoring/E2ESim.py @@ -74,49 +74,75 @@ class Simulator(object): # all network delays start from 1ms, the dictionary stores the information to report paths = [ - {'target': 'SR3', - 'source': 'SR1', - 'path_id': 'SR1---SR3', - 'network_delay': 1}, - {'target': 'SR1', - 'source': 'SR3', - 'path_id': 'SR1---SR3', - 'network_delay': 1} + { + 'target': 'SR2', + 'source': 'SR1', + 'path_id': 'SR1---SR2', + 'latency': 5 + }, + { + 'target': 'SR1', + 'source': 'SR2', + 'path_id': 'SR1---SR2', + 'latency': 5 + }, + { + 'target': 'SR3', + 'source': 'SR1', + 'path_id': 'SR1---SR3', + 'latency': 15 + }, + { + 'target': 'SR1', + 'source': 'SR3', + 'path_id': 'SR1---SR3', + 'latency': 15 + } ] + service_function_instances = [ + { + 'endpoint': 'ms1.flame.org', + 'sf_instance': 'sr2.ms1.flame.org', # TODO: what did we decide the sf_instance would look like? + 'sfr': 'SR2', + 'service_delay': 40, + 'cpus': 1 + }, + { + 'endpoint': 'ms1.flame.org', + 'sf_instance': 'sr3.ms1.flame.org', # TODO: what did we decide the sf_instance would look like? + 'sfr': 'SR3', + 'service_delay': 10, + 'cpus': 4 + } + ] + + av_request_size = 10 * 1024 * 1024 # average request size measured by service function / Bytes + av_response_size = 1 * 1024 # average request size measured by service function / Bytes + # current time in seconds (to test the aggregation we write influx data points related to future time), so we start from the current time start_time = int(time.time()) sim_time = start_time - mean_delay_seconds_media = 10 # initial mean media service delay - sample_period_net = 2 # sample period for reporting network delays (measured in seconds) - net measurements reported every 2s - sample_period_media = 5 # sample period for reporting media service delays (measured in seconds) - service measurements reported every 5 seconds + sample_period_net = 1 # sample period for reporting network delays (measured in seconds) + sample_period_media = 5 # sample period for reporting media service delays (measured in seconds) for i in range(0, self.SIMULATION_LENGTH): - # measure net delay every 2 seconds for path SR1-SR3 (generates on tick 0, 2, 4, 6, 8, 10.. etc.) + # report one of the network delays every sample_period_net seconds if i % sample_period_net == 0: - path = paths[0] - self.db_client.write_points(lp.generate_network_delay_report(path['path_id'], path['source'], path['target'], path['network_delay'], sim_time)) + path = random.choice(paths) + self.db_client.write_points( + lp.generate_network_delay_report(path['path_id'], path['source'], path['target'], path['latency'], sim_time)) # increase/decrease the delay in every sample report (min delay is 1) - path['network_delay'] = max(1, path['network_delay'] + random.randint(-3, 3)) - - # measure net delay every 2 seconds for path SR2-SR3 (generates on tick 1, 3, 5, 7, 9, 11.. etc.) - if (i+1) % sample_period_net == 0: - path = paths[1] - self.db_client.write_points(lp.generate_network_delay_report(path['path_id'], path['source'], path['target'], path['network_delay'], sim_time)) + path['latency'] = max(1, path['latency'] + random.randint(-3, 3)) - # increase/decrease the delay in every sample report (min delay is 1) - path['network_delay'] = max(1, path['network_delay'] + random.randint(-3, 3)) - - # measure service response time every 5 seconds + # report one of the service_function_instance response times every sample_period_media seconds if i % sample_period_media == 0: - self.db_client.write_points(lp.generate_service_delay_report(mean_delay_seconds_media, "endpoint-1", - "ms-A.ict-flame.eu", "SR3", sim_time)) - - # increase/decrease the delay in every sample report (min delay is 10) - mean_delay_seconds_media = max(10, mean_delay_seconds_media + random.choice([random.randint(10, 20), random.randint(-20, -10)])) + service = random.choice(service_function_instances) + self.db_client.write_points(lp.generate_service_delay_report( + service['endpoint'], service['sf_instance'], service['sfr'], service['service_delay'], av_request_size, av_response_size, sim_time)) # increase the time by one simulation tick sim_time += self.TICK diff --git a/clmctest/monitoring/LineProtocolGenerator.py b/clmctest/monitoring/LineProtocolGenerator.py index 432f27d..032d027 100644 --- a/clmctest/monitoring/LineProtocolGenerator.py +++ b/clmctest/monitoring/LineProtocolGenerator.py @@ -91,14 +91,16 @@ def generate_network_delay_report(path_id, source_sfr, target_sfr, e2e_delay, ti return result -def generate_service_delay_report(response_time, endpoint, sf_instance, sfr, time): +def generate_service_delay_report(endpoint, sf_instance, sfr, response_time, request_size, response_size, time): """ Generates a service measurement about the media service response time. - :param response_time: the media service response time (This is not the response time for the whole round-trip, but only for the processing part of the media service component) :param endpoint: endpoint of the media component :param sf_instance: service function instance :param sfr: the service function router that connects the endpoint of the SF instance to the FLAME network + :param response_time: the media service response time (this is not the response time for the whole round-trip, but only for the processing part of the media service component) + :param request_size: the size of the request received by the service in Bytes + :param response_size: the size of the response received by the service in Bytes :param time: the measurement timestamp :return: a list of dict-formatted reports to post on influx """ @@ -111,6 +113,8 @@ def generate_service_delay_report(response_time, endpoint, sf_instance, sfr, tim }, "fields": { "response_time": response_time, + "request_size": request_size, + "respose_size": response_size }, "time": _getNSTime(time) }] -- GitLab