Ankit Patel
WritingPapersLabsAboutContact
Paper Reviews··2 min read·365 views

TAO: Why Facebook Built a Graph Cache Over MySQL

Meta TAO & RAMP-TAO · Bronson et al. (ATC 2013) & Cheng et al. (VLDB 2021)

A like writes two entries on two shards, so a reader can arrive after the first write lands and before the second

By the time Meta published RAMP-TAO in 2021, TAO already supported failure-atomic writes across shards. A reader could still observe half a transaction.

That distinction makes pairing Cheng et al.'s 2021 paper with Bronson et al.'s original 2013 TAO paper unusually instructive. Saying 'our writes are transactional' never finishes the specification of what a concurrent client can read.

TAO gave Facebook product engineers a compact objects-and-associations API backed by sharded MySQL and two tiers of graph-aware caches. Product teams queried social edges directly without hand-rolling cache invalidation, and the architecture ruthlessly prioritized read throughput, low latency and availability on a read-dominated graph.

In the 2013 design, a forward association and its inverse often lived on different database shards. TAO did not coordinate two-phase commits across those shards, leaving rare mid-flight failures for asynchronous repair jobs to clean up.

Even after adding durable cross-shard write atomicity so both sides eventually commit or abort together, durable commit and simultaneous read visibility remain separate properties. Asynchronous cache invalidations and cross-region replication apply shard updates at slightly different instants.

Take a transaction that updates two shard-separated values from A0 and B0 to A1 and B1:

What the read returns Relationship to that transaction
A0 and B0 Neither update visible
A1 and B1 Both updates visible
A1 and B0 Fractured read (partial visibility)
A0 and B1 Fractured read (partial visibility)

Rows three and four break symmetry assumptions in product code, such as seeing a user listed in a group before the group appears in the user's membership list. Guaranteeing that B1 eventually lands on disk does nothing for the cache reader who arrived two milliseconds early.

In Cheng et al.'s production trace study, partial transactional visibility appeared in roughly 1 of every 1,500 batched reads. RAMP-TAO closed that gap with read-atomic transactions: whenever a client observes one edge written by a transaction inside its read set, the protocol ensures it sees that transaction's sibling updates too.

By carrying lightweight transaction metadata alongside buffered recent versions in cache, their prototype resolved more than 99.93% of read transactions in a single communication round with modest cache-memory overhead on the measured workload.

Following TAO across eight years is one of my favorite case studies in incremental systems engineering. Rather than bolting full serializability onto a planet-scale social cache on day one, the team isolated the exact anomaly hurting product invariants. Read atomicity still allows bounded staleness and stops well short of strict serializability, which is precisely why naming the read guarantee your application needs matters: sometimes all the caller requires is seeing A0/B0 or A1/B1, never half of each.

Continue in Paper Reviews