How Meta built the infrastructure for Threads
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.
Related posts
- ZGateway: Learnings from Putting a Proxy in Front of ZippyDB
Meta Engineering mediumAdeptZGateway 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.
- Asynchronous computing at Meta: Overview and learnings
Meta Engineering mediumAdeptMeta re-architected Async tier, its serverless asynchronous computing platform running multi-trillion workloads per day, by splitting an overloaded Dispatcher into data-source-specific "tailers" and a source-agnostic scheduler. Tailers now push work to the scheduler over RPC instead of the scheduler pulling from the FOQS queue. This removed redundant copying into FOQS, improved end-to-end latency and cross-region load balancing, and made streams, warehouses and pub/sub first-class sources, at the cost of being a poor fit for long-running workloads. Queues offer lease-based granular retries and flexible ordering at moderate cost, while streams are cheaper for high-volume sequential access but clog on failed items. A separate controlled-delay service, backed by a priority queue or chained fixed-delay streams, preserves at-least-once delivery without blocking the stream.
- Rapidly scaling online storage to serve over 1 billion ChatGPT users (Part II)
OpenAI mediumAdept
OpenAI's Habitat storage platform went from one shared Azure Cosmos DB container, to per-use-case dedicated containers, and back to a shared multi-tenant container. Shared containers suffered from logical partition key collisions, noisy neighbors on physical partitions, and "weak partitions" whose throughput shrank as storage-driven splits divided fixed RU/s. Dedicated containers fixed isolation but lost the smoothing effect of aggregate load, which pushed capacity planning onto every product team and caused launch-day SEVs. Hot-key throttling, QoS request tiering and a new serverless mode built with Azure (10K RU/s per physical partition, plus RU-usage-based splits) made shared tenancy work. Failover and failback outages at 20M+ QPS scale also led to co-managed operations with Azure, including joint monitoring and production-sized test accounts.
- FOQS: Making a distributed priority queue disaster-ready
Meta Engineering mediumAdeptMeta's FOQS distributed priority queue moved from isolated regional installations on semi-synchronous replicated MySQL to a single global installation, after Hurricane Florence in 2018 exposed manual traffic rebalancing and items stuck on unreachable shards. The global design uses Shard Manager so a queue node in the new region takes over a MySQL primary within seconds of failover. A routing service maps logical region preferences to shards for enqueue and keeps a heap-based cache of nodes with ready items for dequeue. Migrating the Async platform required parallelizing cache replenishment, which nearly halved its latency, and randomizing selection among top-priority nodes to fix thundering herd and starvation. The 2021 migration finished with zero downtime using shadow load testing, config-based rollouts and health dashboards.
- Rapidly scaling online storage to serve over 1 billion ChatGPT users
OpenAI mediumAdept
Habitat, OpenAI's online storage platform, grew from a client-side Python library over Azure Cosmos DB into a centralized Python service handling 70M+ requests per second and 500+ PB across about 40 regions. It moved to a service because coordinating client-library rollouts across dozens of services had become slow and error-prone. Running Python at this scale meant fighting tail latency from asyncio event-loop scheduling delay, which the team measured directly and controlled by keeping per-process concurrency low and scaling out worker processes. Specific fixes included shrinking and jittering Statsig feature-flag config refreshes, and switching aiohttp's LIFO connection reuse to FIFO to break a metastable failure that concentrated load on already-slow processes.