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

Limit the max number of keys when scanning #206

Merged
merged 4 commits into from
Jun 24, 2024
Merged

Limit the max number of keys when scanning #206

merged 4 commits into from
Jun 24, 2024

Conversation

LeoHsiao1
Copy link
Contributor

@LeoHsiao1 LeoHsiao1 commented Jun 20, 2024

Hi, glad to see you're still maintaining this 12 year old project!
Among the redis web GUI tools, phpRedisAdmin is still the most powerful one.

But now there is a serious problem: if the redis db contains more than 100,000 keys, it takes phpRedisAdmin tens of seconds to open the db, or even timeout.
I have a simple solution: limit the max number of keys when scanning.

For reference, AnotherRedisDesktopManager also has this limitation, and the max number is 500.
https://github.com/qishibo/AnotherRedisDesktopManager/blob/d373d653063c2a0c256c743777118b92231010ba/src/components/contents/KeyContentStream.vue#L199

Copy link
Owner

@erikdubbelboer erikdubbelboer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LeoHsiao1
Copy link
Contributor Author

Sure. I added a line of comment.

@LeoHsiao1
Copy link
Contributor Author

LeoHsiao1 commented Jun 24, 2024

I have tested this and found that even if the redis db contains millions of keys, a query with export SCAN_MAX=1000 takes less than 1 second.
A query with export SCAN_MAX=5000 takes nearly 5 seconds.

@erikdubbelboer erikdubbelboer merged commit 092f83f into erikdubbelboer:master Jun 24, 2024
@erikdubbelboer
Copy link
Owner

Thanks!

@GregOriol
Copy link
Contributor

Wait, does this mean that the display will be incomplete, and that there is no mention about it anywhere to the user?

There is also no way to "load more"?

I agree with a need to limit issues when servers have a huge number of keys, but this solution is really problematic.

@LeoHsiao1
Copy link
Contributor Author

In AnotherRedisDesktopManager, if the number of keys exceeds 500, it displays the "load more" button.
It would be nice to implement this feature in phpRedisAdmin, but it would require more code changes.

An alternative is to display a warning at the bottom of sidebar: "reached the limit"
I can try to add the warning.

@LeoHsiao1
Copy link
Contributor Author

I came up with another solution that always shows the number of keys being scanned and the limit.
It is displayed like this:
screenshot-20240919-175419

@GregOriol
Copy link
Contributor

Kind of better, but not sure it would be clear enough for users. I think some "keys limit reached" message should be clear, or a "more" button would make it more clear.

@LeoHsiao1
Copy link
Contributor Author

Adding "load more" button is definitely better, but this project currently lacks contributors.
I've opened a new PR to make a small patch.

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 this pull request may close these issues.

3 participants