CS PAPERS DEEP-READ · PAPER 20
Mike Burrows · Google · OSDI 2006
Inside Google there's an unassuming little service called Chubby. Almost every big system — GFS, Bigtable, MapReduce from the previous batch — leans on it to do one job: pick "who's in charge" out of a crowd of machines, and get every machine to agree on the same boss. Its real trick is taking a famously hard distributed-systems problem and packaging it into a tool anyone can use, so application programmers never have to wrestle with the brain-bending theory themselves.
Say you have a pile of machines cooperating, and you need one of them to be the "leader" (it makes decisions, keeps the books). The requirement: every machine must agree on the same leader, and at no instant may two machines both think they're in charge. Sounds easy? But these machines crash without warning, cables get cut, messages arrive late. In that world, "getting everyone to agree on one thing" is hard enough to be its own field of study. Worse, nearly every team has to face the same pit from scratch.
Chubby's move is neat: it offers something like a shared network drive where you can make tiny files and jot a few lines; and every file can carry a lock that only one person can grab at a time. So leader election becomes something a grade-schooler gets — whoever grabs the lock is the leader, and after grabbing it they write their name into the file; every other machine reads the file and knows who the leader is. Elect a leader, stash a critical note, let everyone find each other — all in this one place.
The key is that Chubby isn't one machine — it's a team of 5 machines with one iron rule: any decision needs a majority to agree — at least 3 of the 5 say yes before it counts. Why does that rule stop "two bosses"? Because one decision needs 3 votes, so two contradictory decisions would need 6 votes total — and there are only 5 machines, not enough to go around. The math itself rules out two simultaneous leaders. Even if one or two machines die, the rest can still form a majority and keep going. This "majority vote" rule is exactly the classic Paxos consensus algorithm. Chubby's contribution isn't inventing it — it's burying it inside a service, done once, so everyone gets it for free.
Because it hides the hard part. To add "highly available leader election" to your system, you'd normally have to read a stack of papers, spend months, and still likely get it wrong. With Chubby you only need the moves you already know from any operating system — make a file, grab a lock, read a file — with tiny changes to your code. It got so popular it ended up being used as the whole company's "phone book" (a name service): people wrote "which machine is service X on" into Chubby and looked each other up — a use even the author didn't anticipate.
Chubby takes the hard problem "how do crash-prone machines agree on one leader" and packages it as a "files + locks" service like a shared drive: whoever grabs the lock is the leader. Inside, 5 machines and a "majority-only" rule guarantee the lock is never grabbed by two people at once. It turns leader election from a craft into a function call — and became the foundation under nearly all of Google's big systems.
Want Chubby's architecture, its lease-and-cache machinery, and the full "why a lock service, not a library" argument? → switch to the deep read
Chubby is Google's distributed lock and coordination service: it wraps the hard-to-get-right Paxos consensus inside the service, and exposes only a familiar "file system + coarse-grained advisory locks + event notification" interface. Applications do reliable leader election, store small pieces of critical metadata, and advertise to one another — just by reading/writing tiny files and grabbing a lock. It prioritizes availability and reliability over raw performance, is the shared foundation for leader election and coordination in GFS, Bigtable, and MapReduce, and is the direct ancestor of ZooKeeper and etcd.
The author is Mike Burrows (Google; earlier he worked on AltaVista at DEC, and later designed the engine behind BigQuery). The paper appeared at OSDI 2006. It inherits Lamport's Paxos (which settled "how to reach consensus" in theory) and meets engineering reality: GFS (2003) and Bigtable (2006) both need a reliable place to elect masters and store metadata. Chubby is that place. It also directly inspired Yahoo's open-source ZooKeeper (2010) and the later Raft-based etcd — the coordination layer under today's Kubernetes is the same kind of thing.
Every large distributed system runs into one thing: out of a pile of crash-prone machines, elect a single "master" and get everyone to agree on it. That's the consensus problem, and Lamport's Paxos answered it in theory. But Paxos has a real-world pain: it's famously hard to understand and even harder to implement correctly — a bug-free implementation is full of corner cases, and most teams neither have the bandwidth nor get it right.
So every new system that needs high availability re-builds the same brain-bending thing. Burrows's insight: rather than hand everyone a "Paxos library" to chew on, make consensus a centralized service — get it right once, reuse everywhere. He argues explicitly in the paper for "why a lock service, not a consensus library," and the reasons are pragmatic:
In one line: do the hardest part once, inside the service, so the problem "disappears" for its users. That's Chubby's thesis, and its most-cited idea.
A Chubby cell is typically 5 replicas, spread across racks/rooms for fault tolerance. They use Paxos internally to elect a master and give it a master lease: while the lease holds, the other replicas promise not to elect a new master — which rules out split-brain at the root. All clients talk only to the master; the master replicates each write, via Paxos, to a majority of the replicas' local databases, and a write commits only once a majority has it on disk. If the master dies, the remaining replicas run Paxos to elect a new one, and clients reconnect to it within a grace period (about 45 seconds by default) without dropping their session.
The point: Paxos runs only among those 5 servers; clients never touch consensus. The hard part stays in the box.
To clients Chubby looks like a minimal distributed file system. Names read like /ls/cell/foo/wombat (ls = lock service). Each node on the tree is both a "file" and a "directory," and can: hold a small blob (read/written whole, no partial I/O, since it's meant for small files), carry a lock, and be watched for events. Nodes come in two kinds: permanent and ephemeral — an ephemeral node vanishes automatically when no client has it open, a natural way to signal "this process is still alive."
Locks are advisory and coarse-grained. "Advisory" means a lock only binds processes that actively check it — unlike an OS, it can't hard-block a process that ignores the lock and writes anyway (in a distributed setting you simply can't stop it). "Coarse-grained" means a lock is held for hours or even days (e.g., "held for as long as I'm the master"), not grabbed and released thousands of times a second. This trade-off is crucial: precisely because lock traffic is sparse and cacheable, 5 servers can serve tens of thousands of clients.
A client keeps a session with the master, kept alive by periodic KeepAlive handshakes. Each KeepAlive says "I'm still here, please extend the session lease a bit more." This handshake is a multi-purpose channel: the master can piggyback event notifications and cache-invalidation messages on the KeepAlive reply, saving extra round-trips. If the master hears no KeepAlive from a client for long enough, the session expires and its locks and ephemeral nodes are released; conversely, if a client can't reach the master, it enters a grace period and tries to reconnect (perhaps to a freshly elected new master). Survive it and the session continues seamlessly; fail and it errors out. Judging liveness by "lease expiry" instead of "a definite death notification" is the heart of distributed fault tolerance.
If every file read required an RPC to the master, 5 servers would be crushed by tens of thousands of clients. So Chubby lets clients cache file data and metadata locally. The hard part is keeping caches from going stale. Chubby's answer is strict consistency via active invalidation: the master tracks "what each client has cached"; when a file is about to change, the master first blocks the modification, broadcasts an invalidation to every client caching it, and only after they acknowledge does it actually commit.
So a client either reads from cache (guaranteed current) or, on invalidation, re-fetches — it never reads stale data. The cost is that each write waits for invalidation acks and is a bit slower — but the whole bet of the design is that reads vastly outnumber writes and locks are sparse, so caching keeps the great majority of read traffic on the client, leaving the master only a trickle of writes and KeepAlives. This is what lets it serve a huge client population from very few servers.
Advisory locks have a hazard: process A holds a lock and goes to write storage, then stalls (GC, network delay); the lock times out and is released, B acquires it — and now A's earlier, long-delayed write finally reaches storage, still thinking it holds the lock, and may clobber B's data. Chubby offers two remedies:
This paper is a deployment report; its force comes from "this really ran at Google scale," not one benchmark. The operational picture the author gives tells you whether the trade-offs worked: a typical Chubby cell uses just 5 replicas yet directly serves tens of thousands of clients; the vast majority of RPC traffic is KeepAlives, with real reads and writes a small fraction — direct evidence that client caching plus coarse-grained locks soak up the read load. Stored data is mostly small files (metadata, election registrations), at a modest total size. Chubby is widely used by GFS, Bigtable, MapReduce, and others for leader election and metadata storage — an "everybody uses it" component of Google's infrastructure.
One unexpected result: Chubby got heavily used as a name service (replacing DNS) — developers wrote "where is service X" into Chubby and looked each other up. Its cache-invalidation model fits this better than DNS's "fixed time-to-live expiry," and it noticeably eased load on internal DNS. The author candidly notes this was a use they hadn't anticipated.
Chubby established a pattern that endures: fold distributed consensus into one centralized coordination service, done once, exposed through the universally familiar "files + locks + events" interface, so thousands of applications never re-build Paxos. It's the invisible foundation that lets Google's earlier trio (GFS/Bigtable) run — without a reliable way to elect masters and store metadata, those systems' masters wouldn't exist.
More far-reaching is its open-source echo: Yahoo's ZooKeeper (2010) is essentially a public implementation of Chubby's ideas (a slightly different, wait-free znode + watch API), and later etcd (built on the more understandable Raft consensus) became the coordination core of Kubernetes. The "service discovery, config center, distributed lock, leader election" you see everywhere in the cloud-native world trace their lineage to this paper.
① In one line: Chubby wraps the error-prone Paxos consensus inside a service and exposes a familiar "file system + coarse-grained advisory locks + events" interface, so apps do leader election and metadata coordination easily.
② Motivation: consensus (Paxos) is solved in theory but brutal to implement; rather than ship a library, make it a central service — right once, reused everywhere — and locks are more intuitive and give a place to store "who the master is."
③ Architecture: a cell of 5 replicas runs Paxos to elect a master and replicate (majority commits); the master lease rules out split-brain; clients only talk to the master and never touch consensus.
④ Interface: a file tree with ephemeral/permanent nodes, whole-file reads/writes of small blobs; locks are advisory and coarse-grained (held for hours) — sparse enough to serve many from few.
⑤ Sessions renew leases via KeepAlives, whose replies piggyback events and cache invalidations; "lease timeout" replaces "definite death notice," and clients reconnect to a new master within the grace period (~45s).
⑥ Client caching + active invalidation: the master blocks a write, broadcasts invalidations, then commits — strict consistency; the read-heavy bet lets caching absorb most traffic.
⑦ Sequencers / lock-delay cure "a stale holder's late write clobbers new data," via a generation-numbered token check or a reacquisition delay window.
⑧ Impact and limits: the foundation for GFS/Bigtable leader election, and used as a name service too; direct ancestor of ZooKeeper and etcd (the Kubernetes core). But no high-throughput/fine-grained locking, advisory locks don't stop trespassers, failover has brief unavailability, and it's easy to abuse (needs rate limiting).