Curated summary
Rapidly scaling online storage to serve over 1 billion ChatGPT users (Part II)
Scaling Habitat's Azure Cosmos DB Storage to Serve Over a Billion Users
OpenAI's storage platform, Habitat, serves over a billion users across 40 regions with millisecond latency and stores more than 500 petabytes of data. This second part of the series covers how the team scaled Azure Cosmos DB, the underlying storage layer, by moving from per-use-case containers back to a shared multi-tenant container with Azure-built fixes. The team also reports a 12x improvement in global read latency, driven by placing data near users, layered caching, and a Rust rewrite, and it describes a co-engineering model with Azure that was needed once the service ran at this scale.
Multi-tenancy Trade-offs and the Circular Journey
- Single-tenancy gives each team isolation and clear ownership, but it forces every team to plan capacity and often leads to heavy over-provisioning.
- Multi-tenancy centralizes provisioning expertise but introduces noisy-neighbor problems, where one tenant consumes a disproportionate share of resources.
- Habitat moved from one shared Cosmos container, to single-tenant containers per use case, and back to a shared container by default.
Phase I: Relying on Cosmos DB Primitives
- The initial design exposed logical partition key selection directly to clients, so common keys like
user_idandworkspace_idcollided across unrelated use cases. - Logical partition limits (about 10K RU/s) are actually enforced at the physical partition level, so hot keys and unrelated workloads on the same physical partition share a single budget. This let niche feature workloads disrupt core login and signup flows.
- Throughput is divided roughly evenly across physical partitions. As storage grows and partitions split, per-partition throughput shrinks while total provisioned throughput stays the same. For storage-heavy, blob-like workloads, growth alone reduces capacity for active traffic.
Phase II: Workload Isolation Through Separate Containers
- Dedicated containers gave critical new use cases independent physical partitions, but each one needed individual capacity planning, and the team had to pre-provision for launches.
- Legacy critical services remained stuck in the default shared container, so the team kept provisioning new containers to shield it, which trended toward more launch-day incidents.
- Losing the shared container's aggregate growth meant that a new feature going from near zero to a million QPS could represent a massive relative load spike. Teams often forgot to pre-scale, and engineers scaled containers manually during launch-day incidents.
- Capacity planning required deep product knowledge across the organization, and the diligence varied widely between teams. This did not scale.
Phase III: Shared Tenancy with Azure-built Fixes
- Hot key throttling limits the hottest keys first, so a single key cannot consume a physical partition's throughput and cause a site-wide impact.
- Quality of Service tiering assigns lower priority to offline workloads like bulk inserts and data extracts, so they are throttled before interactive, end-user traffic.
- Improved serverless mode, built with the Azure team, lifts the per-physical-partition limit from 5K to 10K RU/s and adds RU-based splits alongside storage-based splits. This removed the need for manual container scaling.
- Since returning to one shared container, the team reports no provisioning or noisy-neighbor incidents in the following months, even as product development accelerated.
Co-managed Services at Massive Scale
- The largest Cosmos DB account stores tens of petabytes and serves more than 20M QPS, which the team believes is the largest such deployment.
- A late-2024 regional power outage exposed that the largest accounts took several hours to fail over, a scenario neither team had tested at this scale.
- While failing back, a connection stampede overwhelmed the original region's gateway. A gateway-mode client quirk caused every client to connect to the original region at once, even though only some physical partitions had moved back.
- Both teams now jointly monitor every layer of Habitat, test against a production-sized non-production account, co-develop SDKs, and have direct engineering channels, including paging paths that bypass support tiers.
- Joint work included gateway load protection, metadata caching, connection pooling, colocating workloads, and separating critical traffic from offline workloads into different VPCs.
Improving Global Read Performance
Reads account for over 90% of Habitat's requests. Latency had been driven by cross-region calls, and product teams compensated with complex client-side caching and batching, which slowed iteration. The layered strategy is:
- Store data near users when capacity allows. Data residency requirements drive most regional accounts. Broader colocation is limited by datacenter power and cooling, so placement is a trade-off between latency and raw capacity.
- Replicate only the smallest, most latency-sensitive datasets. Authentication metadata, needed on every request, is replicated to all 40 regions in some accounts. This approach is capacity-constrained and limited to a few hand-picked datasets.
- Use a distributed lookaside cache with CDC-driven invalidation. Valkey caches sit close to request processing. Rather than relying on TTLs, which trade hit rate against staleness, a service consumes the Cosmos change feed and invalidates local caches within seconds, following the approach of Meta's TAO.
- Rewrite the proxy in Rust. Replacing the Python service removed significant per-request overhead.
Together these changes reduced global read p50 from roughly 120 ms to roughly 10 ms. The slowest requests still hit uncached data in distant regions, so the next goal is placing data closer to where it will be accessed from the start.
Scaling Change Data Capture
- The CDC platform captures millions of changes per second across thousands of containers and feeds more than a hundred Kafka topics, powering caching, secondary indexes, data movement, analytics, and real-time features.
- A control plane ensures all required containers are captured, selects read regions, and distributes work across thousands of workers in multiple geographies. Replica regions and lower-priority feed reads keep background capture from affecting latency-sensitive traffic.
- Dead letter queues prevent permanent delivery failures from blocking the stream, and readers switch to alternate regions during outages.
- The team contributed changes to Azure's CDC SDK, batching checkpoints in memory and flushing them periodically for efficiency.
- The goal is a simple developer surface: clients register a callback, and the platform handles discovery, plumbing, and scaling.
Looking Ahead
The team is building an in-house, exabyte-scale online storage system optimized for bulky Habitat data. It combines the RocksDB Cloud core from Rockset with Raft-based replication and uses disaggregated storage and physical replication. It keeps the same document model as Cosmos DB, trading lower peak QPS for reduced flash capacity needs.
Related reading
Continue with another curated summary.
OpenAI2026-09-10 Rapidly scaling online storage to serve over 1 billion ChatGPT users
Read original
OpenAI2026-01-21 Scaling PostgreSQL to power 800 million ChatGPT users
Read original
LINE2026-04-08 The Key to AI Utilization Lies in 'Organizational Learning' - The Start of the Orchestration Development Workshop
Read original
Datadog2024-05-21 Engineering VP spotlight: Ivo Dimitrov
Read original