From f233ee7d68e200564d244be671a0209162180525 Mon Sep 17 00:00:00 2001 From: Radu Berinde Date: Thu, 13 Jul 2023 11:09:55 -0700 Subject: [PATCH] db: improve metrics formatting This change improves the formatting of the Pebble metrics: - we no longer try to artificially fit non-tabular information in a single table - all byte figures end in B/KB/MB/etc - counts and corresponding sizes are grouped together - flushable ingests information moved under ingestions These metrics are periodically logged and can be obtained through the db console as well. Fixes #1473. --- internal/humanize/humanize.go | 6 + metrics.go | 144 ++++++------- metrics_test.go | 74 ++----- testdata/event_listener | 90 ++++---- testdata/ingest | 45 ++-- testdata/metrics | 386 ++++++++++++++++++---------------- tool/testdata/db_lsm | 45 ++-- 7 files changed, 390 insertions(+), 400 deletions(-) diff --git a/internal/humanize/humanize.go b/internal/humanize/humanize.go index 9b1d532525..57318b325b 100644 --- a/internal/humanize/humanize.go +++ b/internal/humanize/humanize.go @@ -41,6 +41,12 @@ var IEC = config{1024, []string{" B", " K", " M", " G", " T", " P", " E"}} // SI produces human readable representations of integer values in SI units. var SI = config{1000, []string{"", " K", " M", " G", " T", " P", " E"}} +// Bytes produces human readable representations of byte values in IEC units. +var Bytes = config{1024, []string{"B", "KB", "MB", "GB", "TB", "PB", "EB"}} + +// Count produces human readable representations of unitless values in SI units. +var Count = config{1000, []string{"", "K", "M", "G", "T", "P", "E"}} + // Int64 produces a human readable representation of the value. func (c *config) Int64(s int64) FormattedString { if s < 0 { diff --git a/metrics.go b/metrics.go index 7749583971..2598a2eb26 100644 --- a/metrics.go +++ b/metrics.go @@ -6,7 +6,6 @@ package pebble import ( "fmt" - "strings" "time" "github.com/cockroachdb/pebble/internal/base" @@ -29,10 +28,10 @@ type FilterMetrics = sstable.FilterMetrics type ThroughputMetric = base.ThroughputMetric func formatCacheMetrics(w redact.SafePrinter, m *CacheMetrics, name redact.SafeString) { - w.Printf("%7s %9s %7s %6.1f%% (score == hit-rate)\n", + w.Printf("%s: %s (%s) hit rate: %.1f%%\n", name, - humanize.SI.Int64(m.Count), - humanize.IEC.Int64(m.Size), + humanize.Count.Int64(m.Count), + humanize.Bytes.Int64(m.Size), redact.Safe(hitRate(m.Hits, m.Misses))) } @@ -126,22 +125,25 @@ func (m *LevelMetrics) WriteAmp() float64 { func (m *LevelMetrics) format( w redact.SafePrinter, score redact.SafeValue, includeValueBlocksSize bool, ) { - w.Printf("%9d %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %7d %7.1f", + //w.Printf("%9d %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %7d %7.1f", + + w.Printf("| %9d %7s | %7s | %7s | %7s %7s | %7s %7s | %7s %7s | %7s | %7d %7.1f", redact.Safe(m.NumFiles), - humanize.IEC.Int64(m.Size), + humanize.Bytes.Int64(m.Size), score, - humanize.IEC.Uint64(m.BytesIn), - humanize.IEC.Uint64(m.BytesIngested), - humanize.SI.Uint64(m.TablesIngested), - humanize.IEC.Uint64(m.BytesMoved), - humanize.SI.Uint64(m.TablesMoved), - humanize.IEC.Uint64(m.BytesFlushed+m.BytesCompacted), - humanize.SI.Uint64(m.TablesFlushed+m.TablesCompacted), - humanize.IEC.Uint64(m.BytesRead), + humanize.Bytes.Uint64(m.BytesIn), + humanize.Count.Uint64(m.TablesIngested), + humanize.Bytes.Uint64(m.BytesIngested), + humanize.Count.Uint64(m.TablesMoved), + humanize.Bytes.Uint64(m.BytesMoved), + humanize.Count.Uint64(m.TablesFlushed+m.TablesCompacted), + humanize.Bytes.Uint64(m.BytesFlushed+m.BytesCompacted), + humanize.Bytes.Uint64(m.BytesRead), redact.Safe(m.Sublevels), redact.Safe(m.WriteAmp())) + if includeValueBlocksSize { - w.Printf(" %7s\n", humanize.IEC.Uint64(m.Additional.ValueBlocksSize)) + w.Printf("| %7s\n", humanize.Bytes.Uint64(m.Additional.ValueBlocksSize)) } else { w.SafeString("\n") } @@ -364,27 +366,6 @@ func (m *Metrics) Total() LevelMetrics { const notApplicable = redact.SafeString("-") -func (m *Metrics) formatWAL(w redact.SafePrinter) { - var writeAmp float64 - if m.WAL.BytesIn > 0 { - writeAmp = float64(m.WAL.BytesWritten) / float64(m.WAL.BytesIn) - } - w.Printf(" WAL %9d %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %7.1f\n", - redact.Safe(m.WAL.Files), - humanize.Uint64(m.WAL.Size), - notApplicable, - humanize.Uint64(m.WAL.BytesIn), - notApplicable, - notApplicable, - notApplicable, - notApplicable, - humanize.Uint64(m.WAL.BytesWritten), - notApplicable, - notApplicable, - notApplicable, - redact.Safe(writeAmp)) -} - // String pretty-prints the metrics, showing a line for the WAL, a line per-level, and // a total: // @@ -436,18 +417,23 @@ func (m *Metrics) SafeFormat(w redact.SafePrinter, _ rune) { // RedactableStrings. https://github.com/cockroachdb/redact/issues/17 haveValueBlocks := false - var valueBlocksHeading redact.SafeString for level := 0; level < numLevels; level++ { if m.Levels[level].Additional.ValueBlocksSize > 0 { haveValueBlocks = true - valueBlocksHeading = "__val-bl" break } } + // print a string and optionally include a second string if we have value blocks. + print := func(s redact.SafeString, valBlocks redact.SafeString) { + w.SafeString(s) + if haveValueBlocks { + w.SafeString(valBlocks) + } + w.SafeString("\n") + } + print(" level | tables | score | in | ingest | move | write | read | r-amp w-amp", "| val-bl") + print("--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+----------------", "+--------") var total LevelMetrics - w.Printf("__level_____count____size___score______in__ingest(sz_cnt)"+ - "____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp%s\n", valueBlocksHeading) - m.formatWAL(w) for level := 0; level < numLevels; level++ { l := &m.Levels[level] w.Printf("%7d ", redact.Safe(level)) @@ -470,57 +456,65 @@ func (m *Metrics) SafeFormat(w redact.SafePrinter, _ rune) { w.SafeString(" total ") total.format(w, notApplicable, haveValueBlocks) - w.Printf(" flush %9d %31s %7d %7d %s\n", - redact.Safe(m.Flush.Count), - humanize.IEC.Uint64(m.Flush.AsIngestBytes), - redact.Safe(m.Flush.AsIngestTableCount), - redact.Safe(m.Flush.AsIngestCount), - redact.SafeString(`(ingest = tables-ingested, move = ingested-as-flushable)`)) - w.Printf("compact %9d %7s %7s %7d %s %s\n", + print("---------------------------------------------------------------------------------------------------------------------------------", "---------") + + w.Printf("WAL: %d (%s) in: %s written: %s (%.0f%% overhead)\n", + redact.Safe(m.WAL.Files), + humanize.Bytes.Uint64(m.WAL.Size), + humanize.Bytes.Uint64(m.WAL.BytesIn), + humanize.Bytes.Uint64(m.WAL.BytesWritten), + redact.Safe(percent(int64(m.WAL.BytesWritten)-int64(m.WAL.BytesIn), int64(m.WAL.BytesIn)))) + + w.Printf("Flushes: %d\n", redact.Safe(m.Flush.Count)) + + w.Printf("Compactions: %d estimated debt: %s in progress: %d (%s)\n", redact.Safe(m.Compact.Count), - humanize.IEC.Uint64(m.Compact.EstimatedDebt), - humanize.IEC.Int64(m.Compact.InProgressBytes), + humanize.Bytes.Uint64(m.Compact.EstimatedDebt), redact.Safe(m.Compact.NumInProgress), - redact.SafeString(strings.Repeat(" ", 24)), - redact.SafeString(`(size == estimated-debt, score = in-progress-bytes, in = num-in-progress)`)) - w.Printf(" ctype %9d %7d %7d %7d %7d %7d %7d %s\n", + humanize.Bytes.Int64(m.Compact.InProgressBytes)) + + w.Printf(" default: %d delete: %d elision: %d move: %d read: %d rewrite: %d multi-level: %d\n", redact.Safe(m.Compact.DefaultCount), redact.Safe(m.Compact.DeleteOnlyCount), redact.Safe(m.Compact.ElisionOnlyCount), redact.Safe(m.Compact.MoveCount), redact.Safe(m.Compact.ReadCount), redact.Safe(m.Compact.RewriteCount), - redact.Safe(m.Compact.MultiLevelCount), - redact.SafeString(`(default, delete, elision, move, read, rewrite, multi-level)`)) - w.Printf(" memtbl %9d %7s\n", + redact.Safe(m.Compact.MultiLevelCount)) + + w.Printf("MemTables: %d (%s) zombie: %d (%s)\n", redact.Safe(m.MemTable.Count), - humanize.IEC.Uint64(m.MemTable.Size)) - w.Printf("zmemtbl %9d %7s\n", + humanize.Bytes.Uint64(m.MemTable.Size), redact.Safe(m.MemTable.ZombieCount), - humanize.IEC.Uint64(m.MemTable.ZombieSize)) - w.Printf(" ztbl %9d %7s\n", + humanize.Bytes.Uint64(m.MemTable.ZombieSize)) + + w.Printf("Zombie tables: %d (%s)\n", redact.Safe(m.Table.ZombieCount), - humanize.IEC.Uint64(m.Table.ZombieSize)) - formatCacheMetrics(w, &m.BlockCache, "bcache") - formatCacheMetrics(w, &m.TableCache, "tcache") - w.Printf(" snaps %9d %7s %7d (score == earliest seq num)\n", + humanize.Bytes.Uint64(m.Table.ZombieSize)) + + formatCacheMetrics(w, &m.BlockCache, "Block cache") + formatCacheMetrics(w, &m.TableCache, "Table cache") + + w.Printf("Snapshots: %d earliest seq num: %d\n", redact.Safe(m.Snapshots.Count), - notApplicable, redact.Safe(m.Snapshots.EarliestSeqNum)) - w.Printf(" titers %9d\n", redact.Safe(m.TableIters)) - w.Printf(" filter %9s %7s %6.1f%% (score == utility)\n", - notApplicable, - notApplicable, - redact.Safe(hitRate(m.Filter.Hits, m.Filter.Misses))) - w.Printf(" ingest %9d\n", + + w.Printf("Table iters: %d\n", redact.Safe(m.TableIters)) + w.Printf("Filter utility: %.1f%%\n", redact.Safe(hitRate(m.Filter.Hits, m.Filter.Misses))) + w.Printf("Ingestions: %d as flushable: %d (%s in %d tables)\n", redact.Safe(m.Ingest.Count), - ) + redact.Safe(m.Flush.AsIngestCount), + humanize.Bytes.Uint64(m.Flush.AsIngestBytes), + redact.Safe(m.Flush.AsIngestTableCount)) } func hitRate(hits, misses int64) float64 { - sum := hits + misses - if sum == 0 { + return percent(hits, hits+misses) +} + +func percent(numerator, denominator int64) float64 { + if denominator == 0 { return 0 } - return 100 * float64(hits) / float64(sum) + return 100 * float64(numerator) / float64(denominator) } diff --git a/metrics_test.go b/metrics_test.go index 9bc32be54e..40f4271746 100644 --- a/metrics_test.go +++ b/metrics_test.go @@ -18,7 +18,7 @@ import ( "github.com/stretchr/testify/require" ) -func TestMetricsFormat(t *testing.T) { +func exampleMetrics() Metrics { var m Metrics m.BlockCache.Size = 1 m.BlockCache.Count = 2 @@ -79,34 +79,7 @@ func TestMetricsFormat(t *testing.T) { l.TablesIngested = base + 12 l.TablesMoved = base + 13 } - - const expected = ` -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp - WAL 22 24 B - 25 B - - - - 26 B - - - 1.0 - 0 101 102 B 103.00 104 B 104 B 112 106 B 113 217 B 221 107 B 1 2.1 - 1 201 202 B 203.00 204 B 204 B 212 206 B 213 417 B 421 207 B 2 2.0 - 2 301 302 B 303.00 304 B 304 B 312 306 B 313 617 B 621 307 B 3 2.0 - 3 401 402 B 403.00 404 B 404 B 412 406 B 413 817 B 821 407 B 4 2.0 - 4 501 502 B 503.00 504 B 504 B 512 506 B 513 1017 B 1.0 K 507 B 5 2.0 - 5 601 602 B 603.00 604 B 604 B 612 606 B 613 1.2 K 1.2 K 607 B 6 2.0 - 6 701 702 B - 704 B 704 B 712 706 B 713 1.4 K 1.4 K 707 B 7 2.0 - total 2807 2.7 K - 2.8 K 2.8 K 2.9 K 2.8 K 2.9 K 8.4 K 5.7 K 2.8 K 28 3.0 - flush 8 34 B 35 36 (ingest = tables-ingested, move = ingested-as-flushable) -compact 5 6 B 7 B 2 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 27 28 29 30 31 32 33 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 12 11 B -zmemtbl 14 13 B - ztbl 16 15 B - bcache 2 1 B 42.9% (score == hit-rate) - tcache 18 17 B 48.7% (score == hit-rate) - snaps 4 - 1024 (score == earliest seq num) - titers 21 - filter - - 47.4% (score == utility) - ingest 27 -` - if s := "\n" + m.String(); expected != s { - t.Fatalf("expected%s\nbut found%s", expected, s) - } + return m } func TestMetrics(t *testing.T) { @@ -143,6 +116,17 @@ func TestMetrics(t *testing.T) { datadriven.RunTest(t, "testdata/metrics", func(t *testing.T, td *datadriven.TestData) string { switch td.Cmd { + case "example": + m := exampleMetrics() + res := m.String() + + // Nothing in the metrics should be redacted. + redacted := string(redact.Sprintf("%s", &m).Redact()) + if redacted != res { + td.Fatalf(t, "redacted metrics don't match\nunredacted:\n%s\nredacted:%s\n", res, redacted) + } + return res + case "batch": b := d.NewBatch() if err := runBatchDefineCmd(td, b); err != nil { @@ -270,38 +254,6 @@ func TestMetrics(t *testing.T) { }) } -func TestMetricsRedact(t *testing.T) { - const expected = ` -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp - WAL 0 0 B - 0 B - - - - 0 B - - - 0.0 - 0 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 6 0 0 B - 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - total 0 0 B - 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - flush 0 0 B 0 0 (ingest = tables-ingested, move = ingested-as-flushable) -compact 0 0 B 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 0 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 0 0 B -zmemtbl 0 0 B - ztbl 0 0 B - bcache 0 0 B 0.0% (score == hit-rate) - tcache 0 0 B 0.0% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 0 - filter - - 0.0% (score == utility) - ingest 0 -` - - got := redact.Sprintf("%s", &Metrics{}).Redact() - if s := "\n" + got; expected != s { - t.Fatalf("expected%s\nbut found%s", expected, s) - } -} - func TestMetricsWAmpDisableWAL(t *testing.T) { d, err := Open("", &Options{FS: vfs.NewMem(), DisableWAL: true}) require.NoError(t, err) diff --git a/testdata/event_listener b/testdata/event_listener index c1da34e65b..756b9d384b 100644 --- a/testdata/event_listener +++ b/testdata/event_listener @@ -268,28 +268,29 @@ remove: ext/0 metrics ---- -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp - WAL 1 27 B - 48 B - - - - 108 B - - - 2.2 - 0 2 1.3 K 0.40 81 B 717 B 1 0 B 0 1.9 K 3 0 B 2 24.5 - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 6 1 662 B - 1.3 K 0 B 0 0 B 0 662 B 1 1.3 K 1 0.5 - total 3 2.0 K - 825 B 717 B 1 0 B 0 3.4 K 4 1.3 K 3 4.2 - flush 3 0 B 0 0 (ingest = tables-ingested, move = ingested-as-flushable) -compact 1 2.0 K 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 1 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 1 256 K -zmemtbl 0 0 B - ztbl 0 0 B - bcache 8 1.2 K 11.1% (score == hit-rate) - tcache 1 680 B 40.0% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 0 - filter - - 0.0% (score == utility) - ingest 1 + level | tables | score | in | ingest | move | write | read | r-amp w-amp +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+---------------- + 0 | 2 1.3KB | 0.40 | 81B | 1 717B | 0 0B | 3 1.9KB | 0B | 2 24.5 + 1 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 2 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 3 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 4 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 5 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 6 | 1 662B | - | 1.3KB | 0 0B | 0 0B | 1 662B | 1.3KB | 1 0.5 + total | 3 2.0KB | - | 825B | 1 717B | 0 0B | 4 3.4KB | 1.3KB | 3 4.2 +--------------------------------------------------------------------------------------------------------------------------------- +WAL: 1 (27B) in: 48B written: 108B (125% overhead) +Flushes: 3 +Compactions: 1 estimated debt: 2.0KB in progress: 0 (0B) + default: 1 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 multi-level: 0 +MemTables: 1 (256KB) zombie: 0 (0B) +Zombie tables: 0 (0B) +Block cache: 8 (1.2KB) hit rate: 11.1% +Table cache: 1 (680B) hit rate: 40.0% +Snapshots: 0 earliest seq num: 0 +Table iters: 0 +Filter utility: 0.0% +Ingestions: 1 as flushable: 0 (0B in 0 tables) # Set up a scenario where the table to be ingested overlaps with the memtable. # The table is ingested as a flushable. The flush metrics refect the flushed @@ -362,28 +363,29 @@ sync: db/MANIFEST-000023 metrics ---- -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp - WAL 1 29 B - 82 B - - - - 110 B - - - 1.3 - 0 4 2.7 K 0.80 81 B 1.4 K 2 0 B 0 2.6 K 4 0 B 4 32.7 - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 6 2 1.3 K - 1.3 K 717 B 1 0 B 0 662 B 1 1.3 K 1 0.5 - total 6 4.0 K - 2.2 K 2.1 K 3 0 B 0 5.4 K 5 1.3 K 5 2.5 - flush 6 1.4 K 2 1 (ingest = tables-ingested, move = ingested-as-flushable) -compact 1 4.0 K 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 1 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 1 512 K -zmemtbl 0 0 B - ztbl 0 0 B - bcache 16 2.5 K 14.3% (score == hit-rate) - tcache 1 680 B 50.0% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 0 - filter - - 0.0% (score == utility) - ingest 1 + level | tables | score | in | ingest | move | write | read | r-amp w-amp +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+---------------- + 0 | 4 2.7KB | 0.80 | 81B | 2 1.4KB | 0 0B | 4 2.6KB | 0B | 4 32.7 + 1 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 2 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 3 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 4 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 5 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 6 | 2 1.3KB | - | 1.3KB | 1 717B | 0 0B | 1 662B | 1.3KB | 1 0.5 + total | 6 4.0KB | - | 2.2KB | 3 2.1KB | 0 0B | 5 5.4KB | 1.3KB | 5 2.5 +--------------------------------------------------------------------------------------------------------------------------------- +WAL: 1 (29B) in: 82B written: 110B (34% overhead) +Flushes: 6 +Compactions: 1 estimated debt: 4.0KB in progress: 0 (0B) + default: 1 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 multi-level: 0 +MemTables: 1 (512KB) zombie: 0 (0B) +Zombie tables: 0 (0B) +Block cache: 16 (2.5KB) hit rate: 14.3% +Table cache: 1 (680B) hit rate: 50.0% +Snapshots: 0 earliest seq num: 0 +Table iters: 0 +Filter utility: 0.0% +Ingestions: 1 as flushable: 1 (1.4KB in 2 tables) sstables ---- diff --git a/testdata/ingest b/testdata/ingest index 62c9018a41..41f808fda3 100644 --- a/testdata/ingest +++ b/testdata/ingest @@ -31,28 +31,29 @@ lsm metrics ---- -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp - WAL 1 0 B - 0 B - - - - 0 B - - - 0.0 - 0 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 6 1 696 B - 0 B 696 B 1 0 B 0 0 B 0 0 B 1 0.0 - total 1 696 B - 696 B 696 B 1 0 B 0 696 B 0 0 B 1 1.0 - flush 0 0 B 0 0 (ingest = tables-ingested, move = ingested-as-flushable) -compact 0 0 B 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 0 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 1 256 K -zmemtbl 0 0 B - ztbl 0 0 B - bcache 8 1.2 K 42.9% (score == hit-rate) - tcache 1 680 B 50.0% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 0 - filter - - 0.0% (score == utility) - ingest 1 + level | tables | score | in | ingest | move | write | read | r-amp w-amp +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+---------------- + 0 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 1 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 2 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 3 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 4 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 5 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 6 | 1 696B | - | 0B | 1 696B | 0 0B | 0 0B | 0B | 1 0.0 + total | 1 696B | - | 696B | 1 696B | 0 0B | 0 696B | 0B | 1 1.0 +--------------------------------------------------------------------------------------------------------------------------------- +WAL: 1 (0B) in: 0B written: 0B (0% overhead) +Flushes: 0 +Compactions: 0 estimated debt: 0B in progress: 0 (0B) + default: 0 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 multi-level: 0 +MemTables: 1 (256KB) zombie: 0 (0B) +Zombie tables: 0 (0B) +Block cache: 8 (1.2KB) hit rate: 42.9% +Table cache: 1 (680B) hit rate: 50.0% +Snapshots: 0 earliest seq num: 0 +Table iters: 0 +Filter utility: 0.0% +Ingestions: 1 as flushable: 0 (0B in 0 tables) iter diff --git a/testdata/metrics b/testdata/metrics index 4a362f27d3..4721d1d495 100644 --- a/testdata/metrics +++ b/testdata/metrics @@ -1,3 +1,29 @@ +example +---- + level | tables | score | in | ingest | move | write | read | r-amp w-amp +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+---------------- + 0 | 101 102B | 103.00 | 104B | 112 104B | 113 106B | 221 217B | 107B | 1 2.1 + 1 | 201 202B | 203.00 | 204B | 212 204B | 213 206B | 421 417B | 207B | 2 2.0 + 2 | 301 302B | 303.00 | 304B | 312 304B | 313 306B | 621 617B | 307B | 3 2.0 + 3 | 401 402B | 403.00 | 404B | 412 404B | 413 406B | 821 817B | 407B | 4 2.0 + 4 | 501 502B | 503.00 | 504B | 512 504B | 513 506B | 1.0K 1017B | 507B | 5 2.0 + 5 | 601 602B | 603.00 | 604B | 612 604B | 613 606B | 1.2K 1.2KB | 607B | 6 2.0 + 6 | 701 702B | - | 704B | 712 704B | 713 706B | 1.4K 1.4KB | 707B | 7 2.0 + total | 2807 2.7KB | - | 2.8KB | 2.9K 2.8KB | 2.9K 2.8KB | 5.7K 8.4KB | 2.8KB | 28 3.0 +--------------------------------------------------------------------------------------------------------------------------------- +WAL: 22 (24B) in: 25B written: 26B (4% overhead) +Flushes: 8 +Compactions: 5 estimated debt: 6B in progress: 2 (7B) + default: 27 delete: 28 elision: 29 move: 30 read: 31 rewrite: 32 multi-level: 33 +MemTables: 12 (11B) zombie: 14 (13B) +Zombie tables: 16 (15B) +Block cache: 2 (1B) hit rate: 42.9% +Table cache: 18 (17B) hit rate: 48.7% +Snapshots: 4 earliest seq num: 1024 +Table iters: 21 +Filter utility: 47.4% +Ingestions: 27 as flushable: 36 (34B in 35 tables) + batch set a 1 ---- @@ -17,28 +43,29 @@ iter-new b metrics ---- -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp - WAL 1 28 B - 17 B - - - - 56 B - - - 3.3 - 0 1 633 B 0.25 28 B 0 B 0 0 B 0 633 B 1 0 B 1 22.6 - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 6 0 0 B - 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - total 1 633 B - 56 B 0 B 0 0 B 0 689 B 1 0 B 1 12.3 - flush 1 0 B 0 0 (ingest = tables-ingested, move = ingested-as-flushable) -compact 0 0 B 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 0 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 1 256 K -zmemtbl 1 256 K - ztbl 0 0 B - bcache 4 560 B 0.0% (score == hit-rate) - tcache 1 680 B 0.0% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 1 - filter - - 0.0% (score == utility) - ingest 0 + level | tables | score | in | ingest | move | write | read | r-amp w-amp +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+---------------- + 0 | 1 633B | 0.25 | 28B | 0 0B | 0 0B | 1 633B | 0B | 1 22.6 + 1 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 2 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 3 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 4 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 5 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 6 | 0 0B | - | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + total | 1 633B | - | 56B | 0 0B | 0 0B | 1 689B | 0B | 1 12.3 +--------------------------------------------------------------------------------------------------------------------------------- +WAL: 1 (28B) in: 17B written: 56B (229% overhead) +Flushes: 1 +Compactions: 0 estimated debt: 0B in progress: 0 (0B) + default: 0 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 multi-level: 0 +MemTables: 1 (256KB) zombie: 1 (256KB) +Zombie tables: 0 (0B) +Block cache: 4 (560B) hit rate: 0.0% +Table cache: 1 (680B) hit rate: 0.0% +Snapshots: 0 earliest seq num: 0 +Table iters: 1 +Filter utility: 0.0% +Ingestions: 0 as flushable: 0 (0B in 0 tables) disk-usage ---- @@ -66,28 +93,29 @@ compact a-z metrics ---- -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp - WAL 1 28 B - 34 B - - - - 84 B - - - 2.5 - 0 0 0 B 0.00 56 B 0 B 0 0 B 0 1.2 K 2 0 B 0 22.6 - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 6 1 639 B - 1.2 K 0 B 0 0 B 0 639 B 1 1.2 K 1 0.5 - total 1 639 B - 84 B 0 B 0 0 B 0 1.9 K 3 1.2 K 1 23.7 - flush 2 0 B 0 0 (ingest = tables-ingested, move = ingested-as-flushable) -compact 1 0 B 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 1 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 1 256 K -zmemtbl 2 512 K - ztbl 2 1.2 K - bcache 8 1.1 K 42.9% (score == hit-rate) - tcache 2 1.3 K 66.7% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 2 - filter - - 0.0% (score == utility) - ingest 0 + level | tables | score | in | ingest | move | write | read | r-amp w-amp +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+---------------- + 0 | 0 0B | 0.00 | 56B | 0 0B | 0 0B | 2 1.2KB | 0B | 0 22.6 + 1 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 2 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 3 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 4 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 5 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 6 | 1 639B | - | 1.2KB | 0 0B | 0 0B | 1 639B | 1.2KB | 1 0.5 + total | 1 639B | - | 84B | 0 0B | 0 0B | 3 1.9KB | 1.2KB | 1 23.7 +--------------------------------------------------------------------------------------------------------------------------------- +WAL: 1 (28B) in: 34B written: 84B (147% overhead) +Flushes: 2 +Compactions: 1 estimated debt: 0B in progress: 0 (0B) + default: 1 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 multi-level: 0 +MemTables: 1 (256KB) zombie: 2 (512KB) +Zombie tables: 2 (1.2KB) +Block cache: 8 (1.1KB) hit rate: 42.9% +Table cache: 2 (1.3KB) hit rate: 66.7% +Snapshots: 0 earliest seq num: 0 +Table iters: 2 +Filter utility: 0.0% +Ingestions: 0 as flushable: 0 (0B in 0 tables) disk-usage ---- @@ -100,28 +128,29 @@ iter-close a metrics ---- -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp - WAL 1 28 B - 34 B - - - - 84 B - - - 2.5 - 0 0 0 B 0.00 56 B 0 B 0 0 B 0 1.2 K 2 0 B 0 22.6 - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 6 1 639 B - 1.2 K 0 B 0 0 B 0 639 B 1 1.2 K 1 0.5 - total 1 639 B - 84 B 0 B 0 0 B 0 1.9 K 3 1.2 K 1 23.7 - flush 2 0 B 0 0 (ingest = tables-ingested, move = ingested-as-flushable) -compact 1 0 B 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 1 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 1 256 K -zmemtbl 1 256 K - ztbl 2 1.2 K - bcache 8 1.1 K 42.9% (score == hit-rate) - tcache 2 1.3 K 66.7% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 2 - filter - - 0.0% (score == utility) - ingest 0 + level | tables | score | in | ingest | move | write | read | r-amp w-amp +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+---------------- + 0 | 0 0B | 0.00 | 56B | 0 0B | 0 0B | 2 1.2KB | 0B | 0 22.6 + 1 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 2 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 3 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 4 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 5 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 6 | 1 639B | - | 1.2KB | 0 0B | 0 0B | 1 639B | 1.2KB | 1 0.5 + total | 1 639B | - | 84B | 0 0B | 0 0B | 3 1.9KB | 1.2KB | 1 23.7 +--------------------------------------------------------------------------------------------------------------------------------- +WAL: 1 (28B) in: 34B written: 84B (147% overhead) +Flushes: 2 +Compactions: 1 estimated debt: 0B in progress: 0 (0B) + default: 1 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 multi-level: 0 +MemTables: 1 (256KB) zombie: 1 (256KB) +Zombie tables: 2 (1.2KB) +Block cache: 8 (1.1KB) hit rate: 42.9% +Table cache: 2 (1.3KB) hit rate: 66.7% +Snapshots: 0 earliest seq num: 0 +Table iters: 2 +Filter utility: 0.0% +Ingestions: 0 as flushable: 0 (0B in 0 tables) # Closing iter c will release one of the zombie sstables. The other # zombie sstable is still referenced by iter b. @@ -131,28 +160,29 @@ iter-close c metrics ---- -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp - WAL 1 28 B - 34 B - - - - 84 B - - - 2.5 - 0 0 0 B 0.00 56 B 0 B 0 0 B 0 1.2 K 2 0 B 0 22.6 - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 6 1 639 B - 1.2 K 0 B 0 0 B 0 639 B 1 1.2 K 1 0.5 - total 1 639 B - 84 B 0 B 0 0 B 0 1.9 K 3 1.2 K 1 23.7 - flush 2 0 B 0 0 (ingest = tables-ingested, move = ingested-as-flushable) -compact 1 0 B 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 1 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 1 256 K -zmemtbl 1 256 K - ztbl 1 633 B - bcache 4 560 B 42.9% (score == hit-rate) - tcache 1 680 B 66.7% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 1 - filter - - 0.0% (score == utility) - ingest 0 + level | tables | score | in | ingest | move | write | read | r-amp w-amp +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+---------------- + 0 | 0 0B | 0.00 | 56B | 0 0B | 0 0B | 2 1.2KB | 0B | 0 22.6 + 1 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 2 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 3 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 4 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 5 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 6 | 1 639B | - | 1.2KB | 0 0B | 0 0B | 1 639B | 1.2KB | 1 0.5 + total | 1 639B | - | 84B | 0 0B | 0 0B | 3 1.9KB | 1.2KB | 1 23.7 +--------------------------------------------------------------------------------------------------------------------------------- +WAL: 1 (28B) in: 34B written: 84B (147% overhead) +Flushes: 2 +Compactions: 1 estimated debt: 0B in progress: 0 (0B) + default: 1 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 multi-level: 0 +MemTables: 1 (256KB) zombie: 1 (256KB) +Zombie tables: 1 (633B) +Block cache: 4 (560B) hit rate: 42.9% +Table cache: 1 (680B) hit rate: 66.7% +Snapshots: 0 earliest seq num: 0 +Table iters: 1 +Filter utility: 0.0% +Ingestions: 0 as flushable: 0 (0B in 0 tables) disk-usage ---- @@ -165,28 +195,29 @@ iter-close b metrics ---- -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp - WAL 1 28 B - 34 B - - - - 84 B - - - 2.5 - 0 0 0 B 0.00 56 B 0 B 0 0 B 0 1.2 K 2 0 B 0 22.6 - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 6 1 639 B - 1.2 K 0 B 0 0 B 0 639 B 1 1.2 K 1 0.5 - total 1 639 B - 84 B 0 B 0 0 B 0 1.9 K 3 1.2 K 1 23.7 - flush 2 0 B 0 0 (ingest = tables-ingested, move = ingested-as-flushable) -compact 1 0 B 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 1 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 1 256 K -zmemtbl 0 0 B - ztbl 0 0 B - bcache 0 0 B 42.9% (score == hit-rate) - tcache 0 0 B 66.7% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 0 - filter - - 0.0% (score == utility) - ingest 0 + level | tables | score | in | ingest | move | write | read | r-amp w-amp +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+---------------- + 0 | 0 0B | 0.00 | 56B | 0 0B | 0 0B | 2 1.2KB | 0B | 0 22.6 + 1 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 2 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 3 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 4 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 5 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 6 | 1 639B | - | 1.2KB | 0 0B | 0 0B | 1 639B | 1.2KB | 1 0.5 + total | 1 639B | - | 84B | 0 0B | 0 0B | 3 1.9KB | 1.2KB | 1 23.7 +--------------------------------------------------------------------------------------------------------------------------------- +WAL: 1 (28B) in: 34B written: 84B (147% overhead) +Flushes: 2 +Compactions: 1 estimated debt: 0B in progress: 0 (0B) + default: 1 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 multi-level: 0 +MemTables: 1 (256KB) zombie: 0 (0B) +Zombie tables: 0 (0B) +Block cache: 0 (0B) hit rate: 42.9% +Table cache: 0 (0B) hit rate: 66.7% +Snapshots: 0 earliest seq num: 0 +Table iters: 0 +Filter utility: 0.0% +Ingestions: 0 as flushable: 0 (0B in 0 tables) disk-usage ---- @@ -225,28 +256,29 @@ flush metrics ---- -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp__val-bl - WAL 1 93 B - 116 B - - - - 242 B - - - 2.1 - 0 3 2.1 K 0.25 149 B 0 B 0 0 B 0 3.4 K 5 0 B 1 23.2 38 B - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 6 1 639 B - 1.2 K 0 B 0 0 B 0 639 B 1 1.2 K 1 0.5 0 B - total 4 2.8 K - 242 B 0 B 0 0 B 0 4.2 K 6 1.2 K 2 18.0 38 B - flush 3 0 B 0 0 (ingest = tables-ingested, move = ingested-as-flushable) -compact 1 2.8 K 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 1 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 1 256 K -zmemtbl 0 0 B - ztbl 0 0 B - bcache 0 0 B 42.9% (score == hit-rate) - tcache 0 0 B 66.7% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 0 - filter - - 0.0% (score == utility) - ingest 0 + level | tables | score | in | ingest | move | write | read | r-amp w-amp| val-bl +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+----------------+-------- + 0 | 3 2.1KB | 0.25 | 149B | 0 0B | 0 0B | 5 3.4KB | 0B | 1 23.2| 38B + 1 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 2 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 3 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 4 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 5 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 6 | 1 639B | - | 1.2KB | 0 0B | 0 0B | 1 639B | 1.2KB | 1 0.5| 0B + total | 4 2.8KB | - | 242B | 0 0B | 0 0B | 6 4.2KB | 1.2KB | 2 18.0| 38B +------------------------------------------------------------------------------------------------------------------------------------------ +WAL: 1 (93B) in: 116B written: 242B (109% overhead) +Flushes: 3 +Compactions: 1 estimated debt: 2.8KB in progress: 0 (0B) + default: 1 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 multi-level: 0 +MemTables: 1 (256KB) zombie: 0 (0B) +Zombie tables: 0 (0B) +Block cache: 0 (0B) hit rate: 42.9% +Table cache: 0 (0B) hit rate: 66.7% +Snapshots: 0 earliest seq num: 0 +Table iters: 0 +Filter utility: 0.0% +Ingestions: 0 as flushable: 0 (0B in 0 tables) additional-metrics ---- @@ -269,28 +301,29 @@ compact a-z metrics ---- -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp__val-bl - WAL 1 93 B - 116 B - - - - 242 B - - - 2.1 - 0 0 0 B 0.00 149 B 0 B 0 0 B 0 3.4 K 5 0 B 0 23.2 0 B - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 6 3 2.1 K - 3.4 K 0 B 0 0 B 0 2.1 K 3 3.4 K 1 0.6 41 B - total 3 2.1 K - 242 B 0 B 0 0 B 0 5.8 K 8 3.4 K 1 24.4 41 B - flush 3 0 B 0 0 (ingest = tables-ingested, move = ingested-as-flushable) -compact 2 0 B 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 2 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 1 256 K -zmemtbl 0 0 B - ztbl 0 0 B - bcache 0 0 B 27.3% (score == hit-rate) - tcache 0 0 B 58.3% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 0 - filter - - 0.0% (score == utility) - ingest 0 + level | tables | score | in | ingest | move | write | read | r-amp w-amp| val-bl +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+----------------+-------- + 0 | 0 0B | 0.00 | 149B | 0 0B | 0 0B | 5 3.4KB | 0B | 0 23.2| 0B + 1 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 2 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 3 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 4 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 5 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 6 | 3 2.1KB | - | 3.4KB | 0 0B | 0 0B | 3 2.1KB | 3.4KB | 1 0.6| 41B + total | 3 2.1KB | - | 242B | 0 0B | 0 0B | 8 5.8KB | 3.4KB | 1 24.4| 41B +------------------------------------------------------------------------------------------------------------------------------------------ +WAL: 1 (93B) in: 116B written: 242B (109% overhead) +Flushes: 3 +Compactions: 2 estimated debt: 0B in progress: 0 (0B) + default: 2 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 multi-level: 0 +MemTables: 1 (256KB) zombie: 0 (0B) +Zombie tables: 0 (0B) +Block cache: 0 (0B) hit rate: 27.3% +Table cache: 0 (0B) hit rate: 58.3% +Snapshots: 0 earliest seq num: 0 +Table iters: 0 +Filter utility: 0.0% +Ingestions: 0 as flushable: 0 (0B in 0 tables) additional-metrics ---- @@ -359,25 +392,26 @@ flush # table). metrics ---- -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp__val-bl - WAL 1 26 B - 176 B - - - - 175 B - - - 1.0 - 0 4 2.7 K 0.50 149 B 2.0 K 3 0 B 0 4.0 K 6 0 B 2 27.6 0 B - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 0 B - 6 3 2.1 K - 3.4 K 0 B 0 0 B 0 2.1 K 3 3.4 K 1 0.6 41 B - total 7 4.8 K - 2.2 K 2.0 K 3 0 B 0 8.4 K 9 3.4 K 3 3.8 41 B - flush 8 2.0 K 3 2 (ingest = tables-ingested, move = ingested-as-flushable) -compact 2 4.8 K 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 2 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 1 1.0 M -zmemtbl 0 0 B - ztbl 0 0 B - bcache 16 2.4 K 34.4% (score == hit-rate) - tcache 3 2.0 K 57.9% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 0 - filter - - 0.0% (score == utility) - ingest 0 + level | tables | score | in | ingest | move | write | read | r-amp w-amp| val-bl +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+----------------+-------- + 0 | 4 2.7KB | 0.50 | 149B | 3 2.0KB | 0 0B | 6 4.0KB | 0B | 2 27.6| 0B + 1 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 2 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 3 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 4 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 5 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0| 0B + 6 | 3 2.1KB | - | 3.4KB | 0 0B | 0 0B | 3 2.1KB | 3.4KB | 1 0.6| 41B + total | 7 4.8KB | - | 2.2KB | 3 2.0KB | 0 0B | 9 8.4KB | 3.4KB | 3 3.8| 41B +------------------------------------------------------------------------------------------------------------------------------------------ +WAL: 1 (26B) in: 176B written: 175B (-1% overhead) +Flushes: 8 +Compactions: 2 estimated debt: 4.8KB in progress: 0 (0B) + default: 2 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 multi-level: 0 +MemTables: 1 (1.0MB) zombie: 0 (0B) +Zombie tables: 0 (0B) +Block cache: 16 (2.4KB) hit rate: 34.4% +Table cache: 3 (2.0KB) hit rate: 57.9% +Snapshots: 0 earliest seq num: 0 +Table iters: 0 +Filter utility: 0.0% +Ingestions: 0 as flushable: 2 (2.0KB in 3 tables) diff --git a/tool/testdata/db_lsm b/tool/testdata/db_lsm index cca58ab774..7bdb827a19 100644 --- a/tool/testdata/db_lsm +++ b/tool/testdata/db_lsm @@ -10,25 +10,26 @@ pebble: database "non-existent" does not exist db lsm ../testdata/db-stage-4 ---- -__level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp - WAL 1 0 B - 0 B - - - - 0 B - - - 0.0 - 0 1 986 B 0.50 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - 6 0 0 B - 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - total 1 986 B - 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 - flush 0 0 B 0 0 (ingest = tables-ingested, move = ingested-as-flushable) -compact 0 0 B 0 B 0 (size == estimated-debt, score = in-progress-bytes, in = num-in-progress) - ctype 0 0 0 0 0 0 0 (default, delete, elision, move, read, rewrite, multi-level) - memtbl 1 256 K -zmemtbl 0 0 B - ztbl 0 0 B - bcache 0 0 B 0.0% (score == hit-rate) - tcache 0 0 B 0.0% (score == hit-rate) - snaps 0 - 0 (score == earliest seq num) - titers 0 - filter - - 0.0% (score == utility) - ingest 0 + level | tables | score | in | ingest | move | write | read | r-amp w-amp +--------+-------------------+---------+---------+-----------------+-----------------+-----------------+---------+---------------- + 0 | 1 986B | 0.50 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 1 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 2 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 3 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 4 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 5 | 0 0B | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + 6 | 0 0B | - | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 + total | 1 986B | - | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0 +--------------------------------------------------------------------------------------------------------------------------------- +WAL: 1 (0B) in: 0B written: 0B (0% overhead) +Flushes: 0 +Compactions: 0 estimated debt: 0B in progress: 0 (0B) + default: 0 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 multi-level: 0 +MemTables: 1 (256KB) zombie: 0 (0B) +Zombie tables: 0 (0B) +Block cache: 0 (0B) hit rate: 0.0% +Table cache: 0 (0B) hit rate: 0.0% +Snapshots: 0 earliest seq num: 0 +Table iters: 0 +Filter utility: 0.0% +Ingestions: 0 as flushable: 0 (0B in 0 tables)