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

Support keyspace notifications #1657

Closed
Cylkal opened this issue Aug 7, 2023 · 6 comments · Fixed by #3154
Closed

Support keyspace notifications #1657

Cylkal opened this issue Aug 7, 2023 · 6 comments · Fixed by #3154

Comments

@Cylkal
Copy link

Cylkal commented Aug 7, 2023

Redis support keyspace notifications by command CONFIG SET notify-keyspace-events xE, but dragonfly does not support it:

CONFIG SET notify-keyspace-events xE
(error) ERR CONFIG SET failed (possibly related to argument 'notify-keyspace-events').

I'd like to subscribe to timeout key events. Is there any solution?

@romange
Copy link
Collaborator

romange commented Aug 7, 2023

Dragonfly does not support key events. Specifically, timeout events is not designed well in Redis and does not guarantee accurate events for all the keys. Can you please describe your use-case for this ?

@Cylkal
Copy link
Author

Cylkal commented Aug 7, 2023

@romange My scenario is to monitor which key expires in real time, which was previously achieved by subscribing to redis's key expiration event. In my system, key expiration means that the tasks corresponding to this key may not be handled in a timely manner, and a mechanism is needed to monitor these tasks that are not handled in time. It is true that the redis key event is not a reliable method, but it does not need to implement too many functions alone, so it is convenient.

@glad2os
Copy link

glad2os commented Sep 8, 2023

@romange My scenario is to monitor which key expires in real time, which was previously achieved by subscribing to redis's key expiration event. In my system, key expiration means that the tasks corresponding to this key may not be handled in a timely manner, and a mechanism is needed to monitor these tasks that are not handled in time. It is true that the redis key event is not a reliable method, but it does not need to implement too many functions alone, so it is convenient.

Are there other methods besides the one you mentioned? Because I'm using the same thing in my project

@ostlerc
Copy link

ostlerc commented Aug 21, 2024

We cannot convert redis to dragonflydb in some scenarios due to this limitation. Happy to answer any other questions about this use case. But it does seem like a necessary feature of redis to support.

@Guillermogsjc
Copy link

Guillermogsjc commented Aug 29, 2024

Hi @romange,

The lack of support for key space notification events is a blocker in some cases, such as real-time applications where a WebSocket endpoint receives Pub/Sub messages triggered by key changes to send updated key data to clients, among other use cases.

As you mentioned, timeout events pose challenges for porting this functionality, which has hindered the development of this feature.

My question is: Could the part of the API that supports other key operations—such as hset, hdel, del, set, etc.—be developed for DragonflyDB, as these would be very useful? (e.g. develop partially and support only the events that fit nicely into DragonflyDB so far)

@romange
Copy link
Collaborator

romange commented Aug 29, 2024

https://github.com/dragonflydb/dragonfly/pull/3154/files fixes the specific usecase, i.e. Ex notifications.

Please open a separate issue for notification use-cases that are not covered by Ex.

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

Successfully merging a pull request may close this issue.

5 participants