techlist.io
OpenAI2026-09-104 min read

Curated summary

Rapidly scaling online storage to serve over 1 billion ChatGPT users

Read original(opens in new tab)

OpenAI's Habitat, an online storage platform, grew from a small Python client library into a centralized service that handles over 70 million requests per second and more than 500 petabytes of data for products used by over 1 billion people weekly. The post argues that growing more than 10x year over year required a series of tactical decisions: moving logic into a single service for control, tuning Python for tail latency, constraining the API so request costs stay predictable, and eventually rewriting the service in Rust.

From Client Library to Central Service

  • Habitat launched at DevDay 2023 as a Python library that hid schema lookup, routing, authorization, encryption, and connection pooling from product engineers, mapping simple operations to a single Azure Cosmos DB backend.
  • By mid-2025, every change to the client required coordinated rollouts across dozens of services. One routing change took days to deploy, and a single team rolling back to an old buggy client caused an outage.
  • Moving storage logic into a standalone service gave OpenAI one point for deployments, observability, and fixes, and one chokepoint for access control, audit logging, and limiting direct access to storage.

Running Python at Scale

The team knowingly accepted Python's overhead as short-term technical debt. Its priority was unblocking product teams, and it bet that its coding models would make a later migration feasible. Since each user request can trigger hundreds of database calls, tail latency was the main concern.

Asyncio Scheduling Delay

  • Asyncio handles concurrent I/O but not CPU parallelism, and Habitat does a lot of CPU work, including routing, compression, encryption, checksumming, health checks, shadowing, and hedging.
  • Traces showed fast downstream responses but requests stalling before their coroutines were rescheduled.
  • The team measured event loop delay by scheduling periodic tasks and recording how late they ran. Under load, delays reached hundreds of milliseconds and occasionally several seconds.
  • The fix was to keep each process's concurrency low and scale out to many more worker processes.

Feature Flag Configuration Stalls

  • CPU profiling found that Statsig polled every minute with no jitter, and the config contained every production rule for every service.
  • With up to 8 Python processes per pod, all workers periodically stalled while parsing this large JSON file.
  • The fix was a smaller targeted config, a longer refresh interval, and jitter on background tasks.

Connection Pooling and Metastable Failure

  • Client-side pooling sent most load to a few processes, and some processes served 5 to 10 times the average concurrency.
  • Overloaded processes stayed degraded even after traffic dropped, because aiohttp's TCPConnector reuses connections LIFO. Slow servers return connections later, so they were selected more often, concentrating even more traffic on them.
  • Switching to FIFO reuse broke the feedback loop and reduced steady-state variance. Istio and Envoy now handle load-aware balancing across OpenAI's infrastructure.

Protecting Downstream Resources

  • Many processes make it easy to overwhelm dependencies. Deployments can cause connection churn, and connection leaks can saturate NAT gateways.
  • Envoy upgrades Python's HTTP/1 connections to HTTP/2 for multiplexing, pools connections, extends their lifetimes, and centralizes rate limiting and circuit breaking.

A Deliberately Constrained API

  • Habitat exposes a NoSQL API instead of arbitrary SQL, so request cost stays predictable and no query can cause unbounded table scans or joins.
  • The model is inspired by Meta's TAO: clients define object and edge types, and Habitat supports only direct edge queries. Objects and their edges are colocated in a partition, but related remote objects are not, so multi-hop traversals may cross regions and accounts.
  • Clients with complex query needs use a read-only view in Rockset, fed by change data capture (CDC). Each team scales its own Rockset instance, which isolates analytical workloads from the online store.
  • This tradeoff followed earlier Postgres outages, where one expensive new query on a hot path took down the database.

Migrating from Python to Rust

  • By Q2 2026, two engineers using Codex and GPT-5.5 rewrote the entire service in Rust.
  • The Rust service now handles 95% of production requests, with Python slated for deprecation within weeks. At its peak, the Python service handled over 20 million requests per second.
  • Measured against Python, the Rust version is 6x more CPU efficient and 15x more memory efficient, with lower average and tail latencies.

The post's companion article will cover the Azure Cosmos DB storage layer, multi-tenant reliability, and read-performance optimizations.

Continue with another curated summary.