IT PAPER DEEP-READ · PAPER 19

Bigtable: One Sparse Table That Grows to Petabytes

Chang, Dean, Ghemawat et al. · Google · OSDI 2006

中文 →

What did this paper do?

In 2006 Google published Bigtable — the "one giant table" it used internally to store enormous amounts of data. Google Earth's satellite imagery, every web page's historical snapshots, billions of users' personalized data — all of it lived in tables like this, spread across thousands of machines. It's the third of Google's "big three" after GFS (Paper 17) and MapReduce (Paper 18), and the direct ancestor of an entire class of open-source "wide-column" databases like HBase and Cassandra.

First, the painful chore

The databases we know (the tidy tables-plus-SQL kind behind banks and online stores) are fast and pleasant at a few million or tens of millions of rows. But what Google needed to store was another order of magnitude: one row per web page across the whole web means tens of billions of rows; every time a page is re-crawled you keep another dated version; different pages have different fields, messy and mostly empty. Data this large, this sparse, and forever growing simply doesn't fit — and is far too expensive to force — into a traditional database. Google needed a store built specifically for "absurdly large and loosely shaped" data.

The idea: an almost-infinite sparse table

Picture a spreadsheet, but with all three of its limits removed: rows can number in the tens of billions, columns can be added anytime, anywhere, and each cell can hold several timestamped historical versions at once. Crucially it's "sparse" — the vast majority of cells are empty, and empty cells take up no space at all, so you're free to add columns and leave blanks without a care. The table has one more discipline: all rows are kept sorted by name (the row key). So if you just name your rows well (say, write URLs backwards so pages from the same site sit together), related data naturally lands in adjacent positions, and scanning a stretch of it is very fast.

How it spreads that table across thousands of machines

The table is too big for one machine, so it's sliced horizontally into segments by row, each segment (Google calls it a tablet) handed to one machine; because rows are sorted, every slice is a contiguous range. The real cleverness is in how it reads and writes fast without fearing crashes: new data first gets a line in a "running ledger" (kept on the reliable GFS, so it survives a machine burning down), then is dropped into a small "notebook" in memory; when the notebook fills, it's tidied and frozen into a read-only file on disk, and a fresh notebook takes over. To read, you look at the in-memory notebook and the stack of read-only disk files "together" — newer overrides older. This "log first, tidy up in batches, never edit old books" style makes writes fast and lets a crashed machine recover by replaying the ledger. The system also periodically merges a stack of old files into one so reads don't slow down over time.

What it gave us

Bigtable powered Google Analytics, Google Earth, personalized search, the web index, and a raft of other products; by the time of the paper, Google was running hundreds of Bigtable clusters on tens of thousands of machines. The open-source world cloned it into HBase, and fused its data model with Amazon Dynamo's ideas into Cassandra, making "wide-column NoSQL" a major database category. Its engine idea — "write to memory + a log first, then tidy into read-only files" — grew into LevelDB and RocksDB, the foundation of countless databases today. The honest cost: it only guarantees that changes to a single row are all-or-nothing; complex transactions spanning many rows, and SQL-style multi-table joins, it simply won't do — and it's precisely by cutting those that it bought near-infinite horizontal scale.

Remember it in one line

Bigtable is Google's "one sparse table that grows to petabytes": rows sorted by name and numbering in the billions, columns added at will, cells holding timestamped multiple versions, empty cells free. It slices the table by row across thousands of machines and reads/writes with a "log + write memory, freeze full notebooks into read-only files, merge old files periodically" engine. It drops general transactions and SQL for near-infinite scale — the founding work of wide-column NoSQL.

Want to see what the data model looks like, how three-level addressing locates a single row among thousands of machines, and the memtable + SSTable read/write and compaction mechanics? → Switch to the deep read