Skip to content

Commit 6630a64

Browse files
committed
db: print value separation metrics
Fixes: #4581
1 parent 6f57a21 commit 6630a64

File tree

7 files changed

+361
-356
lines changed

7 files changed

+361
-356
lines changed

metrics.go

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -598,20 +598,21 @@ func (m *Metrics) RemoteTablesTotal() (count uint64, size uint64) {
598598
return remoteCount, remoteSize
599599
}
600600

601-
// String pretty-prints the metrics as below:
601+
// String pretty-prints the metrics as below (semi-adjusted visually to avoid
602+
// the crlfmt from auto-reformatting):
603+
//
604+
// | | | | ingested | moved | written | | amp | val sep | multilevel
605+
// level | tables size val-bl vtables | score ff cff | in | tables size | tables size |tables size| read | r w | refsz valblk| top in read
606+
// ------+-----------------------------+----------------+-------+--------------+--------------+-----------+-------+---------+--------------+------------------
607+
// 0 | 101 102B 0B 101 | 1.10 2.10 0.30 | 104B | 112 104B | 113 106B | 221 217B| 107B | 1 2.09 | 114B 0B| 104B 104B 104B
608+
// 1 | 201 202B 0B 201 | 1.20 2.20 0.60 | 204B | 212 204B | 213 206B | 421 417B| 207B | 2 2.04 | 214B 0B| 204B 204B 204B
609+
// 2 | 301 302B 0B 301 | 1.30 2.30 0.90 | 304B | 312 304B | 313 306B | 621 617B| 307B | 3 2.03 | 314B 0B| 304B 304B 304B
610+
// 3 | 401 402B 0B 401 | 1.40 2.40 1.20 | 404B | 412 404B | 413 406B | 821 817B| 407B | 4 2.02 | 414B 0B| 404B 404B 404B
611+
// 4 | 501 502B 0B 501 | 1.50 2.50 1.50 | 504B | 512 504B | 513 506B |1.0K 1017B| 507B | 5 2.02 | 514B 0B| 504B 504B 504B
612+
// 5 | 601 602B 0B 601 | 1.60 2.60 1.80 | 604B | 612 604B | 613 606B |1.2K 1.2KB| 607B | 6 2.01 | 614B 0B| 604B 604B 604B
613+
// 6 | 701 702B 0B 701 | - 2.70 2.10 | 704B | 712 704B | 713 706B |1.4K 1.4KB| 707B | 7 2.01 | 714B 0B| 704B 704B 704B
614+
// total | 2.8K 2.7KB 0B 2.8K | - - - | 2.8KB | 2.9K 2.8KB | 2.9K 2.8KB |5.7K 8.4KB| 2.8KB | 28 3.00 |2.8KB 0B| 2.8KB 2.8KB 2.8KB
602615
//
603-
// | | | | ingested | moved | written | | amp | multilevel
604-
// level | tables size val-bl vtables | score uc c | in | tables size | tables size | tables size | read | r w | top in read
605-
// ------+-----------------------------+----------------+-------+--------------+--------------+--------------+-------+----------+------------------
606-
// 0 | 101 102B 0B 101 | 1.10 2.10 0.30 | 104B | 112 104B | 113 106B | 221 217B | 107B | 1 2.09 | 104B 104B 104B
607-
// 1 | 201 202B 0B 201 | 1.20 2.20 0.60 | 204B | 212 204B | 213 206B | 421 417B | 207B | 2 2.04 | 204B 204B 204B
608-
// 2 | 301 302B 0B 301 | 1.30 2.30 0.90 | 304B | 312 304B | 313 306B | 621 617B | 307B | 3 2.03 | 304B 304B 304B
609-
// 3 | 401 402B 0B 401 | 1.40 2.40 1.20 | 404B | 412 404B | 413 406B | 821 817B | 407B | 4 2.02 | 404B 404B 404B
610-
// 4 | 501 502B 0B 501 | 1.50 2.50 1.50 | 504B | 512 504B | 513 506B | 1.0K 1017B | 507B | 5 2.02 | 504B 504B 504B
611-
// 5 | 601 602B 0B 601 | 1.60 2.60 1.80 | 604B | 612 604B | 613 606B | 1.2K 1.2KB | 607B | 6 2.01 | 604B 604B 604B
612-
// 6 | 701 702B 0B 701 | - 2.70 2.10 | 704B | 712 704B | 713 706B | 1.4K 1.4KB | 707B | 7 2.01 | 704B 704B 704B
613-
// total | 2.8K 2.7KB 0B 2.8K | - - - | 2.8KB | 2.9K 2.8KB | 2.9K 2.8KB | 5.7K 8.4KB | 2.8KB | 28 3.00 | 2.8KB 2.8KB 2.8KB
614-
// ------------------------------------------------------------------------------------------------------------------------------------------------
615616
// WAL: 22 files (24B) in: 25B written: 26B (4% overhead)
616617
// Flushes: 8
617618
// Compactions: 5 estimated debt: 6B in progress: 2 (7B)
@@ -631,6 +632,8 @@ func (m *Metrics) RemoteTablesTotal() (count uint64, size uint64) {
631632
// Filter utility: 47.4%
632633
// Ingestions: 27 as flushable: 36 (34B in 35 tables)
633634
// Cgo memory usage: 15KB block cache: 9.0KB (data: 4.0KB, maps: 2.0KB, entries: 3.0KB) memtables: 5.0KB
635+
//
636+
//nolint:lll
634637
func (m *Metrics) String() string {
635638
return redact.StringWithoutMarkers(m)
636639
}
@@ -655,13 +658,13 @@ func (m *Metrics) SafeFormat(w redact.SafePrinter, _ rune) {
655658
w.SafeString("\n")
656659
}
657660

658-
w.SafeString(" | | | | ingested | moved | written | | amp")
659-
appendIfMulti(" | multilevel")
661+
w.SafeString(" | | | | ingested | moved | written | | amp | val sep")
662+
appendIfMulti(" | multilevel")
660663
newline()
661-
w.SafeString("level | tables size val-bl vtables | score ff cff | in | tables size | tables size | tables size | read | r w")
662-
appendIfMulti(" | top in read")
664+
w.SafeString("level | tables size val-bl vtables | score ff cff | in | tables size | tables size | tables size | read | r w | refsz valblk")
665+
appendIfMulti(" | top in read")
663666
newline()
664-
w.SafeString("------+-----------------------------+----------------+-------+--------------+--------------+--------------+-------+---------")
667+
w.SafeString("------+-----------------------------+----------------+-------+--------------+--------------+--------------+-------+----------+--------------")
665668
appendIfMulti("-+------------------")
666669
newline()
667670

@@ -672,7 +675,7 @@ func (m *Metrics) SafeFormat(w redact.SafePrinter, _ rune) {
672675
// Format a zero level score as a dash.
673676
score = math.NaN()
674677
}
675-
w.Printf("| %5s %6s %6s %7s | %4s %4s %4s | %5s | %5s %6s | %5s %6s | %5s %6s | %5s | %3d %4s",
678+
w.Printf("| %5s %6s %6s %7s | %4s %4s %4s | %5s | %5s %6s | %5s %6s | %5s %6s | %5s | %3d %4s | %5s %7s",
676679
humanize.Count.Int64(m.TablesCount),
677680
humanize.Bytes.Int64(m.TablesSize),
678681
humanize.Bytes.Uint64(m.Additional.ValueBlocksSize),
@@ -690,6 +693,8 @@ func (m *Metrics) SafeFormat(w redact.SafePrinter, _ rune) {
690693
humanize.Bytes.Uint64(m.TableBytesRead),
691694
redact.Safe(m.Sublevels),
692695
humanizeFloat(m.WriteAmp(), 4),
696+
humanize.Bytes.Uint64(m.EstimatedReferencesSize),
697+
humanize.Bytes.Uint64(m.Additional.ValueBlocksSize),
693698
)
694699

695700
if multiExists {
@@ -721,7 +726,7 @@ func (m *Metrics) SafeFormat(w redact.SafePrinter, _ rune) {
721726
w.SafeString("total ")
722727
formatRow(&total)
723728

724-
w.SafeString("----------------------------------------------------------------------------------------------------------------------------")
729+
w.SafeString("--------------------------------------------------------------------------------------------------------------------------------------------")
725730
appendIfMulti("--------------------")
726731
newline()
727732
w.Printf("WAL: %d files (%s) in: %s written: %s (%.0f%% overhead)",

testdata/compaction/l0_to_lbase_compaction

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ L6:
3232

3333
metrics
3434
----
35-
| | | | ingested | moved | written | | amp
36-
level | tables size val-bl vtables | score ff cff | in | tables size | tables size | tables size | read | r w
37-
------+-----------------------------+----------------+-------+--------------+--------------+--------------+-------+---------
38-
0 | 0 0B 0B 0 | - 0 0 | 4.5MB | 0 0B | 0 0B | 3 6.0MB | 0B | 0 1.32
39-
1 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0
40-
2 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0
41-
3 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0
42-
4 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0
43-
5 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0
44-
6 | 3 6.0MB 0B 0 | - 0.09 0.09 | 0B | 0 0B | 3 6.0MB | 0 0B | 0B | 1 0
45-
total | 3 6.0MB 0B 0 | - - - | 4.5MB | 0 0B | 3 6.0MB | 3 10MB | 0B | 1 2.32
46-
----------------------------------------------------------------------------------------------------------------------------
35+
| | | | ingested | moved | written | | amp | val sep
36+
level | tables size val-bl vtables | score ff cff | in | tables size | tables size | tables size | read | r w | refsz valblk
37+
------+-----------------------------+----------------+-------+--------------+--------------+--------------+-------+----------+--------------
38+
0 | 0 0B 0B 0 | - 0 0 | 4.5MB | 0 0B | 0 0B | 3 6.0MB | 0B | 0 1.32 | 0B 0B
39+
1 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
40+
2 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
41+
3 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
42+
4 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
43+
5 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
44+
6 | 3 6.0MB 0B 0 | - 0.09 0.09 | 0B | 0 0B | 3 6.0MB | 0 0B | 0B | 1 0 | 0B 0B
45+
total | 3 6.0MB 0B 0 | - - - | 4.5MB | 0 0B | 3 6.0MB | 3 10MB | 0B | 1 2.32 | 0B 0B
46+
--------------------------------------------------------------------------------------------------------------------------------------------
4747
WAL: 1 files (0B) in: 4.5MB written: 4.5MB (0% overhead)
4848
Flushes: 2
4949
Compactions: 3 estimated debt: 0B in progress: 0 (0B) canceled: 0 (0B) failed: 0 problem spans: 0

testdata/compaction/value_separation

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,18 @@ z: (zoo, .)
120120

121121
metrics
122122
----
123-
| | | | ingested | moved | written | | amp
124-
level | tables size val-bl vtables | score ff cff | in | tables size | tables size | tables size | read | r w
125-
------+-----------------------------+----------------+-------+--------------+--------------+--------------+-------+---------
126-
0 | 0 0B 0B 0 | - 0 0 | 41B | 0 0B | 0 0B | 1 848B | 0B | 0 25.6
127-
1 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 1 848B | 0 0B | 0B | 0 0
128-
2 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 1 848B | 0 0B | 0B | 0 0
129-
3 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 1 848B | 0 0B | 0B | 0 0
130-
4 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 1 848B | 0 0B | 0B | 0 0
131-
5 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 1 848B | 0 0B | 0B | 0 0
132-
6 | 1 899B 0B 0 | - 0.00 0.00 | 848B | 0 0B | 0 0B | 1 899B | 1.7KB | 1 1.19
133-
total | 1 899B 0B 0 | - - - | 41B | 0 0B | 5 4.1KB | 2 1.7KB | 1.7KB | 1 51.2
134-
----------------------------------------------------------------------------------------------------------------------------
123+
| | | | ingested | moved | written | | amp | val sep
124+
level | tables size val-bl vtables | score ff cff | in | tables size | tables size | tables size | read | r w | refsz valblk
125+
------+-----------------------------+----------------+-------+--------------+--------------+--------------+-------+----------+--------------
126+
0 | 0 0B 0B 0 | - 0 0 | 41B | 0 0B | 0 0B | 1 848B | 0B | 0 25.6 | 0B 0B
127+
1 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 1 848B | 0 0B | 0B | 0 0 | 0B 0B
128+
2 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 1 848B | 0 0B | 0B | 0 0 | 0B 0B
129+
3 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 1 848B | 0 0B | 0B | 0 0 | 0B 0B
130+
4 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 1 848B | 0 0B | 0B | 0 0 | 0B 0B
131+
5 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 1 848B | 0 0B | 0B | 0 0 | 0B 0B
132+
6 | 1 899B 0B 0 | - 0.00 0.00 | 848B | 0 0B | 0 0B | 1 899B | 1.7KB | 1 1.19 | 112B 0B
133+
total | 1 899B 0B 0 | - - - | 41B | 0 0B | 5 4.1KB | 2 1.7KB | 1.7KB | 1 51.2 | 112B 0B
134+
--------------------------------------------------------------------------------------------------------------------------------------------
135135
WAL: 1 files (0B) in: 30B written: 41B (37% overhead)
136136
Flushes: 1
137137
Compactions: 6 estimated debt: 0B in progress: 0 (0B) canceled: 0 (0B) failed: 0 problem spans: 0
@@ -360,18 +360,18 @@ Blob files:
360360

361361
metrics
362362
----
363-
| | | | ingested | moved | written | | amp
364-
level | tables size val-bl vtables | score ff cff | in | tables size | tables size | tables size | read | r w
365-
------+-----------------------------+----------------+-------+--------------+--------------+--------------+-------+---------
366-
0 | 0 0B 0B 0 | - 0 0 | 156B | 0 0B | 0 0B | 2 1.7KB | 0B | 0 14.5
367-
1 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0
368-
2 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0
369-
3 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0
370-
4 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0
371-
5 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0
372-
6 | 1 900B 0B 0 | - 0.00 0.00 | 1.7KB | 0 0B | 0 0B | 1 900B | 1.7KB | 1 0.51
373-
total | 1 900B 0B 0 | - - - | 156B | 0 0B | 0 0B | 3 2.8KB | 1.7KB | 1 21.3
374-
----------------------------------------------------------------------------------------------------------------------------
363+
| | | | ingested | moved | written | | amp | val sep
364+
level | tables size val-bl vtables | score ff cff | in | tables size | tables size | tables size | read | r w | refsz valblk
365+
------+-----------------------------+----------------+-------+--------------+--------------+--------------+-------+----------+--------------
366+
0 | 0 0B 0B 0 | - 0 0 | 156B | 0 0B | 0 0B | 2 1.7KB | 0B | 0 14.5 | 0B 0B
367+
1 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
368+
2 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
369+
3 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
370+
4 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
371+
5 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
372+
6 | 1 900B 0B 0 | - 0.00 0.00 | 1.7KB | 0 0B | 0 0B | 1 900B | 1.7KB | 1 0.51 | 232B 0B
373+
total | 1 900B 0B 0 | - - - | 156B | 0 0B | 0 0B | 3 2.8KB | 1.7KB | 1 21.3 | 232B 0B
374+
--------------------------------------------------------------------------------------------------------------------------------------------
375375
WAL: 1 files (0B) in: 126B written: 156B (24% overhead)
376376
Flushes: 2
377377
Compactions: 2 estimated debt: 0B in progress: 0 (0B) canceled: 0 (0B) failed: 0 problem spans: 0

0 commit comments

Comments
 (0)