def setUp(self): self.stats = kv.KVStats() self.simulator = pegasus.simulator.Simulator(self.stats) rack = pegasus.node.Rack(0) # Single client node and 4 cache nodes all in one rack self.client_node = pegasus.node.Node(rack, 0) self.cache_nodes = [] for i in range(4): self.cache_nodes.append(pegasus.node.Node(rack, i+1)) config = self.StaticConfig(self.cache_nodes, None, memcachekv.WriteMode.UPDATE) # Register applications self.client_app = memcachekv.MemcacheKVClient(self.SimpleGenerator(), self.stats) self.client_app.register_config(config) self.client_node.register_app(self.client_app) self.simulator.register_config(config) self.server_apps = [] for node in self.cache_nodes: app = memcachekv.MemcacheKVServer(None, self.stats) app.register_config(config) node.register_app(app) self.server_apps.append(app) self.simulator.add_node(self.client_node) self.simulator.add_nodes(self.cache_nodes)
def setUp(self): # 1 client node and four cache nodes in the same rack rack = pegasus.node.Rack() self.cache_nodes = [] self.server_apps = [] self.stats = kv.KVStats() for i in range(self.N_CACHE_NODES): self.cache_nodes.append(pegasus.node.Node(parent = rack, id = i)) self.client_node = pegasus.node.Node(parent = rack, id = self.N_CACHE_NODES) # Single directory config with cache node 0 as the directory self.config = TestConfig(cache_nodes = self.cache_nodes, db_node = None, dir_node_id = 0) # Register apps self.client_app = pegasuskv.PegasusKVClient(generator = None, stats = self.stats) self.client_app.register_config(self.config) self.client_node.register_app(self.client_app) for node in self.cache_nodes: server_app = pegasuskv.PegasusKVServer(generator = None, stats = self.stats) server_app.register_config(self.config) node.register_app(server_app) self.server_apps.append(server_app)
def setUp(self): self.rack = pegasus.node.Rack() self.nodes = [] self.apps = [] for i in range(N_NODES): self.nodes.append(pegasus.node.Node(self.rack, i)) for node in self.nodes: app = nullrpc.NullRPC() app.register_config(nullrpc.NullRPCConfiguration(self.nodes)) self.apps.append(app) node.register_app(app)
def setUp(self): rack = pegasus.node.Rack(0) self.cache_nodes = [] self.server_apps = [] for i in range(4): self.cache_nodes.append(pegasus.node.Node(rack, i)) self.config = memcachekv.LoadBalanceConfig(self.cache_nodes, None, memcachekv.WriteMode.UPDATE, 100, 10) for node in self.cache_nodes: app = memcachekv.MemcacheKVServer(None, None) app.register_config(self.config) node.register_app(app) self.server_apps.append(app)
def setUp(self): rack = pegasus.node.Rack(0) self.cache_nodes = [] self.server_apps = [] for i in range(4): self.cache_nodes.append(pegasus.node.Node(rack, i)) self.config = self.TestConfig(self.cache_nodes, None, memcachekv.WriteMode.UPDATE, 1.5, 16) for node in self.cache_nodes: app = memcachekv.MemcacheKVServer(None, None) app.register_config(self.config) node.register_app(app) self.server_apps.append(app) self.client_node = pegasus.node.Node(rack, 4) self.stats = kv.KVStats() self.client_app = memcachekv.MemcacheKVClient(None, self.stats) self.client_app.register_config(self.config) self.client_node.register_app(self.client_app)
def setUp(self): self.simulator = pegasus.simulator.Simulator(pegasus.stats.Stats()) nodes = [] n_racks = 4 n_nodes_per_rack = 4 for i in range(n_racks): rack = pegasus.node.Rack(i) for j in range(n_nodes_per_rack): nodes.append(pegasus.node.Node(rack, j)) config = nullrpc.NullRPCConfiguration(nodes) for node in nodes: node_app = nullrpc.NullRPC() node_app.register_config(config) node.register_app(node_app) self.simulator.add_nodes(nodes) self.simulator.register_config(config)
if args.configtype == 'routing': server_app = memcachekv.MemcacheKVMigrationServer(None, stats) else: server_app = memcachekv.MemcacheKVServer(None, stats) elif args.app == 'pegasus': config = pegasuskv.SingleDirectoryConfig( cache_nodes, None, 0) # cache node 0 as directory client_app = pegasuskv.PegasusKVClient(generator, stats) server_app = pegasuskv.PegasusKVServer(None, stats) client_app.register_config(config) client_node.register_app(client_app) for node in cache_nodes: app = copy.deepcopy(server_app) app.register_config(config) node.register_app(app) # Add nodes and config to simulator simulator.add_node(client_node) simulator.add_nodes(cache_nodes) simulator.register_config(config) # Run simulation simulator.run(args.duration * 1000000) total_ops, latencies, all_epoch_latencies = stats.dump() # Dump latency CDF if len(args.cdffile) > 0: with open(args.cdffile, 'w') as f: count = 0 for latency in sorted(latencies.keys()):