def modify_wide_network(self, topo, mean, stddev): """ Modifies wide area connections according to the network mean and standard deviation. This function will also update timing parameters of the nodes according to the tick; it will also necessarily update some of the meta information. Returns number of modifications. """ # Modifications mods = 0 # Must supply both the mean and the stddev if not mean or not stddev: raise ConsoleError( "Must supply both the wide mean and wide standard deviation!") # Compute the tick parameter and timing params tick_model = model = topo['meta'].get('tick_param_model', 'conservative') T = compute_tick(mean, stddev, tick_model) # Timing parameters for individual nodes eto = (T, 2 * T) hbi = T / 2 aed = T / 4 # Modify each node's timing parameters for node in topo['nodes']: if 'election_timeout' in node: mods += self.update_dict_value(node, 'election_timeout', eto) if 'heartbeat_interval' in node: mods += self.update_dict_value(node, 'heartbeat_interval', hbi) if 'anti_entropy_delay' in node: mods += self.update_dict_value(node, 'anti_entropy_delay', aed) # Modify the wide links only! for link in topo['links']: if link['area'] == 'wide': mods += self.update_dict_value(link, 'latency', (mean, stddev)) # Modify the meta data mods += self.update_meta_param(topo, 'tick_param_model', tick_model) mods += self.update_meta_param(topo, 'wide_latency', (mean, stddev)) mods += self.update_meta_param(topo, 'anti_entropy_delay', aed) mods += self.update_meta_param(topo, 'election_timeout', eto) mods += self.update_meta_param(topo, 'heartbeat_interval', hbi) mods += self.update_meta_param(topo, 'latency_mean', mean) mods += self.update_meta_param(topo, 'latency_stddev', stddev) mods += self.update_meta_param(topo, 'tick_metric', T) mods += self.update_meta_param( topo, 'variable', "{}-{}ms".format(mean - 2 * stddev, mean + 2 * stddev)) return mods
def modify_wide_network(self, topo, mean, stddev): """ Modifies wide area connections according to the network mean and standard deviation. This function will also update timing parameters of the nodes according to the tick; it will also necessarily update some of the meta information. Returns number of modifications. """ # Modifications mods = 0 # Must supply both the mean and the stddev if not mean or not stddev: raise ConsoleError( "Must supply both the wide mean and wide standard deviation!" ) # Compute the tick parameter and timing params tick_model = model=topo['meta'].get('tick_param_model', 'conservative') T = compute_tick(mean, stddev, tick_model) # Timing parameters for individual nodes eto = (T, 2*T) hbi = T/2 aed = T/4 # Modify each node's timing parameters for node in topo['nodes']: if 'election_timeout' in node: mods += self.update_dict_value(node, 'election_timeout', eto) if 'heartbeat_interval' in node: mods += self.update_dict_value(node, 'heartbeat_interval', hbi) if 'anti_entropy_delay' in node: mods += self.update_dict_value(node, 'anti_entropy_delay', aed) # Modify the wide links only! for link in topo['links']: if link['area'] == 'wide': mods += self.update_dict_value(link, 'latency', (mean, stddev)) # Modify the meta data mods += self.update_meta_param(topo, 'tick_param_model', tick_model) mods += self.update_meta_param(topo, 'wide_latency', (mean, stddev)) mods += self.update_meta_param(topo, 'anti_entropy_delay', aed) mods += self.update_meta_param(topo, 'election_timeout', eto) mods += self.update_meta_param(topo, 'heartbeat_interval', hbi) mods += self.update_meta_param(topo, 'latency_mean', mean) mods += self.update_meta_param(topo, 'latency_stddev', stddev) mods += self.update_meta_param(topo, 'tick_metric', T) mods += self.update_meta_param(topo, 'variable', "{}-{}ms".format( mean - 2*stddev, mean + 2*stddev) ) return mods
def tick_param(self): return compute_tick(*self.wide, model=self.tick_model)
MAX_NODES = 150 N_LOCATIONS = 5 LOCATIONS = [ 'alpha', 'bravo', 'charlie', 'delta', 'echo', 'foxtrot', 'golf', 'hotel', 'india', 'juliet', 'kilo', 'lima', 'mike', 'november', 'oscar', 'papa', 'quebec', 'romeo', 'sierra', 'tango', 'uniform', 'victor', 'whiskey', 'xray', 'yankee', 'zulu', ] WIDE_LATENCY_MU = 300 WIDE_LATENCY_SIGMA = 50 LOCAL_LATENCY_MU = 30 LOCAL_LATENCY_SIGMA = 5 TICK_MODEL = "bailis" T = compute_tick(WIDE_LATENCY_MU, WIDE_LATENCY_SIGMA, TICK_MODEL) SYSTEMS = ['eventual', 'raft'] NODE_KEYS = { "id": None, "label": None, "type": "storage", "location": None, } EVENTUAL_NODE_KEYS = { "consistency": "eventual", "anti_entropy_delay": int(round(float(T) / 4.0)), "num_neighbors": 1, }