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

bigkeys analyze support #877

Closed
1 of 2 tasks
Phoeniwx opened this issue Sep 15, 2022 · 6 comments · Fixed by #1489
Closed
1 of 2 tasks

bigkeys analyze support #877

Phoeniwx opened this issue Sep 15, 2022 · 6 comments · Fixed by #1489
Labels
enhancement type enhancement

Comments

@Phoeniwx
Copy link
Contributor

Search before asking

  • I had searched in the issues and found no similar issues.

Motivation

We all know redis support --bigkeys & --memkeys commands, which can help us analyze bigkeys conveniently. Or we can use rdb generated by redis to parse bigkeys.

$ redis-cli --bigkeys

# Scanning the entire keyspace to find biggest keys as well as
# average sizes per key type.  You can use -i 0.01 to sleep 0.01 sec
# per SCAN command (not usually needed).

[00.00%] Biggest string found so far 'key-419' with 3 bytes
[05.14%] Biggest list   found so far 'mylist' with 100004 items
[35.77%] Biggest string found so far 'counter:__rand_int__' with 6 bytes
[73.91%] Biggest hash   found so far 'myobject' with 3 fields

However, according to my knowledge, kvrocks does not support --bigkeys or --memkeys, because of its different iteration way and other reasons, wshich makes it hard to analyze bigkeys.

Solution

Maybe you guys can add a --bigkeys(--memkeys) feature like redis or generate some kind of rdb-like file for us to analyze? thanks ; ).

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@Phoeniwx Phoeniwx added the enhancement type enhancement label Sep 15, 2022
@mapleFU
Copy link
Member

mapleFU commented Sep 18, 2022

Seems that redis implement --bigkey as a client tool: https://github.com/redis/redis/blob/unstable/src/redis-cli.c#L8257 , it will send scan to sample the bigkeys.

Maybe I can try to test using --bigkey in client in next few weeks

@git-hulk
Copy link
Member

Thanks to @mapleFU, it's true that Redis implements its big key detection in the redis-cli with the scan command. The reason why Kvrocks don't support the redis-cli --bigkey is we now return the string as scan iterator cursor instead of an integer, so it can't be compatible with redis-cli now

@jihuayu
Copy link
Member

jihuayu commented Jun 9, 2023

image
After I fix #1402, redis-cli --bigkeys is work.
But redis-cli uses DBSIZE to get the total number of keys and calculates the progress based on this information.
So before we run DBSIZE scan, dbsize is 0, progress bar wiil display [ -nan%] or [ inf%].
We need to fix this issue? @git-hulk

@git-hulk
Copy link
Member

git-hulk commented Jun 9, 2023

@jihuayu

Cool, I think it's fine to display [-nan%] or [inf%], and ask users to execute the dbsize scan command if they wanna see the percent.

@jihuayu
Copy link
Member

jihuayu commented Jun 9, 2023

@git-hulk
These texts are completely from redis-cli and we cannot control them.
I think we can add the FAQ to our doc.

@git-hulk
Copy link
Member

@git-hulk
These texts are completely from redis-cli and we cannot control them.
I think we can add the FAQ to our doc.

Yes, we can guide them via the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement type enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants