EasyCommit: A Non-blocking Two-phase Commit Protocol

Suyash Gupta, Mohammad SadoghiEDBT 2018

Abstract

Atomic commitment protocols (ACPs) are essential for maintaining data consistency in distributed systems, ensuring that transactions are either committed globally or aborted entirely. The industry-standard Two-Phase Commit (2PC) protocol is efficient but inherently "blocking," meaning simultaneous failures of the coordinator and a participant can leave the system in a state of limbo. While the Three-Phase Commit (3PC) protocol addresses this by being non-blocking, it introduces a third communication phase that significantly degrades performance. This paper presents EasyCommit (EC), a novel protocol that achieves non-blocking guarantees within just two communication phases. By leveraging a "transmit-then-commit" strategy and message redundancy through gossip, EasyCommit provides the availability of 3PC with the performance characteristics of 2PC.

Introduction

In distributed database environments, ensuring the atomicity of transactions across multiple nodes is a primary challenge. The Two-Phase Commit (2PC) protocol has long been the preferred solution due to its minimal communication overhead. However, its primary weakness is its blocking nature. If the coordinator fails after sending a "Prepare" message and a participant fails after voting, the remaining participants cannot safely decide whether to commit or abort, leading to stalled resources and reduced system availability.

The standard Two-Phase Commit (2PC) state machine for the Coordinator and Participant. The 'WAIT' and 'READY' states represent points where the protocol can block if failures occur.

To mitigate this, researchers developed the Three-Phase Commit (3PC) protocol, which introduces an intermediate "Pre-Commit" state. This state ensures that if any node has moved toward a commit, enough other nodes are aware of the intent to prevent an inconsistent abort. However, the additional round-trip required for this third phase creates a scalability bottleneck, increasing latency and reducing throughput in high-performance systems.

The EasyCommit Protocol

EasyCommit (EC) is designed to bridge the gap between the efficiency of 2PC and the resilience of 3PC. The protocol's architecture is built upon two fundamental insights:

1. First Transmit, Then Commit

In a standard 2PC implementation, a coordinator might commit a transaction locally before ensuring that all participants have received the decision. EasyCommit reverses this: the coordinator broadcasts the global decision (Commit or Abort) to all participants before it performs its own local commit. This ensures that the decision is in flight and potentially received by others before the coordinator can fail in a committed state.

2. Message Redundancy via Gossip

The "secret sauce" of EasyCommit is its use of gossip-based message redundancy. When a participant receives the global decision from the coordinator, it does not simply commit locally. Instead, it immediately forwards that decision to all other participants. This "flooding" of the decision across the network ensures that even if the coordinator and several participants fail, the decision survives within the active set of nodes.

Comparison of the communication phases for 2PC, 3PC, and EasyCommit (EC). EC maintains the two-round-trip structure of 2PC but adds inter-cohort communication (gossip) in the second phase to ensure non-blocking behavior.

By integrating the gossip mechanism into the second phase, EC achieves the same safety guarantees as 3PC's third phase without the extra round-trip latency. If a node experiences a timeout, it triggers a Termination Protocol, which includes a leader election to recover the decision from its peers.

Evaluation and Results

The authors implemented EasyCommit within ExpoDB, a distributed, in-memory transactional framework, and conducted extensive testing on Microsoft Azure using up to 64 nodes. The protocol was evaluated using the YCSB (Yahoo! Cloud Serving Benchmark) and TPC-C benchmarks.

Key Insights

  • Performance Parity: In scenarios with low data contention, EC's throughput is nearly identical to 2PC. It significantly outperforms 3PC, which suffers from the overhead of its additional communication round.
  • Resilience and Availability: Unlike 2PC, EC successfully maintained progress during simulated multi-node failures. The protocol's design allows for independent recovery in many scenarios, as log entries are more descriptive and decisions are redundantly stored across the cluster.
  • Scalability: EC scales linearly up to 64 nodes. While the gossip mechanism increases message complexity to $O(n^2)$ compared to 2PC's $O(n)$, the authors found that modern high-speed cloud networks handle this extra traffic with negligible impact on throughput.
  • Contention Handling: Under high data skew (e.g., in TPC-C workloads), EC maintains better throughput than 3PC because it releases locks faster by completing the commitment process in fewer phases.

Conclusion and Future Work

EasyCommit represents a significant advancement in atomic commitment protocols, offering a non-blocking solution that does not sacrifice the performance of 2PC. While the $O(n^2)$ message complexity is a potential drawback for extremely large clusters, it is well-suited for the typical scale of modern distributed databases.

Future research will explore "optimized forwarding" techniques, where nodes forward decisions to only a subset of peers to reduce network traffic. Additionally, while EC is resilient to node failures, further work is needed to enhance its tolerance to total network partitions, potentially integrating it with consensus logic like Paxos or Raft for even greater robustness.

Summary updated

BibTeX
@inproceedings{gupta2018easycommit,
  author = {Suyash Gupta and Mohammad Sadoghi},
  title = {{EasyCommit: A Non-blocking Two-phase Commit Protocol}},
  booktitle = {EDBT},
  year = {2018},
  doi = {10.5441/002/edbt.2018.15},
}
Figure