
TAO to a higher-level query framework, Ent, which makes it easy
to express complex operations over the graph, product developers
have increasingly desired transactional semantics to avoid having
to handle partial failures. In response, TAO engineers implemented
failure-atomic write transactions (Section 2).
Similarly, adding support for read transactions would greatly
simplify the developer experience by directly enforcing application-
level invariants. Currently, under TAO’s eventual consistency, a
naïve batched query can observe fractured reads [
17
]—reads that
capture only part of a write transaction’s updates before these up-
dates are fully replicated. As we demonstrate in the rst large-scale
measurement study of its kind, these anomalies occur 1 out of
every 1,500 read batches (Section 3). Given the size of TAO’s work-
load, this relatively modest rate is signicant in practice. Moreover,
fractured reads are hard to detect in the application layer with an
asynchronously replicated system. These anomalies are burden-
some for developers to reason about and explicitly handle in order
to minimize end user impact.
By providing atomic visibility [
17
], or the guarantee that reads
observe either all or none of a transaction’s operations, we can intro-
duce a simple and intuitive read transaction API on TAO. However,
enabling these semantics presents signicant challenges in practice.
Due to TAO’s scale and storage constraints, we want to avoid coor-
dination and minimize memory overhead. Our implementation of
atomic visibility must also be cache-friendly, hot-spot tolerant, and
extensible to dierent data stores. Moreover, we should only incur
overhead for applications that opt in (rather than requiring every
application to pay a performance penalty). Although we focus on
TAO in this work, these challenges apply to many other large-scale,
read-optimized systems [2, 41, 49].
In this paper, we introduce a new RAMP-TAO protocol (Sec-
tion 4), which layers atomic visibility on top of TAO while achieving
our performance goals above. While our work is inspired by the
Read Atomic Multi-Partition (RAMP) protocols [
17
], we address
several of their drawbacks. The original RAMP transactions impose
atomic visibility verication overhead on all reads, require substan-
tial metadata, and assume full support for multiversioning (which
TAO lacks). RAMP-TAO leverages the key insight that we only need
to guard against fractured reads for recent, transactionally-updated
data to reduce the overheads of ensuring atomic visibility.
Our layering strategy takes the “bolt-on” [
18
] approach to stronger
transactional guarantees (Figure 1). We prevent transactions from
interfering with TAO’s availability, durability, and replication pro-
cesses, retaining the reliability and eciency of the system. Only
applications that need stronger guarantees incur the resulting per-
formance costs. Furthermore, our protocol exploits existing cache
infrastructure and requires minimal changes to TAO internals. Thus,
RAMP-TAO is eective for both providing default guarantees across
data stores and as a retroactive optimization for massive, read-
optimized systems, many of which have sought to strengthen their
isolation models [
1
,
4
,
5
]. We also describe an optimization of our
protocol for bidirectional associations (paired edges in the graph),
which represent a special case of failure-atomic transactions. These
data structures are ubiquitous in TAO, so any protocol providing
atomic visibility needs to be especially ecient for them.
We demonstrate that RAMP-TAO is feasible for production use
by benchmarking its latency and memory overheads (Section 5).
Figure 2: Subgraph for a hypothetical example.
Our prototype implementation provides atomic visibility in a read-
optimized environment with one round trip for greater than 99.93%
of reads and a modest 0.42% increase in memory overhead.
In summary, we make the following contributions in this paper:
•
We report on developer challenges and needs for transactional
semantics within Facebook’s social graph serving ecosystem
(Section 2).
•
We present a quantitative study of atomic visibility violations
derived from production data to demonstrate the importance of
providing this guarantee in a read transaction API.
•
We describe a novel RAMP-TAO protocol (Section 4) to e-
ciently provide atomic visibility for an eventually consistent,
read-optimized system.
•
We demonstrate the production feasibility of RAMP-TAO by
showing it incurs minimal overhead and requires only one round
trip for the vast majority of reads (Section 5).
2 OVERVIEW AND MOTIVATION
TAO provides online access to the social graph at Facebook [
21
]. It is
implemented using two layers of graph-aware caches that mediate
access to the statically-sharded MySQL database [
35
]. Updates are
replicated asynchronously via the Wormhole pub-sub system [
44
].
TAO prioritizes low-latency, scalable operations and thus opts
for weaker consistency and isolation models to serve its demanding,
read-dominant workloads. TAO provides point get, range, and count
queries, as well as operations to create, update, and delete objects
(nodes) and associations (edges). Its simple graph API is conducive
to maintaining high reliability and is sucient for the vast majority
of applications at Facebook. As new applications emerge and as
Ent, our higher-layer query framework, evolves, we have been
exploring, designing, and implementing additional features such as
transactions while preserving TAO’s reliability and eciency.
In this section, we explain the types of transactional guarantees
developers desire and highlight corner cases they need to handle be-
fore system-level options are oered. We then describe the current
approaches to providing failure atomicity. Finally, we demonstrate
the importance of atomic visibility for an intuitive read transaction
API and considerations for providing stronger guarantees at scale.
2.1 An example
Consider a hypothetical social media product built on top of TAO,
with user nodes, media nodes, edges when a user has composed a
piece of sheet music, and edges when a user has recorded a song.
This product enables musicians to share their sheet music and cor-
responding recordings together. Let us say that Alice wants to share
a piece of music she has composed and recorded so that others can
view the sheet music while listening to the recording. The applica-
tion writes the following edges together (the resulting subgraph is
shown in Figure 2):
3015
评论