Skip to content

core/mvcc: experimental_group_commit_delay_us#5686

Open
pereman2 wants to merge 1 commit intotursodatabase:mainfrom
pereman2:mvcc-group
Open

core/mvcc: experimental_group_commit_delay_us#5686
pereman2 wants to merge 1 commit intotursodatabase:mainfrom
pereman2:mvcc-group

Conversation

@pereman2
Copy link
Collaborator

@pereman2 pereman2 commented Mar 2, 2026

  • Implement group commit for MVCC: multiple concurrent transactions batch their fsync calls into a single fsync, trading commit latency for throughput
  • Add PRAGMA experimental_group_commit_delay_us to configure the batch window (0 = disabled, default)
  • Add --group-commit-delay flag to the write-throughput benchmark

Currently each MVCC commit holds the pager_commit_lock for the entire duration of: log write → fsync → offset advance. The fsync dominates (~milliseconds on SSD), serializing all concurrent commits.

Group commit splits this: transactions write their log record and advance the offset under the lock (microseconds), then release the lock and join a SyncGroup to wait for a batched fsync. The first transaction to observe the batch window expired becomes the leader via CAS on leader_claimed, seals the group, and issues a single fsync covering all pending writes. Followers poll sync_done and proceed once set.

New state machine flow (group commit enabled):

BeginCommitLogicalLog  →  WaitForGroupSync [NEW]  →  EndCommitLogicalLog  →  CommitEnd
   (write + advance         (join group, leader       (schema updates,        (mark Committed,
    offset, release lock)    election, batched fsync)   header copy)            notify deps)

Implement group commit for MVCC: multiple concurrent transactions batch
their fsync calls into a single fsync, trading commit latency for
throughput
- Add `PRAGMA experimental_group_commit_delay_us` to configure the batch
  window (0 = disabled, default)
- Add `--group-commit-delay` flag to the write-throughput benchmark
Copy link

@turso-bot turso-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review @sivukhin

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 2, 2026

Merging this PR will degrade performance by 15.72%

❌ 2 regressed benchmarks
✅ 277 untouched benchmarks
⏩ 105 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation concat_blobs 1.4 µs 1.7 µs -15.72%
Simulation ltrim_with_pattern 1.2 µs 1.4 µs -15.04%

Comparing pereman2:mvcc-group (9cc2018) with main (e6d0612)

Open in CodSpeed

Footnotes

  1. 105 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant