-
Notifications
You must be signed in to change notification settings - Fork 34
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 CLUSTER SLOT-STATS document. #150
base: main
Are you sure you want to change the base?
Changes from 5 commits
65d2006
c4f0775
3625f09
3c6a17e
3514037
cfcb41d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
`CLUSTER SLOT-STATS` returns an array of slot usage statistics for slots assigned to the current shard. | ||
The command is suitable for Valkey Cluster users aiming to assess general slot usage trends, identify hot / cold slots, migrate slots for a balanced cluster workload, and / or re-write application logic to better utilize slots. | ||
|
||
As of now, the following metrics are supported: | ||
madolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* `key-count` - Number of keys residing in a given slot. | ||
* `cpu-usec` - Amount of cpu time (in micro-seconds) spent on a given slot. | ||
* `network-bytes-in` - Amount of network ingress (in bytes) received for given slot. | ||
* `network-bytes-out` - Amount of network egress (in bytes) sent out for given slot. | ||
|
||
## Supported arguments | ||
madolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
There exist two mutually exclusive arguments, namely; | ||
madolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### SLOTSRANGE | ||
Returns slot statistics based on the slots range provided. The range is inclusive. | ||
The `SLOTSRANGE` argument allows for request pagination. | ||
The response is ordered in ascending slot number. | ||
|
||
##### Response in RESP2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Level 5 heading under a level 3 heading? So many levels are not easy to distinguish. The fontsizes will not be different enough. Not to mention the man pages. I think we should not use more than 3 levels. Let's add an I would like to loosely follow the order within the page that's normal for man pages, as described under "Sections within a manual page" on the man-pages.7 man page: https://www.man7.org/linux/man-pages/man7/man-pages.7.html |
||
``` | ||
> CLUSTER SLOT-STATS SLOTSRANGE 0 1 | ||
1) 1) (integer) 0 | ||
2) 1) "key-count" | ||
2) (integer) 0 | ||
3) "cpu-usec" | ||
4) (integer) 0 | ||
5) "network-bytes-in" | ||
6) (integer) 0 | ||
7) "network-bytes-out" | ||
8) (integer) 0 | ||
2) 1) (integer) 1 | ||
2) 1) "key-count" | ||
2) (integer) 0 | ||
3) "cpu-usec" | ||
4) (integer) 0 | ||
5) "network-bytes-in" | ||
6) (integer) 0 | ||
7) "network-bytes-out" | ||
8) (integer) 0 | ||
``` | ||
|
||
##### Response in RESP3 | ||
``` | ||
> CLUSTER SLOT-STATS SLOTSRANGE 0 1 | ||
1) 1) (integer) 0 | ||
2) 1# "key-count" => (integer) 0 | ||
2# "cpu-usec" => (integer) 0 | ||
3# "network-bytes-in" => (integer) 0 | ||
4# "network-bytes-out" => (integer) 0 | ||
2) 1) (integer) 1 | ||
2) 1# "key-count" => (integer) 0 | ||
2# "cpu-usec" => (integer) 0 | ||
3# "network-bytes-in" => (integer) 0 | ||
4# "network-bytes-out" => (integer) 0 | ||
``` | ||
|
||
### ORDERBY | ||
Orders slot statistics based on the provided metric. | ||
madolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
The `ORDERBY` argument allows for the user to identify hot / cold slots across the cluster. | ||
The response is ordered based on sort result. | ||
madolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
In the event of a tie in the provided metric value, ascending slot number is used as a tie breaker. | ||
|
||
|
||
##### Response in RESP2 | ||
``` | ||
> CLUSTER SLOT-STATS ORDERBY KEY-COUNT LIMIT 2 DESC | ||
1) 1) (integer) 12426 | ||
2) 1) "key-count" | ||
2) (integer) 45 | ||
3) "cpu-usec" | ||
4) (integer) 0 | ||
5) "network-bytes-in" | ||
6) (integer) 0 | ||
7) "network-bytes-out" | ||
8) (integer) 0 | ||
2) 1) (integer) 13902 | ||
2) 1) "key-count" | ||
2) (integer) 20 | ||
3) "cpu-usec" | ||
4) (integer) 0 | ||
5) "network-bytes-in" | ||
6) (integer) 0 | ||
7) "network-bytes-out" | ||
8) (integer) 0 | ||
``` | ||
|
||
##### Response in RESP3 | ||
``` | ||
> CLUSTER SLOT-STATS ORDERBY KEY-COUNT LIMIT 2 DESC | ||
madolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
1) 1) (integer) 12426 | ||
2) 1# "key-count" => (integer) 45 | ||
2# "cpu-usec" => (integer) 0 | ||
3# "network-bytes-in" => (integer) 0 | ||
4# "network-bytes-out" => (integer) 0 | ||
2) 1) (integer) 13902 | ||
2) 1# "key-count" => (integer) 20 | ||
2# "cpu-usec" => (integer) 0 | ||
3# "network-bytes-in" => (integer) 0 | ||
4# "network-bytes-out" => (integer) 0 | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realize we kind of use metrics and statistics sort of interchangeably which now bothers me, but maybe it's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. We could consolidate the wording into “stats / statistics” throughout the documentation, given that
SLOT-STATS
is the chosen name for the command.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command name is the title of the page, so it doesn't need to be here.