CLUSTER-SLOT-STATS(3valkey)
π CLUSTER-SLOT-STATS π
okay so bestie, welcome to the Valkey Command Manual β this is cluster-slot-stats(3valkey) and it's literally the vibe check for your cluster slots π¦
β¨ NAME β¨
cluster-slot-stats β returns an array of slot usage statistics for slots assigned to the current node. fr fr that's the whole thing π
πΈ SYNOPSIS πΈ
CLUSTER SLOT-STATS SLOTSRANGE start-slot end-slot
CLUSTER SLOT-STATS ORDERBY metric [LIMIT limit] [ASC | DESC]
two whole moods, pick your fighter π
π« DESCRIPTION π«
So this bad boy returns an array of slot usage statistics for slots assigned to the current shard. It's giving main character energy for Valkey Cluster girlies who wanna:
- 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 βοΈ
The following statistics are supported, and yes they all ate:
key-countβ Number of keys residing in a given slot. ποΈcpu-usecβ Amount of CPU time (in microseconds) 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. π€
π OPTIONS π
ORDERBYβ Returns an ordered slot statistics based on the specified statistic and sub-arguments to identify hot / cold slots across the cluster. EitherASCorDESCmodifiers can be used. In the event of a tie in the stats, ascending slot number is used as a tie breaker. no cap, that's the rule πSLOTSRANGEβ Returns slot statistics based on the slots range provided for pagination. The range is inclusive (both ends count, bestie). The response is ordered in ascending slot number. π
π«Ά REPLY π«Ά
valkey-protocol(7) Array reply: nested list of slot usage statistics. it's nested. it's an array. it's iconic. β¨
π₯ COMPLEXITY π₯
O(N)where N is the total number of slots based on arguments.O(N*log(N))withORDERBYsubcommand.
so basically ORDERBY is the one doing extra cardio πβοΈ
π ACL CATEGORIES π
@slow β yeah she's not fast, she's thorough, respect it π
β HISTORY β
- Available since:
8.0.0π
π EXAMPLES π
Response in RESP2 π
For ORDERBY:
> 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
For SLOTSRANGE:
> 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 π§
For ORDERBY:
> CLUSTER SLOT-STATS ORDERBY KEY-COUNT LIMIT 2 DESC
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
For SLOTSRANGE:
> 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
not me noticing every single one of those counters is 0 in the examples π it's a demo, bestie, breathe.
π SEE ALSO π
the whole friend group, obviously π«
asking(3valkey)cluster(3valkey)cluster-addslots(3valkey)cluster-addslotsrange(3valkey)cluster-bumpepoch(3valkey)cluster-cancelslotmigrations(3valkey)cluster-count-failure-reports(3valkey)cluster-countkeysinslot(3valkey)cluster-delslots(3valkey)cluster-delslotsrange(3valkey)cluster-failover(3valkey)cluster-flushslots(3valkey)cluster-forget(3valkey)cluster-getkeysinslot(3valkey)cluster-getslotmigrations(3valkey)cluster-help(3valkey)cluster-info(3valkey)cluster-keyslot(3valkey)cluster-links(3valkey)cluster-meet(3valkey)cluster-migrateslots(3valkey)cluster-myid(3valkey)cluster-myshardid(3valkey)cluster-nodes(3valkey)cluster-replicas(3valkey)cluster-replicate(3valkey)cluster-reset(3valkey)cluster-saveconfig(3valkey)cluster-set-config-epoch(3valkey)cluster-setslot(3valkey)cluster-shards(3valkey)cluster-slots(3valkey)cluster-syncslots(3valkey)readonly(3valkey)readwrite(3valkey)
and that's the whole page, periodt π
this lil masterpiece is from version 9.0.0, dated 2025-10-21, and yeah it lives in the CLUSTER-SLOT-STATS(3valkey) section of the manual. go slay some slots, bestie π¦β¨
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms