logo
Kurashizu Blogwhere ideas flow
  • Home
  • News
  • Blog
  • About
  • Home
  • News
  • Blog
  • About

© 2026 Kurashizu. All rights reserved.

Admin·New Post·Service Status
Powered by Cloudflare·02.11.26
← Back to news

Cloudflare Meerkat - Globally distributed consensus

Original article
blog.cloudflare.com|141 points|26 comments|by bobnamob|Jul 8, 2026

Cloudflare Meerkat: Achieving Globally Distributed Consensus

Maintaining a consistent state across a planetary-scale network is one of the most daunting challenges in distributed systems. Cloudflare's Meerkat is their answer to this problem, providing a mechanism for globally distributed consensus that balances the rigid requirements of consistency with the harsh realities of wide-area network (WAN) latency.

The Core Dilemma: Latency vs. Consistency

In a local cluster, consensus algorithms like Raft or Paxos work efficiently because round-trip times (RTT) are negligible. However, when nodes are spread across continents, the speed of light becomes a bottleneck. Traditional Raft is often too slow for global deployments because every write requires a majority of nodes to acknowledge the entry, leading to massive latency spikes.

The CAP Theorem Reminder: In the event of a network partition, a system must choose between Consistency (C) and Availability (A). Meerkat aims to optimize the "C" without making the "A" prohibitively slow for the end-user.

The Latency Gap

The difference in communication speed is stark:

  • Intra-datacenter: <1ms< 1\text{ms}<1ms
  • Cross-region (e.g., NY to London): ≈60–100ms\approx 60\text{--}100\text{ms}≈60–100ms
  • Global Round Trip: ≈200ms+\approx 200\text{ms}+≈200ms+

How Meerkat Works

Meerkat doesn't try to ignore the laws of physics; instead, it optimizes how consensus is reached and how data is read.

1. Hierarchical Architecture

Instead of a flat structure where every node is equal, Meerkat utilizes a tiered approach. It separates the sequencing of operations from the execution of those operations.

FeatureTraditional RaftCloudflare Meerkat
TopologyFlat / Peer-to-PeerHierarchical / Tiered
Leader LocationSingle LeaderOptimized Global Sequencer
Read LatencyHigh (if routed to leader)Low (Local reads via leases)
Write LatencyHigh (WAN RTT)Optimized via batching/pipelining

2. The Consensus Mechanism

Meerkat relies on a quorum-based system to ensure that a majority of the "voting" nodes agree on the state. The mathematical requirement for a quorum is defined as:

Quorum Size=⌊N2⌋+1\text{Quorum Size} = \left\lfloor \frac{N}{2} \right\rfloor + 1Quorum Size=⌊2N​⌋+1

Where NNN is the total number of voting members. By strategically placing these voting members in key geographic hubs, Meerkat minimizes the distance the leader must communicate to reach a majority.

3. Optimizing the Pipeline

To prevent the system from stalling, Meerkat employs several techniques:

  • Batching: Grouping multiple requests into a single log entry.
  • Pipelining: Sending new proposals before the previous ones are fully committed.
  • Lease-based Reads: Allowing local nodes to serve reads without contacting the leader, provided they hold a valid read_lease.

Implementation Logic

The internal logic for handling a proposal can be conceptualized in the following pseudo-code:

class MeerkatNode:
    def handle_proposal(self, proposal):
        if self.is_leader():
            # Assign a global sequence number
            seq_id = self.increment_sequence()
            # Broadcast to global quorum
            if self.replicate_to_quorum(proposal, seq_id):
                self.commit(proposal)
                return "SUCCESS"
        else:
            # Forward to the current global leader
            return self.forward_to_leader(proposal)

    def replicate_to_quorum(self, data, seq_id):
        # Logic to ensure (N/2 + 1) nodes acknowledge
        acks = self.send_rpc_parallel(data, seq_id)
        return len(acks) >= QUORUM_THRESHOLD

Operational Workflow

To ensure a write is globally consistent, Meerkat follows these specific steps:

  • Proposal: A client sends a request to the nearest edge node.
  • Sequencing: The request is forwarded to the global leader to receive a unique term_id and index.
  • Replication: The leader broadcasts the entry to the voting quorum.
  • Commitment: Once the quorum acknowledges, the entry is marked as committed.
  • Notification: The edge node is notified, and the result is returned to the client.

Handling Failures and Nuance

Meerkat must be resilient. If a leader fails, a new election is triggered. However, because this is a global system, "flapping" (rapidly changing leaders) can be catastrophic.

  • Failure Detection: Uses aggressive heartbeats but incorporates a "grace period" to avoid unnecessary elections due to transient network jitter.
  • State Recovery: Nodes that have fallen behind use a snapshot mechanism to catch up quickly rather than replaying millions of individual log entries.

Distributed Consensus Visualization Figure 1: Conceptual map of Meerkat's voting nodes distributed across global regions to minimize RTT.

Summary

Cloudflare Meerkat proves that while you cannot beat the speed of light, you can design around it. By combining a hierarchical structure, quorum-based voting, and intelligent read leases, Meerkat provides the strong consistency required for critical infrastructure while maintaining the performance expected of a global edge network.