Cloudflare Chooses QuePaxa Consensus Algorithm for Meerkat Service
Cloudflare recently announced Meerkat, an experimental distributed consensus service designed to manage its internal global control plane. It is powered by a new consensus algorithm published by researchers Tennage & Băsescu et al. called QuePaxa (2023). QuePaxa is an unusual choice because most consensus systems use well-established algorithms like Raft, Multi-Paxos, or Viewstamped Replication. These algorithms are well understood, have mature implementations, and usually work well, but they often suffer in wide-area networks with volatile connectivity and latency.
Common consensus algorithms rely on a single leader process being available and having predictable latency. If the leader goes down, experiences higher latency than usual, or is disconnected, the entire consensus system slows down or becomes unavailable until the leader is replaced. This is unacceptable for Meerkat, which runs over the Internet. Meerkat’s global deployment environment led Cloudflare to QuePaxa, which promises better stability despite volatility by not relying on a leader to make progress.
Meerkat is a distributed system in which replicas agree upon an ordered log of events, where each event is decided by a consensus algorithm. Consensus algorithms allow a group of machines to agree on a single shared truth even if some machines crash or disconnect, providing the guarantee that machines never decide conflicting values. This ensures Meerkat replicas’ logs never diverge. Meerkat uses its consensus-powered log to expose applications like a key-value store, where each entry is a get or a put. Comparable systems include Consul, etcd, and Apache ZooKeeper.
Unlike similar systems, Meerkat was designed for global scale. A Meerkat cluster may be distributed across continents and connected by links that often exhibit high and variable latency. This is unusual for consensus systems, which are usually deployed in smaller, more local networks with strict latency requirements. Cloudflare has seen degradation firsthand: in 2020, the partial failure of a core Cloudflare network switch caused a consensus-powered system to degrade and the dashboard to operate 80x slower than usual for six hours. The system lost no data but became unavailable for writes until the issue was resolved.
Leader-based consensus algorithms suffer from destructive interference and fault detection problems. In Paxos, multiple proposers can repeatedly block each other from progressing. Most deployed algorithms add a special leader proposer to avoid competition, but when the leader fails, becomes too slow, or is disconnected, the system stalls. Leader recovery can reintroduce destructive interference as multiple candidates compete for a majority vote, causing metastable failures. Fault detection is also error-prone in asynchronous networks because a late message is indistinguishable from a failed server.
QuePaxa solves these problems through three key design choices: having an optional leader, completely removing reliance on fault detection, and designing for constructive interference between proposers. In QuePaxa, proposers submit proposals to recorders, who propagate them to other active proposers. Proposers cooperatively work toward the highest priority proposal, assigned as a random number, with the optional leader receiving exclusive maximum priority. The leader can decide in a single round trip but is not required for progress. Clients hedge their bets by sending requests to every replica, and the hedge timeout is locally determined rather than constrained by network latency, allowing fast recovery from leader failures without fault detection.
Source credits
By João Pedro Leite from Cloudflare Blog. Edited by SetuGeo.