8000 Add --hotkeys-count option for Valkey-cli by hwware · Pull Request #1933 · valkey-io/valkey · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add --hotkeys-count option for Valkey-cli #1933

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

Merged
merged 4 commits into from
Apr 24, 2025

Conversation

hwware
Copy link
Member
@hwware hwware commented Apr 8, 2025

Now we only have --hotkeys option, and the default output value is 16.
This PR add one more option for hotkeys as "--hotkeys-count", users have chance to specific how many output items they want.

Example 1:

./src/valkey-cli --hotkeys-count 10

[00.00%] Hot key '"memtier-3308"' found so far with counter 5
[00.00%] Hot key '"memtier-23516"' found so far with counter 5
[00.00%] Hot key '"memtier-16678"' found so far with counter 5
[00.00%] Hot key '"memtier-25001"' found so far with counter 5
[00.00%] Hot key '"memtier-63829"' found so far with counter 5
[00.00%] Hot key '"memtier-21281"' found so far with counter 5
[00.00%] Hot key '"memtier-81379"' found so far with counter 5
[00.00%] Hot key '"memtier-30335"' found so far with counter 5
[00.00%] Hot key '"memtier-87521"' found so far with counter 5
[00.00%] Hot key '"memtier-42166"' found so far with counter 5

-------- summary -------

Sampled 100000 keys in the keyspace!
hot key found with counter: 5 keyname: "memtier-3308"
hot key found with counter: 5 keyname: "memtier-23516"
hot key found with counter: 5 keyname: "memtier-16678"
hot key found with counter: 5 keyname: "memtier-25001"
hot key found with counter: 5 keyname: "memtier-63829"
hot key found with counter: 5 keyname: "memtier-21281"
hot key found with counter: 5 keyname: "memtier-81379"
hot key found with counter: 5 keyname: "memtier-30335"
hot key found with counter: 5 keyname: "memtier-87521"
hot key found with counter: 5 keyname: "memtier-42166"

Example 2:

./src/valkey-cli --hotkeys-count 20

[00.00%] Hot key '"memtier-3308"' found so far with counter 5
[00.00%] Hot key '"memtier-23516"' found so far with counter 5
[00.00%] Hot key '"memtier-16678"' found so far with counter 5
[00.00%] Hot key '"memtier-25001"' found so far with counter 5
[00.00%] Hot key '"memtier-63829"' found so far with counter 5
[00.00%] Hot key '"memtier-21281"' found so far with counter 5
[00.00%] Hot key '"memtier-81379"' found so far with counter 5
[00.00%] Hot key '"memtier-30335"' found so far with counter 5
[00.00%] Hot key '"memtier-87521"' found so far with counter 5
[00.00%] Hot key '"memtier-42166"' found so far with counter 5
[00.00%] Hot key '"memtier-6370"' found so far with counter 5
[00.01%] Hot key '"memtier-37381"' found so far with counter 5
[00.01%] Hot key '"memtier-95045"' found so far with counter 5
[00.01%] Hot key '"memtier-14027"' found so far with counter 5
[00.01%] Hot key '"memtier-60370"' found so far with counter 5
[00.01%] Hot key '"memtier-98622"' found so far with counter 5
[00.01%] Hot key '"memtier-18642"' found so far with counter 5
[00.01%] Hot key '"memtier-39260"' found so far with counter 5
[00.01%] Hot key '"memtier-64371"' found so far with counter 5
[00.01%] Hot key '"memtier-27099"' found so far with counter 5

-------- summary -------

Sampled 100000 keys in the keyspace!
hot key found with counter: 5 keyname: "memtier-3308"
hot key found with counter: 5 keyname: "memtier-23516"
hot key found with counter: 5 keyname: "memtier-16678"
hot key found with counter: 5 keyname: "memtier-25001"
hot key found with counter: 5 keyname: "memtier-63829"
hot key found with counter: 5 keyname: "memtier-21281"
hot key found with counter: 5 keyname: "memtier-81379"
hot key found with counter: 5 keyname: "memtier-30335"
hot key found with counter: 5 keyname: "memtier-87521"
hot key found with counter: 5 keyname: "memtier-42166"
hot key found with counter: 5 keyname: "memtier-6370"
hot key found with counter: 5 keyname: "memtier-37381"
hot key found with counter: 5 keyname: "memtier-95045"
hot key found with counter: 5 keyname: "memtier-14027"
hot key found with counter: 5 keyname: "memtier-60370"
hot key found with counter: 5 keyname: "memtier-98622"
hot key found with counter: 5 keyname: "memtier-18642"
hot key found with counter: 5 keyname: "memtier-39260"
hot key found with counter: 5 keyname: "memtier-64371"
hot key found with counter: 5 keyname: "memtier-27099"

