perf: spill large page indexes into the db meta directory - #1483
Open
corylanou wants to merge 1 commit into
Open
perf: spill large page indexes into the db meta directory#1483corylanou wants to merge 1 commit into
corylanou wants to merge 1 commit into
Conversation
PR Build Metrics✅ All clear — no issues detected
Binary Size
Dependency ChangesAdded:
Removed:
govulncheck OutputBuild Info
History (1 previous)
🤖 Updated on each push. |
Enable the ltx encoder's page-index spill (superfly/ltx#97) for snapshots and compactions, using the database meta directory as the spill location: it is writable in every deployment including the hardened scratch image, which has no /tmp. The compactor's spill dir is set once the meta directory exists in Open. Every ltx.NewCompactor and snapshot encoder now defers Cleanup so a cancelled or failed operation cannot leave a spill file behind (and an abandoned encoder cannot be closed into a checksum-valid file with an empty index). go.mod pins ltx to the head of superfly/ltx#97 for evaluation; replace with the tagged ltx release before merging.
corylanou
force-pushed
the
perf/1477-ltx-spill-dir
branch
from
August 28, 2026 13:47
69d8bed to
73b7d0b
Compare
This was referenced Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1479 (base branch
fix/1477-serialize-db-maintenance); pairs with superfly/ltx#97 (tracked in superfly/ltx#96). Part of #1477.Summary
DB.MetaPath()as the spill directory — it exists in every deployment, including the hardenedFROM scratchimage, which has no/tmp.ltx.NewCompactorsite (compaction, restore, VFS hydration) and the snapshot encoder nowdefer Cleanup(), so a cancelled or failed operation cannot leave a spill file behind, and an abandoned encoder cannot later be closed into a checksum-valid file with an empty index (ltx#97 makesCleanupterminal for that reason).go.modpins ltx to the head of perf: stream the decoder page index and spill the encoder index to disk superfly/ltx#97 for evaluation. Replace with the tagged ltx release before merge (same as fix(store): serialize snapshots and compactions per database #1479's pin).Evidence
litestream-soak
snapshot-compaction-overlaprig (corylanou/litestream-soak#196): the snapshot's replica stream is held at 95% so its page index stays resident while the L1 compaction runs; heap growth = peakHeapInuse− post-GC baseline, GOGC=25, peak heap profile per phase. All rows below include per-database serialization (#1479); the ltx column is what changes.Going from 4 to 8 GiB no longer moves any phase: ~32 MB is the fixed S3 multipart upload buffers, the rest is the ≤24 MiB of in-memory index chunks before the spill engages. Peak profile of the 8 GiB compaction phase is
s3/manager.(*maxSlicePool).newSlice32 MB +ltx.(*pageIndex).append22.8 MB;DecodePageIndex(84 MB at 4 GiB before) is gone. For comparison, litestream main with ltx v0.5.2 measured 470.6 MB for the 4 GiB overlap.At the reporter's 34.2M pages this leaves maintenance memory at roughly the S3 buffer allowance plus a few tens of MB, versus ≈15 GB on main and ≈6.5 GB with #1479 + ltx#95.
Follow-up
Hydrator.ApplyLTX(vfs.go) reads pages and returns withoutdec.Close(), so it never verifies the index/trailer/file checksum. Pre-existing; it should close the decoder with retention off. Separate PR.Test plan
go test ./root suite green against ltx#97;go vet, pre-commit (goimports, vet, staticcheck)