Bigtable

1. The Problem

Google has lots of data, with many incoming request. There was no commercial system big enough.

2. Building Blocks

They already had a Scheduler, Google File System and Chubby Lock Service.

GFS already handled failing disks, distributed storage, and replication. There is a master server for metadata and chunk servers for the actual data.

Chubby is a strongly consistent replicated store. It has coarse-grained locks, and can store a small amount of data per lock. It has very good replication, but doesn't have good performance / scale well.

BigTable uses itself to store metadata using a special root tablet. That location is stored in Chubby, and the root tablet stores the location of the meta tablet. The meta tablet stores the location of all other tablets.

3. Data Model

Each value is index by a triplet <row, column, timestamp>. Rows are sorted lexicographically, and columns are grouped into column families. Each column family is stored together on disk, allowing for column locality.

Locality can also improve the compression. Bloom filters (probabilistic structure, to test set membership, although they can produce false positives) on locality groups can also be used to avoid searching the SSTable.

Its stored as SSTables, immutable sorted files of KV pairs - subdivided into 64KB blocks with an index. These can overlap row key.

SSTables are organized into tablets - units of distribution & load balancing. These cannot overlap row keys. Multiple tables make up a table.

Writes are first written to a temporary memtable in memory, and then flushed to disk as an SSTable (minor compaction). The memtable is also written to a commit log for durability.

Merging compactions reduce number of SSTables and apply garbage collection. A major compaction merges some SSTables into one, and discards deleted or expired data. This is done in the background.

4. Server Model

Tablet servers each manage multiple tablets. The server splits tablets that get too big. The master server is responsible for load balancing and fault tolerance.

5. RW Model

Insertions are commited to the commit log (in GFS) and applied to memtable. Each memtable row is copy-on-write (i.e. immutable). When the memtable is full, it is flushed to disk as an SSTable.

Reads apply to a merged view of the memtable and all SSTables in a tablet.

6. Bigtable VS Relational Databases

7. Lessons learnt

Back to Home