@hwware hwware force-pushed the add-hotkeys-samples-options branch 2 times, most recently from 34a57b9 to 76987a6 Compare April 9, 2025 13:54
Copy link
codecov bot commented Apr 9, 2025

Codecov Report

Attention: Patch coverage is 5.88235% with 16 lines in your changes missing coverage. Please review.

Project coverage is 70.82%. Comparing base (3884650) to head (1eaa07a).
Report is 1 commits behind head on unstable.

Files with missing lines Patch % Lines
src/valkey-cli.c 5.88% 16 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1933      +/-   ##
============================================
- Coverage     71.03%   70.82%   -0.22%     
============================================
  Files           123      123              
  Lines         66037    66049      +12     
============================================
- Hits          46911    46780     -131     
- Misses        19126    19269     +143     
Files with missing lines Coverage Δ
src/valkey-cli.c 54.23% <5.88%> (-1.86%) ⬇️

... and 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zuiderkwast
Copy link
Contributor

I'm not sure "samples" is the right name for this. Samples already means how many keys were checked. The output says

Sampled 100000 keys in the keyspace!

Maybe --hotkeys-count?

@PingXie
Copy link
Member
PingXie commented Apr 14, 2025

+1 on "hotkeys-count". Changes LGTM overall. We should add documentation too.

@zuiderkwast zuiderkwast added needs-doc-pr This change needs to update a documentation page. Remove label once doc PR is open. release-notes This issue should get a line item in the release notes labels Apr 14, 2025
@hwware hwware force-pushed the add-hotkeys-samples-options branch from 76987a6 to 45a4f0e Compare April 16, 2025 14:20
@hwware hwware changed the title Add --hotkeys-samples option for Valkey-cli Add --hotkeys-count option for Valkey-cli Apr 17, 2025
@hwware hwware force-pushed the add-hotkeys-samples-options branch from 46d45fe to 8e59e30 Compare April 17, 2025 16:34
@hwware
Copy link
Member Author
hwware commented Apr 17, 2025

Address the comments, and valkey-doc PR valkey-io/valkey-doc#265

Copy link
Contributor
@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

LGTM.

Just a small comment about the help text.

hwware added 3 commits April 24, 2025 18:51
Signed-off-by: hwware <wen.hui.ware@gmail.com>
Signed-off-by: hwware <wen.hui.ware@gmail.com>
Signed-off-by: hwware <wen.hui.ware@gmail.com>
@hwware hwware force-pushed the add-hotkeys-samples-options branch 2 times, most recently from 7a66951 to 134b01e Compare April 24, 2025 18:53
Copy link
Contributor
@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Signed-off-by: Wen Hui <wen.hui.ware@gmail.com>
@hwware
Copy link
Member Author
hwware commented Apr 24, 2025

Every comment is addressed in this PR, and doc PR valkey-io/valkey-doc#265

@zuiderkwast
Copy link
Contributor

Yes I think you can merge it. Ping approved high level.

@hwware hwware merged commit 83d2979 into valkey-io:unstable Apr 24, 2025
51 checks passed
hwware added a commit to valkey-io/valkey-doc that referenced this pull request Apr 24, 2025
The default value is 16, and if clients use --hotkeys-count as an
option, the result will be the specific number of hotkeys.

This PR related to PR valkey-io/valkey#1933

---------

Signed-off-by: hwware <wen.hui.ware@gmail.com>
Signed-off-by: Wen Hui <wen.hui.ware@gmail.com>
Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-doc-pr This change needs to update a documentation page. Remove label once doc PR is open. release-notes This issue should get a line item in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0