CS PAPERS · DEEP READ · PAPER 21

Percolator — Large-scale Incremental Processing

Peng & Dabek · Google · OSDI 2010

中文 →

What did this paper do?

In 2010, two Google engineers (Peng and Dabek) built a system called Percolator and used it to rebuild Google's search index. In one sentence: it changed how a freshly-crawled web page reaches search results — from "wait for the whole batch to be recomputed" to "one page in, update it right away." After it shipped, the average age of documents in search results dropped by half — the web got fresher, faster.

The pain of the old world

Before this, Google used its previous workhorse, MapReduce: treat all of the billions of web pages as one giant pot, cook the whole pot at once, and produce a new index. The problem — change a single page and you still have to re-cook the entire pot. A full pass over the web took days, so an article you posted today might not be searchable for several days. The only way to speed it up was to re-cook the whole pot more often, which was far too expensive.

The new idea: don't re-cook the pot, just add the one spoonful

Percolator's idea: when one page changes, update only the small part that depends on it, and leave the billions of unchanged pages alone. That is "incremental processing" — like adding one ladle to a soup instead of pouring it out and reboiling.

This was hard to do before because of two obstacles, and Percolator supplies exactly the two missing pieces:

Piece one: make one change "all-or-nothing"

Updating a page often means changing several records at once (this word points at that document, that document's rank, its backlinks…). If the machine crashes halfway, the index becomes a half-new, half-old mess. Percolator wraps those scattered changes in a "transaction": either they all take effect, or it's as if nothing happened — never a half-baked state.

How does it guarantee all-or-nothing? Picture moving house: you put a sticky note on every box to lock it, and you designate one "master box" as the master switch. Only when the master box's note is flipped does the whole move count as "officially done"; until then, anyone looking sees "not moved yet." So even if the power dies mid-move, others see the master box unflipped and know this move doesn't count. One atomic little action decides the fate of a whole pile of changes.

Piece two: when something changes, auto-notify whatever should change next

The index is a chain: page content changes → recompute its keywords → keywords change → update the inverted list… Percolator adds a set of "triggers": you watch a kind of data, and the moment it's written, the system automatically wakes up a piece of logic you wrote to follow up, which may trigger the next link — like changing one cell in Excel and watching every formula that depends on it recompute in a cascade. A handful of changes "percolate" through the whole index on their own — which is exactly where the name Percolator comes from.

What it bought

Google used it to replace the old MapReduce indexing pipeline (the new system is known as Caffeine). Processing the same number of pages, the average freshness of search results roughly doubled — what you just posted becomes searchable sooner. One honest cost: this "always up to date" isn't free — compared with MapReduce sweeping the whole pot smoothly, Percolator does dozens of scattered reads and writes for every document it updates, so it burns more machines. Google traded resources for freshness because the trade was worth it.

Remember this

Percolator turned Google's search index from "recompute the whole batch, days behind" into "one page in, update it now." It does this with two things: wrapping scattered changes in an "all-or-nothing" transaction (using one "master lock" as the master switch), plus a trigger system where "something changes → whatever depends on it is auto-notified to follow up." Freshness doubled; the price is more machines.

Want to see how it builds transactions on Bigtable with timestamps and a "primary lock," and how observers cascade? → Switch to the deep read