示例#1
0
    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)
示例#2
0
 def setUp(self):
     rack = pegasus.node.Rack()
     self.client = pegasus.node.Node(rack, 0)
     self.server = pegasus.node.Node(rack, 1)
     self.stats = kv.KVStats()
     config = self.SingleServerConfig([self.server], None, memcachekv.WriteMode.UPDATE)
     self.client_app = memcachekv.MemcacheKVClient(None,
                                                   self.stats)
     self.client_app.register_config(config)
     self.server_app = memcachekv.MemcacheKVServer(None,
                                                   self.stats)
     self.server_app.register_config(config)
     self.client.register_app(self.client_app)
     self.server.register_app(self.server_app)
示例#3
0
 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)
示例#4
0
 def setUp(self):
     rack = pegasus.node.Rack()
     self.servers = []
     self.server_apps = []
     for i in range(4):
         self.servers.append(pegasus.node.Node(rack, i))
     self.client = pegasus.node.Node(rack, 4)
     self.stats = kv.KVStats()
     self.config = self.TestConfig(self.servers, None, memcachekv.WriteMode.UPDATE)
     self.client_app = memcachekv.MemcacheKVClient(None,
                                                   self.stats)
     self.client_app.register_config(self.config)
     self.client.register_app(self.client_app)
     for server in self.servers:
         app = memcachekv.MemcacheKVServer(None,
                                           self.stats)
         app.register_config(self.config)
         self.server_apps.append(app)
         server.register_app(app)
示例#5
0
            config = memcachekv.DynamicCHConfig(cache_nodes, None, write_mode,
                                                args.loadbound, args.hashspace)
        elif args.configtype == 'cot':
            config = memcachekv.CoTConfig(cache_nodes, None, write_mode)
        elif args.configtype == 'con':
            config = memcachekv.CoNConfig(cache_nodes, None, write_mode,
                                          args.ncon)
        elif args.configtype == 'tkr':
            config = memcachekv.TopKeysReplicatedConfig(
                cache_nodes, None, write_mode, args.nrkeys, args.ncon)
        elif args.configtype == 'dtkr':
            assert args.loadbound >= 1.0
            config = memcachekv.DynamicTKRConfig(cache_nodes, None, write_mode,
                                                 args.nrkeys, args.loadbound)

        client_app = memcachekv.MemcacheKVClient(generator, stats)
        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)