Repository navigation
perf: batch pops for varmq and one write mutex per file - #14
Merged
Merged
Conversation
DequeueBatchWithAckIds claims up to min(len(items), len(ackIDs)) rows in one statement and reports the pending count after it, capped at 256. Every write on a file (enqueue, claim, pop, ack, purge, recovery, schema setup) holds the file's mutex, so writers on one file queue in Go instead of sleeping in SQLite's busy handler. Len and Values do not take it.
This was referenced Oct 23, 2026
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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 #13 (
perf/lean-statements). Third of five for sqliteq v0.3.0.What changes
DequeueBatchWithAckIdsimplements varmq'sIBatchAcknowledgeable. It claims up tomin(len(items), len(ackIDs))rows in one statement and reports the remaining pending count, capped at 256. varmq only checks whether that count is zero (docs: let batch storage cap the remaining count varmq#127).LenandValuesdo not take it.walMBmetric.Effect
The WAL stays bounded under load: about 4.2 MB with
WithCheckpointPages(1000)and about 41 MB with 10000. Before this PR, the soak test reached about 400 MB.In the end-to-end varmq benchmark, single-queue rows gain +46% to +189% over PR 2.
Tests
go test -race ./...passes. New tests cover batch pops, concurrent writers on one file, and a crash after a batch claim.