Notes on Big Table

Bigtable: A Distributed Storage System for Structured Data [pdf]

Big Table is basically Google's distributed, scaleable, semi-structured datastore from 2006. It is interesting because it is partition tolerant, consistent, and scaleable and highly performant *for its time *(scales less than linearly), and allows a lot client flexibility to control data locality via schema choice and dynamically control whether their data is served from memory or disk. It is designed for systems that have high read volumes and low batched write volumes, well integrated with Google's GFS + Map Reduce ecosystem, and flexible enough to serve the needs of varying Google products.

Usage

Big Table offers users table. For each table, it maps a row key, a column key, and a timestamp to an arbitrary string and offers row-atomic set and delete
operations on cell values.

(row:string, column:string, time:int64) → string

Example: Row key is com.cnn.www; Column keys are “contents:”, or “anchor:cnnsi.com”. Contents are the text of contents, or the text of anchors that reference the page.

Clients can also group columns that are usually accessed together by creating a column family. Columns within the same family will usually be stored in the same SSTable, which ensures locality.

How is data stored?

Data for each table is stored in tablets. Each tablet is assigned a row range and stores data in the format of SSTables. A tablet will have a separate SSTable for each column family. SSTables provide a persistent, ordered immutable map from keys to values, where both keys and values are arbitrary byte strings. They usually look like this (source):

SSTable Storage Structure

Indexes are usually kept in memory. You can also keep an entire SSTable in memory. Each user table can consist of one or more tablets. Each tablets can consist of one or more (usually more) SSTables. We create SSTables for each column family, so that column family may exploit the idea of locality groups—per SSTable format, columns that belong to the same SSTable are stored together in the SSTable data file.Tablet locations are stored in a 3-level B+ Tree type structure that consists of a Chubby file pointing to a root tablet that points to metadata tablets, that in turn point to actual data tablets forming user tables. METADATA tablets comprise the METADATA table, which stores tablet locations keyed by table identifier + end row. Tablet locations are usually stored and cached by clients.

How is data served?

Tablets are served by tablet servers. One tablet server can serve multiple tablets. Each tablet is served by one tablet server only.

Writes

Writes preserve write ahead logging, where a redo records are written to a per-tablet commit log stored in GFS. After writes hit the commit log, they are written to an in-memory memtable (sorted buffer). When memtables get too big, they are written to GFS as a new SSTable—this operation is called a* minor compaction*.

Reads

Read operations are executed on a merged view of the memtable and SSTables. This is efficient because both memtables and SSTables are lexicographically ordered.

Compactions

Basically involve merging memtables and SSTables to form new SSTables. This will “coalesce” writes and make reads more efficient, so that merge operations are written to disk and will not have to be redone for consequent reads.

How are scalability and consistency guarantees met?

Assignments of tablets to tablet servers is managed by a master server. The master is responsible for rebalancing tablet server load, detecting tablet server membership changes, and assigning tablets to servers.

Big Table uses Chubby as a distributed lock service to coordinate tablet assignment. Tablet servers attempt to acquire an exclusive lock on a uniquely named Chubby file on startup and will need to periodically renew the lock lease. If a Chubby server loses its lock, the master will reassign its tablets and delete its Chubby file.

Each tablet server will know of (and track) which tablets it is assigned to. The master can also get this information (as well as know which tablets are unassigned) by scanning the METADATA table. The METADATA table tracks the locations of all tablets. When a tablet grows too large, its tablet server will initiate a tablet split.

Big Table scales less than linearly. It scales well for sequential reads, sequential writes, as well as random writes. It scales extremely poorly for random reads, since a random read (from disk) will always cause a 64 KB block fetch from GFS. This can be mitigated by configuring the particular table / column family to have the SSTable stored in memory.

Failure Modes

  • Big Table is dependent on Chubby. If Chubby dies, Big Table will become unavailable.
  • Tablet movements (tablet server reassignment) will cause the tablet to become temporarily unavailable for up to 1 second.

Key Benefits

  • Semi-structured data provides a little bit more than pure key-value stores.
  • Locality groups realize similar compression and disk read performance benefits observed for other systems that organize data on disk using column-based rather than row-based storage.
  • Provides a lower level read and write interface and is designed to support many thousands of such operations per second per server.

Questions

A few follow up questions we couldn't answer during our discussion.

  • Can tablet servers exploit GFS locality? The way GFS is described in the paper seems like a black box. Can a tablet server configure things so that the tablets that it serves are geographically / network-wise closer?
  • How can we cheaply access S3 or exploit S3 locality? (extending to Amazon S3)
  • How is the way Chubby is used by Big Table similar or different to the way Kafka or Cassandra uses Zookeeper?

Unless otherwise specified, the source of this information is the original Big Tablet paper from OSDI 2006 and our discussion notes here.

Additional Reading

http://distributeddatastore.blogspot.com/2013/08/cassandra-sstable-storage-format.html

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 202,723评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,080评论 2 379
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 149,604评论 0 335
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,440评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,431评论 5 364
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,499评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,893评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,541评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,751评论 1 296
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,547评论 2 319
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,619评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,320评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,890评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,896评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,137评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,796评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,335评论 2 342

推荐阅读更多精彩内容

  • 今天周二,粤B 5AB2X的车主(暂且就叫他5AB吧)和以往的每个工作日一样,7点25分到达地下车库,把那辆银灰色...
    金数据阅读 611评论 0 1
  • 我们都曾在雨季里遇见对方,离去时却总来不及告别,向雨季告别。 四月的雨,细细密密如那散不开的浮雾,灰蒙蒙似缠绕眼前...
    茶馆先生阅读 662评论 4 3
  • [E0-02]数据库思维 天依然蓝着,没心没肺。知了依然叫着,撕心裂肺。马路依然拥挤,繁华和你的孤单和谐相处。打开...
    怒马2048阅读 1,351评论 0 2