Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 10 min read Case study hardMaster

How we built a general purpose key value store for Facebook with ZippyDB

ZippyDB is Facebook's largest strongly consistent, geo-distributed key-value store, built by layering a reusable replication library (Data Shuttle) on RocksDB, Shard Manager and a ZooKeeper-based config service. Shards of 50–100 GB hold tens of thousands of μshards, enabling transparent resharding. Each shard keeps a small Multi-Paxos quorum plus async follower replicas, with epoch-based leader leases assigned externally. Consistency is chosen per request: fast-ack or quorum writes, and eventual (actually bounded-staleness), read-your-writes or lease-based strong reads. Serializable transactions use optimistic concurrency control on the primary within an epoch, and conditional writes reuse that machinery server-side.

Related posts

  • Deno KV internals: building a database for the modern web

    Deno hardMaster

    Deno KV's production backend runs on FoundationDB, with a custom "transaction layer" in front of it that handles multi-tenant configuration, JavaScript-native types such as bigint sums, and cross-region replication. To keep latency low, every atomic operation is non-interactive: a single bag of versionstamp checks, set/delete writes and conflict-free mutations that completes in one or two network trips. A sequencer assigns monotonic transaction sequence numbers, and an evaluator turns each batch into a dataflow graph of AND/MUX operations and evaluates it concurrently. Results are reused speculatively before a writer commits them to FoundationDB, which raises throughput without locks.

  • Announcing Deno KV

    Deno mediumAdept

    Deno KV is a strongly consistent key-value database built into the Deno runtime. It is backed by SQLite when run locally and by FoundationDB when managed on Deno Deploy, where it is globally replicated across 35 regions. The API stores structured-serializable JavaScript values under array keys, supports prefix listing with cursor pagination, and offers atomic multi-key transactions using check-and-set. Reads are strongly consistent (serializable and linearizable) by default and can opt into eventual consistency for lower latency, for example 7ms versus 94ms in Frankfurt during the beta.

  • RAMP-TAO: Layering atomic transactions on Facebook’s online graph store

    Meta Engineering hardMaster

    RAMP-TAO is a protocol that layers read-atomic transactional guarantees on top of TAO, Facebook's eventually consistent social graph store, so developers get an intuitive read transaction API without handling fractured-read anomalies. Adapted from Read Atomic Multi-Partition (RAMP) protocols in a "bolt-on" style, it guards only recent, transactionally updated data and relies on eventual consistency for everything else, so non-transactional workloads pay no cost. Production feasibility results show 0.42% memory overhead, over 99.9% of reads completing in one round-trip to the local cache, and tail latency on par with existing TAO reads. The layered design is cache-friendly, hotspot tolerant and proposed as applicable to other read-optimized stores.

  • How Meta built the infrastructure for Threads

    Meta Engineering mediumAdept

    Threads reached 100 million sign-ups in five days on existing shared Meta infrastructure rather than purpose-built systems, illustrated through two components: ZippyDB and Async. ZippyDB, a multi-tenant key/value store, absorbs sudden demand by shifting unused allocations and slack between keyspaces via config changes. It scales out with a zero-downtime resharding protocol that remaps logical shards to new physical shards, which let the team proactively prepare Threads keyspaces for 100x growth just before launch. Async (XFaaS), a serverless deferred-execution platform, queued the far-higher-than-expected follow-graph imports and notification jobs and rate-limited their execution to protect downstream services such as the social graph database.

  • ZGateway: Learnings from Putting a Proxy in Front of ZippyDB

    Meta Engineering mediumAdept

    ZGateway is a stateless regional proxy tier in front of ZippyDB, Meta's most widely used key-value store. It handles over 1 billion ops/sec and about 40% of ZippyDB traffic at roughly 6% compute overhead. It collapses the direct client-to-database connection mesh, cutting per-host connection counts by about 97–98% in a balls-into-bins model and making database fan-in independent of client population. Cross-client batching and coalescing amortize RPC overhead and neutralize hot keys. The shared tier also hosts per-tenant discriminant load shedding, CDC-invalidated read caching, CPU-weighted load balancing, cross-region failover and transaction bookkeeping for thin clients.

The quest for software engineering knowledge.

Look:
Layout: