@@ -0,0 +1,1947 @@
+import random%0Aimport time%0Aimport logging%0Aimport sys%0Aimport multiprocessing%0A%0Afrom os.path import dirname%0A%0Asys.path.append(dirname(dirname(__file__)))%0A%0Aimport hazelcast%0A%0ATHREAD_COUNT = 10%0AENTRY_COUNT = 10 * 1000%0AVALUE_SIZE = 100%0AGET_PERCENTAGE = 40%0APUT_PERCENTAGE = 40%0A%0Alogging.basicConfig(format='%25(asctime)s%25(msecs)03d %5B%25(name)s%5D %25(levelname)s: %25(message)s', datefmt=%22%25H:%25M%25:%25S,%22)%0Alogging.getLogger().setLevel(logging.INFO)%0Alogger = logging.getLogger(%22main%22)%0A%0Aclient_config = hazelcast.Config()%0Aclient_config.username = %22dev%22%0Aclient_config.password = %22dev-pass%22%0Aclient_config.addresses.append(%22127.0.0.1:5701%22)%0A%0A%0Aclass ClientProcess(multiprocessing.Process):%0A    def __init__(self, name, config, counts):%0A        multiprocessing.Process.__init__(self, name=name)%0A        self.counts = counts%0A        self.config = config%0A        self.daemon = True%0A%0A    def run(self):%0A        client = hazelcast.HazelcastClient(client_config)%0A        my_map = client.get_map(%22default%22)%0A        while True:%0A            key = int(random.random() * ENTRY_COUNT)%0A            operation = int(random.random() * 100)%0A            if operation %3C GET_PERCENTAGE:%0A                my_map.get(key)%0A                self.counts%5B0%5D += 1%0A            elif operation %3C GET_PERCENTAGE + PUT_PERCENTAGE:%0A                my_map.put(key, %22x%22 * VALUE_SIZE)%0A                self.counts%5B1%5D += 1%0A            else:%0A                my_map.remove(key)%0A                self.counts%5B2%5D += 1%0A%0A%0Aprocesses = %5BClientProcess(%22client-process-%25d%22 %25 i, client_config, multiprocessing.Array('i', 3)) for i in%0A           xrange(0, THREAD_COUNT)%5D%0Afor p in processes:%0A    p.start()%0A%0Astart = time.time()%0Acounter = 1%0Awhile counter %3C 1000:%0A    time.sleep(5)%0A    print %22ops per second : %22 + %5C%0A          str(sum(%5Bsum(p.counts) for p in processes%5D) / (time.time() - start))%0A    for p in processes:%0A        print (%22%25s: put: %25d get: %25d: remove: %25d%22 %25 (p.name, p.counts%5B0%5D, p.counts%5B1%5D, p.counts%5B2%5D))%0A    counter += 1%0A

add a simple test map that use multiprocessing