async def run(loop): c = asyncmrws.Client() #await c.connect(io_loop=loop,servers=[("127.0.0.1",7100), ("127.0.0.1",7002)]) await c.connect(io_loop=loop,servers=[("127.0.0.1",7100)]) bstr = mrpacker.pack([1,2,3,4,5,6,7,8,9,10]) l = len(bstr) #await c.bench() start = time.time() for x in range(1000000): #if x % 100000 == 0: print (x) #await c.push( 0, 0, bstr, l ) await c.push_noflush( x, bstr, l ) #print("push failed") #break await c.flush() end = time.time() print(end - start) #await c.bench() await asyncio.sleep(0.5, loop=loop) await c.close()
async def run(loop): c = asyncmrws.Client() await c.connect(io_loop=loop, servers=[("127.0.0.1", 7100)]) #sc = ssl.create_default_context(ssl.Purpose.SERVER_AUTH) #sc.load_verify_locations('cert/server.crt') #await c.connect(io_loop=loop,servers=[("127.0.0.1",7100)],ssl=sc) m = mrpacker.pack([1, 2, 3, "test"]) l = len(m) await c.push(0, m, l) await c.close()
async def run(loop): c = asyncmrws.Client() await c.connect(io_loop=loop, servers=[("127.0.0.1", 7100)]) # Test fetch if 0: print(mrpacker.unpack(await c.get(0, mrpacker.pack([1, 2, 3])))) # Push some work if 1: msg = mrpacker.pack([22] * 100) while 1: await c.push(0, msg, len(msg)) await asyncio.sleep(1) await c.close()
async def run(loop): c = asyncmrws.Client() #await c.connect(io_loop=loop,servers=[("127.0.0.1",7100),("127.0.0.1",7002)]) await c.connect(io_loop=loop, servers=[("127.0.0.1", 7100)]) #sc = ssl.create_default_context(ssl.Purpose.SERVER_AUTH) #sc.load_verify_locations('cert/server.crt') #await c.connect(io_loop=loop,servers=[("127.0.0.1",7100)],ssl=sc) if 1: await c.set(0, mrpacker.pack(["key", "val"])) await asyncio.sleep(0.5, loop=loop) await c.close() exit() #await c.push( 0, 0, m, l ) #await asyncio.sleep(0.5, loop=loop) #await c.close() #return if 0: print(mrpacker.unpack(await c.get(0, mrpacker.pack([1, 2, 3])))) if 0: l = [] l.append(c.get(0, mrpacker.pack([1, 2, 3]))) l.append(c.get(0, mrpacker.pack([1, 2, 3, 4]))) l.append(c.get(0, mrpacker.pack([5]))) print(await asyncio.gather(*l)) for x in range(100): m = mrpacker.pack(x) l = len(m) if await c.push(x, m, l): print(x, "droppped") else: print(x) await asyncio.sleep(0.5, loop=loop) await asyncio.sleep(0.5, loop=loop) #msgs = await c.pull( 0, 0 ) #print(msgs) await c.close()
async def run(loop): c = asyncmrws.Client() await c.connect(io_loop=loop, servers=[("127.0.0.1", 7100), ("127.0.0.1", 7001)]) num = 10000 #m = mrpacker.pack( [1, "foo", {"yay":1}] ) m = mrpacker.pack("AeeGEVMfFEANKzNPhbNkhMbORHAqn-rR") s = time.time() for x in range(1000): l = [] for y in range(10): l.append(c.get(x, m)) #l.append( c.set( x, m ) ) await asyncio.gather(*l) e = time.time() print(num / (e - s), " Requests/second") await asyncio.sleep(0.5, loop=loop) await c.close()