Company
Date Published
Author
Nathan VanBenschoten
Word count
6038
Language
English
Hacker News points
None

Summary

CockroachDB's new "Parallel Commits" protocol, introduced in version 19.2, aims to significantly reduce the latency of distributed transactions by allowing them to be committed in a single round-trip of distributed consensus, thereby improving performance in globally distributed deployments. This approach overcomes the limitations of the traditional two-phase commit protocol, which was prone to increased latency due to the need for sequential consensus rounds. Parallel Commits achieve their goal by changing the transaction commit condition and introducing a "STAGING" state, which allows transactions to be considered committed once all write intents have been successfully replicated, even if they haven't all been confirmed individually. The protocol incorporates ideas from various academic solutions and unifies distributed transactions and consensus under a single framework using Flexible Paxos, ensuring that transactions maintain atomicity and durability. Extensive benchmarks, including TPC-C tests, have demonstrated that Parallel Commits halve the latency of cross-range transactions, making CockroachDB more efficient, especially when tables have multiple secondary indexes or when deployed in geo-replicated clusters.