Skip to content

Commit 4fc737e

Browse files
DOC-4875 updated bigkeys, memkeys, and keystats output samples
1 parent d7267a8 commit 4fc737e

File tree

1 file changed

+149
-25
lines changed

1 file changed

+149
-25
lines changed

content/develop/tools/cli.md

Lines changed: 149 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -491,31 +491,39 @@ dataset for big keys, but also provides information about the data types
491491
that the data set consists of. This mode is enabled with the `--bigkeys` option,
492492
and produces verbose output:
493493

494-
$ redis-cli --bigkeys
495-
496-
# Scanning the entire keyspace to find biggest keys as well as
497-
# average sizes per key type. You can use -i 0.01 to sleep 0.01 sec
498-
# per SCAN command (not usually needed).
499-
500-
[00.00%] Biggest string found so far 'key-419' with 3 bytes
501-
[05.14%] Biggest list found so far 'mylist' with 100004 items
502-
[35.77%] Biggest string found so far 'counter:__rand_int__' with 6 bytes
503-
[73.91%] Biggest hash found so far 'myobject' with 3 fields
504-
505-
-------- summary -------
506-
507-
Sampled 506 keys in the keyspace!
508-
Total key length in bytes is 3452 (avg len 6.82)
509-
510-
Biggest string found 'counter:__rand_int__' has 6 bytes
511-
Biggest list found 'mylist' has 100004 items
512-
Biggest hash found 'myobject' has 3 fields
513-
514-
504 strings with 1403 bytes (99.60% of keys, avg size 2.78)
515-
1 lists with 100004 items (00.20% of keys, avg size 100004.00)
516-
0 sets with 0 members (00.00% of keys, avg size 0.00)
517-
1 hashs with 3 fields (00.20% of keys, avg size 3.00)
518-
0 zsets with 0 members (00.00% of keys, avg size 0.00)
494+
```
495+
$ redis-cli --bigkeys
496+
497+
# Scanning the entire keyspace to find biggest keys as well as
498+
# average sizes per key type. You can use -i 0.1 to sleep 0.1 sec
499+
# per 100 SCAN commands (not usually needed).
500+
501+
100.00% ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
502+
Keys sampled: 55
503+
504+
-------- summary -------
505+
506+
Total key length in bytes is 495 (avg len 9.00)
507+
508+
Biggest list found "bikes:finished" has 1 items
509+
Biggest string found "all_bikes" has 36 bytes
510+
Biggest hash found "bike:1:stats" has 3 fields
511+
Biggest stream found "race:france" has 4 entries
512+
Biggest set found "bikes:racing:france" has 3 members
513+
Biggest zset found "racer_scores" has 8 members
514+
515+
1 lists with 1 items (01.82% of keys, avg size 1.00)
516+
16 strings with 149 bytes (29.09% of keys, avg size 9.31)
517+
1 MBbloomCFs with 0 ? (01.82% of keys, avg size 0.00)
518+
1 hashs with 3 fields (01.82% of keys, avg size 3.00)
519+
3 streams with 8 entries (05.45% of keys, avg size 2.67)
520+
2 TDIS-TYPEs with 0 ? (03.64% of keys, avg size 0.00)
521+
1 TopK-TYPEs with 0 ? (01.82% of keys, avg size 0.00)
522+
2 sets with 5 members (03.64% of keys, avg size 2.50)
523+
1 CMSk-TYPEs with 0 ? (01.82% of keys, avg size 0.00)
524+
2 zsets with 11 members (03.64% of keys, avg size 5.50)
525+
25 ReJSON-RLs with 0 ? (45.45% of keys, avg size 0.00)
526+
```
519527

520528
In the first part of the output, each new key larger than the previous larger
521529
key (of the same type) encountered is reported. The summary section
@@ -540,12 +548,128 @@ The `--bigkeys` option now works on cluster replicas.
540548
Similar to the `--bigkeys` option, `--memkeys` allows you to scan the entire keyspace to find biggest keys as well as
541549
the average sizes per key type.
542550

551+
```
552+
$ redis-cli --memkeys
553+
554+
# Scanning the entire keyspace to find biggest keys as well as
555+
# average sizes per key type. You can use -i 0.1 to sleep 0.1 sec
556+
# per 100 SCAN commands (not usually needed).
557+
558+
100.00% ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
559+
Keys sampled: 55
560+
561+
-------- summary -------
562+
563+
Total key length in bytes is 495 (avg len 9.00)
564+
565+
Biggest list found "bikes:finished" has 104 bytes
566+
Biggest string found "all_bikes" has 120 bytes
567+
Biggest MBbloomCF found "bikes:models" has 1048680 bytes
568+
Biggest hash found "bike:1:stats" has 104 bytes
569+
Biggest stream found "race:italy" has 7172 bytes
570+
Biggest TDIS-TYPE found "bikes:sales" has 9832 bytes
571+
Biggest TopK-TYPE found "bikes:keywords" has 114256 bytes
572+
Biggest set found "bikes:racing:france" has 120 bytes
573+
Biggest CMSk-TYPE found "bikes:profit" has 144056 bytes
574+
Biggest zset found "racer_scores" has 168 bytes
575+
Biggest ReJSON-RL found "bikes:inventory" has 4865 bytes
576+
577+
1 lists with 104 bytes (01.82% of keys, avg size 104.00)
578+
16 strings with 1360 bytes (29.09% of keys, avg size 85.00)
579+
1 MBbloomCFs with 1048680 bytes (01.82% of keys, avg size 1048680.00)
580+
1 hashs with 104 bytes (01.82% of keys, avg size 104.00)
581+
3 streams with 16960 bytes (05.45% of keys, avg size 5653.33)
582+
2 TDIS-TYPEs with 19648 bytes (03.64% of keys, avg size 9824.00)
583+
1 TopK-TYPEs with 114256 bytes (01.82% of keys, avg size 114256.00)
584+
2 sets with 208 bytes (03.64% of keys, avg size 104.00)
585+
1 CMSk-TYPEs with 144056 bytes (01.82% of keys, avg size 144056.00)
586+
2 zsets with 304 bytes (03.64% of keys, avg size 152.00)
587+
25 ReJSON-RLs with 15748 bytes (45.45% of keys, avg size 629.92)
588+
```
589+
543590
The `--memkeys` option now works on cluster replicas.
544591

