-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add cron for cleanup of keys from DiceDB #32
Comments
I will take this @lucifercr07 |
Can you assign this to me @lucifercr07 |
@RishabhC-137 @tarun-kavipurapu thanks a lot for your interests. I believe both of you have issues assigned already. |
Hi @lucifercr07 , thanks for considering my interest! I haven't started working on the previous issue assigned to me, so I’m happy to unassign myself from it if possible. Could you please assign this issue to me instead? |
Hi @lucifercr07 can you assign this issue to me. The assigned previous issues are fixed and I have written comment on it. |
One more thingh I write lot of cron job in my workplace too in golang. |
@Shimanshu83 assigned, thanks for contributing. |
@Shimanshu83 please let us know if any more details required on this. |
Sure |
@Shimanshu83 if you're facing some issue or need more details, let me know would be happy to jump on a call and resolve. This issue is blocking UI integration hence we'd like to start work on this. |
Hey, was bit busy on working days, but will look into this today only. |
Sure, just to note when implementing the cron, we should have a key stored in DiceDB which would hold the time since last cleanup and UI would use that. |
After each cron job trigger, we should delete all the keys and then add a last_time_clean_up key to store the timestamp of the most recent trigger. Does that sound correct? |
@Shimanshu83 yes please raise the draft PR once. |
Ok will raise it in sometime. |
@lucifercr07 saving a last_clean_up cron at dicedb is I think not a good idea since other users can change that key or delete it. Can we save it as a global variable. |
@Shimanshu83 We can name it uniquely so that it can't be deleted, we should try avoid global variables from what I understand. Also if the server or application crashes variable won't be persisted. |
So I am using flushdb command to delete all the keys at once. Is there any observations on that. We can recreate that last cleanup key once the flushdb command is executed. |
We need to have a way so that we don't flush all keys, ratelimit keys are also persisted. We need to have internal keys with prefix including hash of some sort to have a fixed naming pattern and avoid cleaning these up. It can be taken as part of separate issue. |
what do you guys mean by global variables @lucifercr07 @Shimanshu83 ? where do they get stored? |
@Shimanshu83 change has been merged as part of #43, I see you've raised your PR recently, please resolve conflicts. I believe we can add below comment changes and integration test as part of your PR, let me know your thoughts: |
@lucifercr07 since above two comments is already assigned to some one. I can do one thing I can raise new pr with the integration test for the implementation of clean up cron functionality which is currently merged in master. |
@Shimanshu83 sure, let me know if you want me to create an issue for it. |
Yes @lucifercr07 create a new issue and tag me. |
@Shimanshu83 created: #50 , please comment once to assign. |
Closing merged as part of #43 |
Description
Currently, there is no automated cleanup process for stale or unused keys stored in DiceDB within the
playground-mono
repository. This can lead to unnecessary memory consumption and inefficient resource usage over time, especially since we're having a global keypool currently.We need to add a cron job that will periodically clean up all the keys in DiceDB using the SDK. The frequency of the cron job should be configurable, and by default, it should run every 15 minutes. This cron job should interact with the DiceDB using its SDK to delete all keys once configured time is reached.
Tasks
playground-mono
for setting the cron frequency.time.Ticker
with a Goroutine to implement cronDiceDB
server and interact with it.Please feel free to comment on issue for more details.
The text was updated successfully, but these errors were encountered: