Batch and throttle tantivy commits to stop churning DB#187
Open
ara4n wants to merge 2 commits into
Open
Conversation
Tune the Tantivy commit cadence for power rather than latency: - COMMIT_TIME 5s -> 60s: during idle/backfill we now flush accumulated events into searchable segments roughly once a minute instead of every few seconds, so the CPU can race to idle between bursts (far fewer fsyncs and segment merges). Search freshness is unaffected because the search path force-commits first. - COMMIT_RATE 500 -> 20000: at network-paced backfill (/messages is the bottleneck) the old count cap fired every few seconds and produced ~15 small segments per minute, each carrying its own AES + HMAC-SHA256 finalization, file opens and eventual merge. Letting ~a minute's worth of events coalesce into one segment cuts that per-segment overhead by ~10x. The value sits within the writer heap, which self-flushes if it fills first, so it can't overrun memory. Durability is unchanged: events and checkpoints still commit to SQLite per batch and are replayed from the uncommitted_events table on restart. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JP4yoxKeGLRDLkCPTu3DFq
ara4n
force-pushed
the
matthew/commit-cadence
branch
from
June 24, 2026 11:50
7500204 to
7cdc846
Compare
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.
Fixes bits of element-hq/element-web#32119