Skip to content

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

OpenAI 18 min read Case study mediumAdept

Rapidly scaling online storage to serve over 1 billion ChatGPT users (Part II)

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.

Related posts

  • 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.

  • Scaling PostgreSQL to power 800 million ChatGPT users

    OpenAI mediumAdept

    OpenAI serves millions of queries per second for ChatGPT and its API from a single unsharded Azure PostgreSQL primary plus nearly 50 geo-distributed read replicas, despite load growing more than 10x in a year. The approach is to keep the primary as idle as possible: move shardable write-heavy workloads to Azure Cosmos DB and ban new tables, push reads to replicas, kill expensive ORM-generated joins, and isolate high- and low-priority traffic onto separate instances. Supporting measures include PgBouncer pooling (connection time down from 50 ms to 5 ms), cache leasing to stop miss storms, multi-layer rate limiting with query-digest blocking, and schema changes capped at a 5-second timeout. The result is low double-digit millisecond p99 latency, five-nines availability and one SEV-0 in 12 months, and cascading replication is being tested to scale past 100 replicas.

  • 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.

  • Husky: Exactly-once ingestion and multi-tenancy at scale

    Datadog Engineering hardMaster

    Husky, Datadog's columnar event store, achieves exactly-once ingestion and cost-efficient multi-tenancy by routing events deterministically to Kafka partition groups (shards), so deduplication only has to happen within a shard. Time-bounded, immutable Shard Placements are allocated per tenant by a Sharding Allocator that uses FoundationDB transactions to give every Shard Router node the same answer. An Autosharder resizes each tenant's shard count from byte-throughput metrics. Consistent hashing with wraparound and shard exclusions keeps placement churn minimal, and a balancer counters hotspots. Limiting how many tenants each writer handles also cuts the number of blob-storage files and compaction work.

  • The bridge to agent-scale Git infrastructure

    GitHub Engineering mediumAdept

    GitHub has moved nearly all Git repositories to replicas split between its own data centers and Azure. The last, busiest repositories were held back by a 25ms cross-region round trip, because Spokes' quorum serialized every write behind a repository-wide lock. Narrowing the quorum's scope to individual references lets writes to different branches proceed concurrently, giving 3–4x higher throughput at lower latency in internal testing. A 'virtual write replica' makes Azure Blob Storage a quorum member and coalesces disjoint-reference writes into shared I/Os, so ephemeral read replicas can warm from object storage and scale independently of the write path.

The quest for software engineering knowledge.

Look:
Layout: