Skip to content

Instantly share code, notes, and snippets.

@pfreixes
Created July 25, 2017 12:44
Show Gist options
  • Select an option

  • Save pfreixes/e320b6f398aa7644c19188ccf2f443b1 to your computer and use it in GitHub Desktop.

Select an option

Save pfreixes/e320b6f398aa7644c19188ccf2f443b1 to your computer and use it in GitHub Desktop.
import aioredis
import asyncio
OPS = 100000
async def main(loop):
conn = await aioredis.create_redis(('localhost', 6379))
start = loop.time()
for i in range(OPS):
await conn.ping()
lapsed = loop.time() - start
print("Ping/sec {}".format(OPS/lapsed))
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment