Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Pipeline support ? #108

Open
niteeshm opened this issue Jan 26, 2017 · 3 comments
Open

Missing Pipeline support ? #108

niteeshm opened this issue Jan 26, 2017 · 3 comments

Comments

@niteeshm
Copy link

niteeshm commented Jan 26, 2017

Even though mentioned on the home that pipelining support is there in the library, I haven't been able to use it or find any reference in the code.
Can i not use pipeline as simply as :

pipe = await conn.pipeline()
pipe.hgetall("key1")
pipe.get("key2")
results = await pipe.execute()

Also, if I execute 3 redis commands in parallel using asyncio.gather and 3 commands pipelined , which will be faster ?

I did a small benchmark, where I am reading 10000 keys using asyncio.gather concurrently and serially.
These were the numbers :

  1. 10000 hgetall calls in parallel - 3.7037110328674316s
  2. 10000 hgetall calls sequentially - 0.9311599731445312s

This is strange no?

Here is the code -

Parallel

async def fetch(key):
        return await conn.hgetall(key)
await asyncio.gather(*[fetch('my_key') for i in range(10000)])

Serial
[r.hgetall('my_key') for i in range(10000)]

Where am I going wrong ?

@etataurov
Copy link

Hi!
Your serial example doesn't look correct, it doesn't await for result.
for python3.6 it should be
[await conn.hgetall('my_key') for i in range(10000]

Having 10000 request in parallel might be faster than sequentially if you use connection pool with 10000 connections, otherwise you block on awaiting for connection release.

yes, unfortunately, pipeline support is not implemented and there is no mention in README

@0x-2a
Copy link

0x-2a commented Oct 2, 2018

Following up, is anyone working on pipeline support or are you looking for contributors?

@Gpzim98
Copy link

Gpzim98 commented Feb 26, 2019

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants