Abstract
Replicating data across multiple data centers not only allows moving the data closer to the user and, thus, reduces latency for applications, but also increases the availability in the event of a data center failure. Therefore, it is not surprising that companies like Google, Yahoo, and Netflix already replicate user data across geographically different regions. However, replication across data centers is expensive. Inter-data center network delays are in the hundreds of milliseconds and vary significantly. Synchronous wide-area replication is therefore considered to be unfeasible with strong consistency and current solutions either settle for asynchronous replication which implies the risk of losing data in the event of failures, restrict consistency to small partitions, or give up consistency entirely. With MDCC (Multi-Data Center Consistency), we describe the first optimistic commit protocol, that does not require a master or partitioning, and is strongly consistent at a cost similar to eventually consistent protocols. MDCC can commit transactions in a single round-trip across data centers in the normal operational case. We further propose a new programming model which empowers the application developer to handle longer and unpredictable latencies caused by inter-data center communication. Our evaluation using the TPC-W benchmark with MDCC deployed across 5 geographically diverse data centers shows that MDCC is able to achieve throughput and latency similar to eventually consistent quorum protocols and that MDCC is able to sustain a data center outage without a significant impact on response times while guaranteeing strong consistency.
Introduction
In a world of global web services, replicating data across multiple data centers is a necessity for both low latency and disaster recovery. However, developers usually face a "pick two" trade-off between latency, availability, and strong consistency. Traditional protocols like Two-Phase Commit (2PC) provide strong consistency but are "pessimistic" — they lock resources for multiple network round-trips (RTTs), which can take hundreds of milliseconds across oceans.
As shown in the latency measurements, network jitter and high RTTs make traditional synchronous replication unfeasible for many applications. Consequently, many companies settle for "eventual consistency," which is fast but risks data loss or complex conflicts. MDCC aims to break this trade-off by providing strong consistency at the price of eventual consistency.
Methods
MDCC replaces the fragile, multi-step 2PC with a protocol based on Multi-Paxos. Its core innovations include:
- Masterless Optimism: Unlike standard Paxos which often relies on a "leader" node, MDCC uses a variation of Fast Paxos. This allows any data center to propose an update and reach a global consensus in a single RTT, provided there are no concurrent conflicts on the same record.
- Generalized Paxos for Commutativity: The protocol recognizes that some operations (like adding to a stock count) are commutative. MDCC exploits this to avoid unnecessary conflicts and delays.
- SLO-Aware Programming Model: The authors introduce a new way to write database code using callbacks to decouple application logic from network latency:
onAccept: Triggered when the local node accepts the update (very fast).onCommit: Triggered when the global consensus is reached.onFailure: Triggered if the transaction times out or conflicts.finallyRemote: An asynchronous callback for when the transaction eventually finishes.
Evaluation and Results
The authors evaluated MDCC using the TPC-W benchmark and custom micro-benchmarks deployed across five Amazon EC2 regions (US West, US East, EU Ireland, Asia Pacific Singapore, and Asia Pacific Tokyo).
Key results include:
- Latency Reduction: On the TPC-W benchmark, MDCC reduced transaction latencies by 50% (down to ~234ms) compared to traditional 2PC.
- Throughput Gains: MDCC achieved throughput nearly twice as high as 2PC by optimizing for the conflict-free "fast path."
- Competitive with Eventual Consistency: MDCC's performance was within 10% of eventually consistent quorum protocols, drastically minimizing the "cost" of strong consistency.
- Fault Tolerance: During a simulated data center outage, MDCC continued to commit transactions seamlessly, with only a slight increase in average response time as it shifted quorums to remaining healthy nodes.
Conclusion
MDCC demonstrates that strong consistency can be achieved with performance comparable to eventually consistent systems. By optimizing for the "fast path" and decoupling application logic from network latency via a callback-based model, MDCC provides a robust framework for global-scale data replication. Future work includes porting the library to other languages and exploring Parallel Snapshot Isolation (PSI) as a consistency target.
Summary updated