-
Notifications
You must be signed in to change notification settings - Fork 335
aioredis 1.3.1 vs 2.0.0 performance #1208
Comments
Hey @artesby - Thank you for the benchmarks! I suspect the issue lies with our connections re-implementation, which is using a port of reds-py's SocketBuffer. This has the negative affect of passing all socket read/writes through two buffers rather than one. I'll take a look at this and see if my hunch is correct. |
@seandstewart I was also curious about this issue and did a bit of digging.
I don't think this is the case, as if I'd guess the problem lies that 1.3.1 used implicit pipelining or requests, as it didn't call drain after writing command and had a separate reader task. |
So here is the repo with a couple of the above benchmarks and a couple of experimental clients: Here is very minimalistic client covering the above use case (get, set) trying to be as performant as possible. It performs about 50% better than 1.3 version. I used callback-based Also, I tried to port this protocol-based implementation to current aioredis #1216 this is not a complete solution, the goal of this PR is to have a discussion. |
Ah, yes I recall the logic now. This pipelining would be more efficient, but it made debugging extremely difficult. Thanks for the example using a Protocol, I've not used this myself, but I like its straightforward approach to this problem. I'll take a look at the PR and poke around on it. |
I'd say it's not a problem of pipelining, but mostly the code around it, IMO as long as there is explicit state machine reading from the connection, it should significantly simplify debugging even when using pipelining.
Awesome thanks, I propose we move the further discussion to the PR. |
It's actually even worse when redis is on remote machine and under high workload. Current version is up to 40 times slower compared to 1.3 branch.
|
Describe the bug
aioredis==2.0.0 performs x4-10 times slower than aioredis==1.3.1
to see this we did a simple test:
test_aioredis1.py
test_aioredis2.py
To Reproduce
Expected behavior
aioredis v1.3.1 and v2.0.0 have same performance
Logs/tracebacks
Python Version
aioredis Version
Additional context
The problem is reproducible using either local redis (in docker) or redis on remote machine.
Increasing
n
coroutines count monotonically increases the gap between execution time on aioredis1 vs aioredis2.We tried to investigate the problem using cProfiler & yappi profiler. Looks like the root of the problem is somewhere near interaction with SocketBuffer, but we did not find exactly where.
So any help would be appreciated
Code of Conduct
The text was updated successfully, but these errors were encountered: