Пример #1
0
def run(rq, host, port, sleep, minsize, maxsize):
    client = Client(host, port)
    k = key()
    while True:
        s = {'collisions': 0, 'get': [], 'put': []}
        st = time.time()
        cur = client.get(k)
        taken = time.time() - st
        s['get'].append(taken)
        if len(cur.results) > 1:
            s['collisions'] += 1
        nval = rval(minsize, maxsize)
        st = time.time()
        client.put(k, nval, cur.context)
        taken = time.time() - st
        s['put'].append(taken)
        rq.put(s)
        time.sleep(random.uniform(0, sleep))
Пример #2
0
def run(rq, host, port, sleep, minsize, maxsize):
    client = Client(host, port)
    k = key()
    while True:
        s = {'collisions': 0,
             'get': [],
             'put': []}
        st = time.time()
        cur = client.get(k)
        taken = time.time() - st
        s['get'].append(taken)
        if len(cur.results) > 1:
            s['collisions'] += 1
        nval = rval(minsize, maxsize)
        st = time.time()
        client.put(k, nval, cur.context)
        taken = time.time() - st
        s['put'].append(taken)
        rq.put(s)
        time.sleep(random.uniform(0, sleep))
Пример #3
0
def run(num, rq, ks, vs):
    res = {'requests': 0, 'get': [], 'put': []}

    keys = "abcdefghijklmnop"

    client = Client('localhost', choice(ports))

    for i in range(0, num):
        tk = 0.0
        key = ''.join([choice(keys) for i in range(0, ks)])
        st = time()
        cur = client.get(key)
        tk += time() - st
        res['get'].append(tk)
        newval = rval(vs)
        st = time()
        client.put(key, newval, cur.context)
        tk += time() - st
        res['requests'] += 1
        res['put'].append(tk)
    rq.put(res)
Пример #4
0
def run(num, rq, ks, vs):
    res = {'requests': 0,
           'get': [],
           'put': []}

    keys = "abcdefghijklmnop"

    client = Client('localhost', choice(ports))

    for i in range(0, num):
        tk = 0.0
        key = ''.join([choice(keys) for i in range(0, ks)])
        st = time()
        cur = client.get(key)
        tk += time() - st
        res['get'].append(tk)
        newval = rval(vs)
        st = time()
        client.put(key, newval, cur.context)
        tk += time() - st
        res['requests'] += 1
        res['put'].append(tk)
    rq.put(res)