caching: adaptive append-only lease reset capacity hint#831
caching: adaptive append-only lease reset capacity hint#831snissn wants to merge 6 commits intopr/vlog-mmap-expvar-telemetryfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an adaptive sizing hint for append-only memtable hard resets (lease recycle/trim) based on recently observed mutable sizes at shard rotation, aiming to avoid retaining oversized entry slices after workload spikes while keeping active mutable sizing unchanged.
Changes:
- Track a bounded/decayed
appendOnlyEntryHintfrom observed append-only mutable entry counts during shard rotation. - Apply the hint only when calling
ResetWithCapacityHardfor append-only memtables during recycle/lease trimming. - Export the hint in
DB.Stats()and add focused unit tests for decay/clamping and overflow behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| TreeDB/caching/db.go | Adds adaptive append-only entry hint tracking, applies it to append-only hard resets, and exports hint telemetry via Stats(). |
| TreeDB/caching/append_only_hint_test.go | Adds tests covering hint decay/clamping and overflow-safe capacity computation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e861bf791
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR introduces an adaptive, bounded “append-only entry hint” in caching.DB to better size append-only memtable hard resets (lease/pool recycle paths) based on recently observed mutable shard sizes, reducing post-spike retained entry-slice over-allocation while keeping active mutable sizing unchanged.
Changes:
- Track a decayed/clamped
appendOnlyEntryHint(observed at mutable shard rotation) and use it to compute an effective capacity for append-onlyResetWithCapacityHardpaths. - Export the hint as stats under both
treedb.cache.append_only.*andtreedb.process.append_only.*. - Add focused unit tests covering decay/clamping and overflow safety.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| TreeDB/caching/db.go | Adds append-only hint tracking, applies hinted capacity to append-only hard resets, and exports hint telemetry in Stats(). |
| TreeDB/caching/append_only_hint_test.go | Adds tests for hint decay/clamping behavior and overflow-safe capacity derivation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Adds an adaptive (bounded + decayed) append-only entry slice sizing hint derived from observed append-only mutable sizes at shard rotation, and applies it only when hard-resetting/recycling append-only memtables to avoid retaining oversized entry slices after spikes.
Changes:
- Track an
appendOnlyEntryHintonDB, updated on append-only shard rotation using a grow/decay filter. - Apply the hint when calling
ResetWithCapacityHardfor append-only memtables during recycle/lease trimming. - Export hint telemetry via cache/process stats and add focused tests for decay/clamping and overflow safety.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| TreeDB/caching/db.go | Implements the adaptive hint, applies it to append-only hard resets, and exports stats telemetry. |
| TreeDB/caching/append_only_hint_test.go | Adds tests validating hint decay/clamping behavior and overflow-safe capacity conversion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
…nto pr/append-only-retention-entry-hint
There was a problem hiding this comment.
Pull request overview
This PR introduces an adaptive, bounded, and decaying appendOnlyEntryHint in the caching DB to better size recycled/leased append-only memtables after transient spikes, aiming to reduce retained entry-slice memory while avoiding churn in active mutable sizing.
Changes:
- Track an adaptive
appendOnlyEntryHintbased on observed append-only mutable entry counts at shard rotation. - Apply the hint when performing append-only lease/recycle hard resets (
ResetWithCapacityHard) to cap retained capacity after spikes. - Export hint telemetry via new
treedb.cache.*andtreedb.process.*stats keys, and add focused unit tests for the hint logic.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| TreeDB/caching/db.go | Adds adaptive hint tracking, applies it to append-only hard-reset capacity during recycling/lease trimming, and exports new stats. |
| TreeDB/caching/append_only_hint_test.go | Adds unit tests validating hint decay behavior and overflow-safe capacity conversion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Summary
appendOnlyEntryHintfrom observed append-only mutable sizes at shard rotationResetWithCapacityHard) so retained memtables do not keep oversized entry slices after spikestreedb.cache.append_only.entry_hint_entriestreedb.cache.append_only.entry_hint_capacity_bytesTreeDB/caching/append_only_hint_test.goValidation
go test ./TreeDB/caching -count=1go test ./TreeDB/internal/memtable -count=1go test ./TreeDB/db -run TestDoesNotExist -count=1go vet ./TreeDB/cachingUnified Bench (serial, same args)
Candidate profile dir:
/home/mikers/tmp/perf-append-hint-v2-1773568813Baseline profile dir:
/home/mikers/tmp/perf-append-hint-base-1773568648Throughput deltas (TreeDB):
Alloc-space deltas (TreeDB):
Celestia runs (this branch)
fast:
/home/mikers/.celestia-app-mainnet-treedb-20260315000234/home/mikers/.celestia-app-mainnet-treedb-20260315001415wal_on_fast:
/home/mikers/.celestia-app-mainnet-treedb-20260315000807/home/mikers/.celestia-app-mainnet-treedb-20260315001936Notes:
fastRSS signal is noisier across replicates;wal_on_fastshows lower RSS than recent caching: export vlog mmap telemetry via expvar #830 baseline samples while preserving completion and similar disk footprint