Scaling PostgreSQL to power 800 million ChatGPT users

OpenAI runs ChatGPT on a single-primary Postgres with nearly 50 global read replicas. Reads are offloaded, write-heavy shardable workloads move to Cosmos DB, and PgBouncer, cache leasing and multi-layer rate limits keep the primary safe.

Published
2026-01-22
Scale
800 million users, millions of QPS, ~50 read replicas
Techniques
read replicas connection pooling caching rate limiting workload isolation query optimization
Stack
PostgreSQL Azure PgBouncer Kubernetes Cosmos DB

Try this stack yourself

  • Railway · Deploy something like this on Railway: spin up PostgreSQL plus your app in a few clicks. New accounts get $20 in credit (applied when you pick a paid plan).
    Railway isn't part of OpenAI's setup in this story. It's just an easy place to try the same building blocks.
  • Better Stack · Monitor uptime and logs with Better Stack, and get alerted fast if a migration or traffic spike goes sideways on your own system.
    Better Stack isn't part of OpenAI's setup in this story. It's a tool for watching your own systems while you try ideas like these.

Some links above are affiliate links: if you sign up, How They Scaled may earn a commission at no extra cost to you. We only list tools that fit the stack in the story.

See also

The best scaling write-ups, weekly

One email a week. No spam.

Subscribe