Skip to main content

Module group_commit

Module group_commit 

Source
Expand description

Event-Driven Group Commit Buffer

This module implements a proper group commit mechanism with:

  • Event-driven wait using condition variables (not polling)
  • Single fsync per batch with durability guarantee
  • Adaptive batch sizing based on Little’s Law

§Algorithm

Group Commit Queueing Model:

Little’s Law: N = λ × W Where: N = avg number of requests in system λ = arrival rate (req/sec) W = avg time in system (sec)

Optimal Batch Size: N* = sqrt(2 × L_fsync × λ / C_wait) Where: L_fsync = fsync latency C_wait = normalized waiting cost

Example: L = 5ms, λ = 1000 req/s, C_wait = 1.0 N* = sqrt(2 × 0.005 × 1000 / 1.0) ≈ 3.16 → 3 commits/batch

§Throughput Analysis

Without group commit: Throughput = 1 / L = 200 commits/sec (for L = 5ms)

With group commit (batch size N): Throughput = N / L = N × 200 commits/sec

For N = 100: Throughput = 20,000 commits/sec Speedup = 100x

Structs§

EventDrivenGroupCommit
Event-driven group commit buffer with proper synchronization
GroupCommitConfig
Group commit configuration
GroupCommitMetrics
Metrics for group commit monitoring
GroupCommitStatsV2
Statistics for event-driven group commit
PendingCommitV2
Pending commit with notification channel

Enums§

CommitResult
Result of a commit operation