The Cost of Durability
A write ahead log, or WAL, records each change before the data pages move, so a commit must flush the log to durable storage. That flush, an fsync, is slow because it waits for the storage device to confirm the data is safe.
One Sync Per Commit Is Wasteful
If every transaction flushes on its own, a busy system issues a flood of expensive syncs, and throughput is capped by how many syncs the disk can do per second.
Group Commit
Group commit batches commits together.
- Transactions that are ready to commit append their log records.
- A leader waits a tiny moment to gather other pending commits.
- One single fsync makes all of those log records durable at once.
- Every transaction in the batch is then acknowledged.
The fixed cost of a sync is now shared across many commits, so throughput rises sharply as concurrency grows.
The Tradeoff
An individual transaction may wait a fraction of a millisecond longer to join a batch. This small added latency buys a large gain in commits per second under load.
Key idea
Group commit gathers many transactions behind a single log fsync, sharing the cost of durability so commit throughput climbs with concurrency.