545592
### Combine `--bigkeys` and `--memkeys`
546593

547594
You can use the `--keystats` and `--keystats-samples` options to combine `--memkeys` and `--bigkeys` with additional distribution data.
548595

596+
```
597+
$ redis-cli --keystats
598+
599+
# Scanning the entire keyspace to find the biggest keys and distribution information.
600+
# Use -i 0.1 to sleep 0.1 sec per 100 SCAN commands (not usually needed).
601+
# Use --cursor <n> to start the scan at the cursor <n> (usually after a Ctrl-C).
602+
# Use --top <n> to display <n> top key sizes (default is 10).
603+
# Ctrl-C to stop the scan.
604+
605+
100.00% ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
606+
Keys sampled: 55
607+
Keys size: 1.30M
608+
609+
--- Top 10 key sizes ---
610+
1 1.00M MBbloomCF "bikes:models"
611+
2 140.68K CMSk-TYPE "bikes:profit"
612+
3 111.58K TopK-TYPE "bikes:keywords"
613+
4 9.60K TDIS-TYPE "bikes:sales"
614+
5 9.59K TDIS-TYPE "racer_ages"
615+
6 7.00K stream "race:italy"
616+
7 4.92K stream "race:france"
617+
8 4.75K ReJSON-RL "bikes:inventory"
618+
9 4.64K stream "race:usa"
619+
10 1.26K ReJSON-RL "bicycle:7"
620+
621+
--- Top size per type ---
622+
list bikes:finished is 104B
623+
string all_bikes is 120B
624+
MBbloomCF bikes:models is 1.00M
625+
hash bike:1:stats is 104B
626+
stream race:italy is 7.00K
627+
TDIS-TYPE bikes:sales is 9.60K
628+
TopK-TYPE bikes:keywords is 111.58K
629+
set bikes:racing:france is 120B
630+
CMSk-TYPE bikes:profit is 140.68K
631+
zset racer_scores is 168B
632+
ReJSON-RL bikes:inventory is 4.75K
633+
634+
--- Top length and cardinality per type ---
635+
list bikes:finished has 1 items
636+
string all_bikes has 36B
637+
hash bike:1:stats has 3 fields
638+
stream race:france has 4 entries
639+
set bikes:racing:france has 3 members
640+
zset racer_scores has 8 members
641+
642+
Key size Percentile Total keys
643+
-------- ---------- -----------
644+
64B 0.0000% 3
645+
239B 50.0000% 28
646+
763B 75.0000% 42
647+
4.92K 87.5000% 49
648+
9.60K 93.7500% 52
649+
140.69K 96.8750% 54
650+
1.00M 100.0000% 55
651+
Note: 0.01% size precision, Mean: 24.17K, StdDeviation: 138.12K
652+
653+
Key name length Percentile Total keys
654+
--------------- ---------- -----------
655+
19B 100.0000% 55
656+
Total key length is 495B (9B avg)
657+
658+
Type Total keys Keys % Tot size Avg size Total length/card Avg ln/card
659+
--------- ------------ ------- -------- -------- ------------------ -----------
660+
list 1 1.82% 104B 104B 1 items 1.00
661+
string 16 29.09% 1.33K 85B 149B 9B
662+
MBbloomCF 1 1.82% 1.00M 1.00M - -
663+
hash 1 1.82% 104B 104B 3 fields 3.00
664+
stream 3 5.45% 16.56K 5.52K 8 entries 2.67
665+
TDIS-TYPE 2 3.64% 19.19K 9.59K - -
666+
TopK-TYPE 1 1.82% 111.58K 111.58K - -
667+
set 2 3.64% 208B 104B 5 members 2.50
668+
CMSk-TYPE 1 1.82% 140.68K 140.68K - -
669+
zset 2 3.64% 304B 152B 11 members 5.50
670+
ReJSON-RL 25 45.45% 15.38K 629B - -
671+
```
672+
549673
## Get a list of keys
550674

551675
It is also possible to scan the key space, again in a way that does not

0 commit comments

Comments
 (0)