-
Notifications
You must be signed in to change notification settings - Fork 998
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
Support Stream data structure #59
Comments
Ok ok, I hear you load and clear. Your wish is my command. |
@FZambia you do not use XREAD? how do you pull from the stream? |
Yep, not using it 😀 In my use case I read stream content using two commands: XRANGE and XREVRANGE. The system is https://github.com/centrifugal/centrifugo. There is actually a combination of Redis PUB/SUB and Redis stream for message broadcasting. But I suppose XREAD is definitely useful for most of other Redis users. |
So how do you flush it? Or you use maxlimit to control the capacity?
…On Sat, Jun 11, 2022, 17:43 Alexander Emelin ***@***.***> wrote:
Yep, not using it 😀 In my use case I read stream content using two
commands: XRANGE and XREVRANGE. The system is
https://github.com/centrifugal/centrifugo. There is actually a
combination of Redis PUB/SUB and Redis stream for message broadcasting.
But I suppose XREAD is definitely useful for most of other Redis users.
—
Reply to this email directly, view it on GitHub
<#59 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4BFCA2EERM3V5SN2Q3DY3VOSQ2HANCNFSM5XMWYDZA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Yep, limiting size using |
Very cool project, btw. https://centrifugal.dev/ beautiful site as well.
…On Sat, Jun 11, 2022 at 6:18 PM Alexander Emelin ***@***.***> wrote:
So how do you flush it? Or you use maxlimit to control the capacity?
Yep, limiting size using MAXLEN option and having expiration time for the
entire stream.
—
Reply to this email directly, view it on GitHub
<#59 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4BFCDBMWUXC4VAVLMVXM3VOSU3RANCNFSM5XMWYDZA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
1. add tests that cover xrange,xrevrange and various error states for xadd. 2. Implement 8 stream commands overall. Fixes #59. Signed-off-by: Roman Gershman <[email protected]>
@FZambia please take a look at https://github.com/dragonflydb/dragonfly/releases/tag/v0.3.0-alpha this should support everything you need in streams. |
Many thanks! I'll try and report results here. |
Experimented a bit! Debian 11: In a VM with shared CPU ( Redis version 6.0.16, Dragonflydb built from source from v0.3.0-alpha Redis benchmark for PUBLISH op (this is without STREAM - just a pipelined PUBLISH op):
Dragonflydb (
Latency is much higher in dragonflydb case. And throughput seems to be also less correspondingly (I am using pipelining over single connection – so latency affects throughput). I looked at CPU usage on a broker side during a benchmark – and it actually seems lower on dragonfly (2 times less than in Redis case). As I mentioned this is on 2-CPU VM, so maybe the real gain should come on multicore machines? Maybe the latency caused by some internal batching in dragonfly which collects commands for calling io-uring API? Now for checking streams. Unfortunately I was not able to make it work, I am using Lua and in Dragonflydb case I am getting an error I was not able to reproduce this using One interesting thing BTW, managed to put dragonfly into busy loop (100% CPU all the time, not responding to commands anymore) with this:
Result is never returned, Redis worked fine with this. |
Thanks for letting me know! Is it possible to reproduce Is it possible to reproduce the streaming case? re latency and throughput - yes, the internal latency avg latency in DF may be higher than in Redis due to message passing between threads. re - monitor - you can run dragonfly with |
In addition - see #113 apparently, Debian 11 has a performance problem with DF but I am not sure it applies in this case. |
Thx, this was useful
You need Go language installed:
Think I found the reason. In Redis:
In Dragonfly:
I.e. different SHA-sums. I am using Redigo client - https://github.com/gomodule/redigo - it calculates script sha sum on client side. It matches the one from Redis, but as you can see Dragonfly hashes to a different sum for some reason. One more thing, even if I try to execute a script above with hash sum returned by Dragonfly I still get hanging and 100% CPU, i.e.:
In Redis the same script works with the same EVALSHA. |
Ok, it's me being a smartass: https://github.com/dragonflydb/dragonfly/blob/main/src/server/main_service.cc#L705 I will follow up on your feedback, thank you very much, Alexander! |
@FZambia I checked the loadtest you provided. I can confirm that with such setup Redis will provide more throughput than Dragonfly. The reason for this is that DF uses message passing between threads (similar to go channels). Therefore a single PUBLISH request will incur 10-20us server-side latency compared to 1-2us for Redis. However, if you use multiple connections with DF, things will change dramatically. DF connections are asynchronous, meaning that even one the first one waits for an answer from the message bus, others will still progress. With dozens of incoming connections the latency factor will stop being important and DF will provide much better throughput with enough CPU power. |
@romange many thanks for the explanation! Actually it sounds good – in practice many server nodes connect to Redis, having a higher throughput is more important. Will be experimenting with different cases in the future. Also, thanks for fixing LUA issues. Hope to try this all again very soon. |
Failed 😀
|
@romange hello, thx for this! Looks like I'll need some help soon. For now stepped away from a blog post because I got a bit strange results which I could not quickly explain - but hope to come back to it soon. First results were generally slower than Redis - but this could be due to benchmark nature. I am extensively using pipelining already, through several connections. Using https://github.com/redis/rueidis library. I am not sure whether this is expected for DF or not? I can provide full script to run my bench. Another thing is that sometimes performance of DF was dropping from thousands to sth like 200 requests per second - I am not sure why, Redis was super-stable with the same bench. I was testing with Ubuntu 23.10, think also tried Debian 12 in one run (DigitalOcean CPU-optimized droplets). My main hope for DF in the perspective of Centrifugo projects is possibility to vertically scale PUB/SUB – with Redis and its sharded PUB/SUB in cluster it's possible, but the model is not very suitable for Centrifugo. Because Centrifugo should deal with millions of topics and use only several dedicated connections for managing subscriptions. In sharded PUB/SUB case this means that only pre-sharding technique may help to achieve that. I.e. limiting slot space more, to some known value like 32, and create dedicated connection for each such slot - so they land to some nodes of a cluster. Which works but requries more care, planning and may result into unequal load on Redis cluster nodes due to the small number of such shards. And changes approach to creating keys. So an option to get more performance with single Redis instance is nice to have. |
Hello, came across Dragonfly on Hacker News. Very cool project – good luck with it!
I am very interested in Stream data structure support - think that's the only missing command for me to start experimenting with Dragonfly.
Specifically, in my use case I am using:
Hope this will be added at some point.
The text was updated successfully, but these errors were encountered: