Top Banner
Tao: Facebook's Distributed Data Store For The Social Graph Bronson et. al., ATC 2013 Joy Arulraj CMU 15-799 : Paper Presentation
24

Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

May 12, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Tao: Facebook's Distributed Data Store For The Social Graph

Bronson et. al., ATC 2013

Joy Arulraj

CMU 15-799 : Paper Presentation

Page 2: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Talk Overview

• Graph-aware cache backed by a database

– Efficiency vs. consistency

Page 3: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Motivation

• Memcached

– Distributed in-memory key-value store

– Memory object caching system

– Data mapping in client code (PHP API)

Page 4: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Limitations

• Association lists

– Get entire list to update one edge

• Control logic

– Clients manage lookaside cache

– But, only have a local perspective

• Expensive read-after-write consistency

– Writes forwarded to master

– Local state updated asynchronously

Page 5: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Problem Statement

• Need a “smart” caching layer

– Graph-aware

– Distributed cache management

– Provides read-my-write consistency

• Solution

– Fix the API and leverage its constraints !

Page 6: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Example

Alice was at CMU with BobCathy : Wish we were there !

David likes this

Id : 600 otype : LOCATION name: CMU

Id : 400 otype : Username: Cathy

Id : 500 otype : USER name: David

Id : 800 otype : COMMENTtext: Wish we were there !

Id : 200 otype : Username: Alice

Id : 300 otype : Username: Bob

LOC

CMT

LIKES

Id : 700 otype : CHECKIN

FRIE

ND

Page 7: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Data Model

• Object

– (id) -> (otype, (key->value)*)

– Entities, repeatable actions

– Ex: users, comments

• Association

– (id1, atype, id2) -> (time, (key->value)*)

– Relationships, actions that model state transitions

– Ex: tagged at, likes

Page 8: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Data Model

• Association List

– (id1, atype) -> [anew,…,aold]

– Supports the Association Query API

– Ex: (“CMU”, “COMMENT”)

Page 9: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

API

• Association API

– assoc_add(id1, atype, id2, time, (k->v)*)

– assoc_delete(id1, atype, id2)

• Association Query API

– [POINT] assoc_get(id1, atype, id2)

– [RANGE] assoc_range(id1, atype, pos, limit)

– [COUNT] assoc_count(id1, atype)

Page 10: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Client Queries

• All queries start from an <id, atype>

• 5 most recent comments on Alice’s checkin

– assoc_range(“Alice”, “COMMENT”, 0, 5)

• Number of friends of Bob

– assoc_count(“Bob”, “FRIEND”)

Page 11: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Tao’s Goals

• Low read latency

• Write consistency

• High read availability

Page 12: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Basic Architecture

Webservers - Stateless

Database- Partitioned based on <id>

Cache servers- Objects, Association Lists- Partitioned based on <id>TAO

Page 13: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Low Read Latency

Webservers - Too many network hops

Cache servers- Hotspots with smaller shards

Page 14: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Datacenter-level Scalability

Tiers- Distributed write logic

Database- Thundering herds

Page 15: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Splitting the cache layer

Follower Cache

Leader Cache

Page 16: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Write Consistency

• Followers

– Absorb read hits

– Forward read misses and writes to leaders

– Write-through cache

• Leader updates

– Synchronously sent in reply to writer

– Asynchronously sent to other followers

Page 17: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Write consistency

• Leaders

– Serialize concurrent writes

– Can prevent “thundering herds”

• Association list updates

– Refills instead of invalidates

– Idempotent pull-based incremental updates

Page 18: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Multi-datacenter Scalability

Master Datacenter

Replica Datacenter

Forwarded writes

Async DB replication

Page 19: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

High Read Availability

• Follower failure

– Client contacts backup follower tier

– May break read-after-write consistency

• Leader failure

– Follower tiers reroute read misses directly to DB

– Writes sent to another member of leader tier

Page 20: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Handling Hot Spots

• Consistent hashing

– Simplifies cluster expansion

– Request rerouting

• Load balancing

– Shard cloning

– Small client-side cache

Page 21: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Results

• Reads dominate writes

– 99.8% read requests

– 40% of requests are range queries

• Most edge queries have empty results

– Tao can use cached assoc_count

– Key advantage of app-aware caching

Page 22: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Results

• Availability

– Fraction of failed queries : 4.9*10-6

• Follower Throughput

– 8 core Xeon + 144GB RAM + 10Gb Ethernet

– 30-60K requests/sec

Page 23: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Tao Summary

• Low read latency

– Application-aware cache layer

• Write consistency

– Replication model

• High read availability

– Fault-tolerance

Page 24: Tao: Facebook's Distributed Data Store For The Social Graphpavlo/courses/fall2013/static/slides/tao.pdfTao: Facebook's Distributed Data Store For The Social Graph Bronson et. al.,

Talk Summary

• Graph-aware cache backed by a database

– Efficiency vs. consistency

• Why did they not use a graph database ?

– They trust MySQL

– Tao’s cache layer handles their demands

Thanks !