AI apps · Staff · Two core regions with serving-only edge regions
Global AI assistant system design, running live
A consumer AI assistant served from six regions with two jobs. N. Virginia and Ireland are core regions: they serve chats and also hold the account writers, file indexing, usage rollups, billing and the telemetry archive. Oregon, Tokyo, Frankfurt and Mumbai are serving-only edges sized to their own traffic and their failover partner's, and they send usage, telemetry and uploads to their core. At peak no part runs above 30%.
A teaching design of a system like ChatGPT or Claude, not the real architecture of either company. Traffic, capacity and cost are simulator estimates. Model and assumptions.
- Traffic
- 100,010 req/sHuge scale
- AWS bill
- $29.5M/mo
- p99
- 2.9 s
- Components
- 178
100,000 requests a second at the daily peak, an assumed figure rather than any company's published number: 8,280 chat messages, 36,800 thread calls, 32,200 device sync polls, 7,360 telemetry batches, 6,440 account calls, 920 file uploads and 8,000 web app hits that CloudFront answers. If someone in a conversation sends a message every 30 seconds, that is about 250,000 conversations at once.
How it works
- Regions have two jobs. N. Virginia and Ireland are core: they serve chats and run everything that writes or batches. Oregon and Tokyo send their background work to N. Virginia; Frankfurt and Mumbai send theirs to Ireland. Edges carry only what a request needs: load balancer, chat servers, safety, plan limits, model quotas and read replicas.
- Route 53 sends each person to the nearest region and fails over in pairs: N. Virginia and Oregon, Ireland and Frankfurt, Mumbai and Tokyo. Each region is sized for its own peak or for its partner's traffic on top of its own, whichever is bigger, so Oregon is built for more than its own users.
- A message is one streamed request. The chat server checks the message window in Redis, which falls back to a DynamoDB table that also takes every count. It runs the safety classifier, reads saved memories and the thread, streams the answer from a local model quota and sends a usage record to its core region's stream.
- One message in ten has files attached: the question is embedded locally and the core region's file index searched. One in twenty calls a web search API for fresh facts.
- Chats are under a tenth of the traffic. Most requests are the sidebar, opening old threads and devices polling for changes, all answered from local replicas. Sync reads its own table, so the thread store stays well under its per-table throughput limit.
- The chat servers are async. A 3-second answer holds a connection, not a thread, so CPU is the limit. A thread-per-request API tier would run out of threads long before CPU.
- Background work runs next to its data. Uploads land in the core region's S3 bucket and queue, where workers embed the chunks on their own quota. Usage records feed Flink rollups, and each core's hourly billing job reads its own usage table before calling Stripe and the app stores. Telemetry batches land in S3.
- Threads and memories are DynamoDB global tables, so a person who fails over keeps their history. Accounts live in two Aurora Global Databases, one writer per core region with readers in its edges.
What each part does
- Web search API
- A search provider's API for answers that need fresh facts, about one message in twenty.
- Stripe
- Web subscriptions, invoices and team plans.
- App Store and Play
- Apple's App Store and Google Play, which bill subscriptions bought inside the phone apps.
- People · N. Virginia
- 26,000 requests a second from the web, desktop and phone apps near N. Virginia.
- Route 53 · N. Virginia
- Latency routing keeps people near N. Virginia in this region and sends them to Oregon when its health checks fail.
- CloudFront edge
- Serves the web app's scripts, styles and images from the nearest edge; 98% never reach the origin bucket.
- Chat streaming
- One streamed request per message, open for the 3 seconds the model takes to answer. Async servers hold a connection, not a thread, so CPU is the limit; it is a custom part because the palette's API server blocks a thread per request. Assumes 1,000 open streams a second per c7g.xlarge, half the catalogue's API rule of thumb, because every token is relayed to the client.
- Threads API
- The sidebar, opening an old chat, renaming and sharing, all from the local replica.
- Sync API
- Phones, desktops and open tabs asking what changed since their last cursor, so a chat started on one device shows up on the others.
- Account API
- Settings, saved memories and profile. Reads stay local; the rare account change goes to the writer in N. Virginia.
- File upload API
- Checks the plan and stores each part of an uploaded file. About one request in five completes a file and queues it for indexing.
- Telemetry ingest
- Batched client events: errors, timings and feedback thumbs.
- Model quota A
- A fifth of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota B
- A fifth of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota C
- A fifth of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota D
- A fifth of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota E
- A fifth of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Query embeddings
- Turns the question into a vector when a chat has files or a project attached, about one message in ten.
- Plan limits
- Checks the person's message window before every message and upload. Other calls verify the signed session token in process and never come here.
- Safety classifier
- Classifies every new user message before the model sees it. Assumes a distilled text classifier on CPU doing 100 short checks a second per vCPU, 800 per c7g.2xlarge, in about 40 ms.
- Limit counters
- Message-window counters, three nodes across three AZs, 98% hits. A miss falls back to the usage-window table.
- Accounts reader
- Aurora Global Database reader for plan, settings and profile reads, replicated from the writer in N. Virginia.
- Usage windows
- Durable message-window counts, a DynamoDB global table. Every counted message is written here, so a Redis node loss or a failover doesn't reset anyone's window.
- Thread store
- Every chat's messages, a DynamoDB global table replicated to every region, so a person who fails over keeps their history.
- Saved memories
- Facts the person asked the assistant to remember, read before every answer and updated when they add or delete one. A DynamoDB global table.
- Device sync feed
- Per-device change cursors, a table of its own so sync's steady polling stays off the thread store.
- File vectors
- OpenSearch k-NN index of every uploaded file's chunks for N. Virginia, Oregon and Tokyo. Edge regions call it for file search, one message in ten.
- Chat history search
- Full-text search over past chats for N. Virginia, Oregon and Tokyo.
- Accounts writer
- Aurora Global Database writer for accounts whose home is N. Virginia, Oregon and Tokyo. Every reader in the group replicates from it.
- Uploaded files
- The original uploaded files from N. Virginia, Oregon and Tokyo, kept for re-indexing and download.
- Hourly billing run
- Starts the hourly billing job in the region that holds the usage it reads, so billing never reads across an ocean.
- File ingest queue
- One message per batch of chunks, so a burst of uploads waits here instead of hitting the embedding quota.
- File ingest workers
- Read the uploaded file, embed a batch of chunks and write them to the vector index.
- Chunk embeddings
- Embeds document chunks while files are indexed, on its own quota so a big upload never slows query embeddings.
- Billing sync
- Reads usage per account, renews web subscriptions in Stripe and checks app-store subscriptions. Three workers, so losing an AZ only slows the run.
- Usage events
- Usage records from every chat server in N. Virginia, Oregon and Tokyo, read by the rollups.
- Usage rollups
- Sums messages and tokens per account per minute for billing and the usage page.
- Usage per account
- Per-account usage totals that the billing job reads.
- Client telemetry
- About 3,888 telemetry batches a second from N. Virginia, Oregon and Tokyo, on their own stream so a flood of events can never delay usage records.
- Telemetry archiver
- Batches telemetry into large S3 objects for dashboards and model evals.
- Telemetry archive
- Raw client events kept for audits and evals.
- Web app origin
- Origin bucket for the web app behind every CloudFront edge.
- People · Oregon
- 16,000 requests a second from the web, desktop and phone apps near Oregon.
- Route 53 · Oregon
- Latency routing keeps people near Oregon in this region and sends them to N. Virginia when its health checks fail.
- CloudFront edge
- Serves the web app's scripts, styles and images from the nearest edge; 98% never reach the origin bucket.
- Chat streaming
- One streamed request per message, open for the 3 seconds the model takes to answer. Async servers hold a connection, not a thread, so CPU is the limit; it is a custom part because the palette's API server blocks a thread per request. Assumes 1,000 open streams a second per c7g.xlarge, half the catalogue's API rule of thumb, because every token is relayed to the client. Usage records and file searches go to N. Virginia.
- Threads API
- The sidebar, opening an old chat, renaming and sharing, all from the local replica. The rare search over past chats goes to N. Virginia.
- Sync API
- Phones, desktops and open tabs asking what changed since their last cursor, so a chat started on one device shows up on the others.
- Account API
- Settings, saved memories and profile. Reads stay local; the rare account change goes to the writer in N. Virginia.
- File upload API
- Checks the plan, then stores each part of an uploaded file in N. Virginia, where indexing runs. About one request in five completes a file and queues it.
- Telemetry ingest
- Batched client events: errors, timings and feedback thumbs, forwarded to the telemetry stream in N. Virginia.
- Model quota A
- A fifth of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota B
- A fifth of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota C
- A fifth of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota D
- A fifth of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota E
- A fifth of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Query embeddings
- Turns the question into a vector when a chat has files or a project attached, about one message in ten.
- Plan limits
- Checks the person's message window before every message and upload. Other calls verify the signed session token in process and never come here.
- Safety classifier
- Classifies every new user message before the model sees it. Assumes a distilled text classifier on CPU doing 100 short checks a second per vCPU, 800 per c7g.2xlarge, in about 40 ms.
- Limit counters
- Message-window counters, three nodes across three AZs, 98% hits. A miss falls back to the usage-window table.
- Accounts reader
- Aurora Global Database reader for plan, settings and profile reads, replicated from the writer in N. Virginia.
- Usage windows
- Durable message-window counts, a DynamoDB global table. Every counted message is written here, so a Redis node loss or a failover doesn't reset anyone's window.
- Thread store
- Every chat's messages, a DynamoDB global table replicated to every region, so a person who fails over keeps their history.
- Saved memories
- Facts the person asked the assistant to remember, read before every answer and updated when they add or delete one. A DynamoDB global table.
- Device sync feed
- Per-device change cursors, a table of its own so sync's steady polling stays off the thread store.
- People · Tokyo
- 12,000 requests a second from the web, desktop and phone apps near Tokyo.
- Route 53 · Tokyo
- Latency routing keeps people near Tokyo in this region and sends them to Mumbai when its health checks fail.
- CloudFront edge
- Serves the web app's scripts, styles and images from the nearest edge; 98% never reach the origin bucket.
- Chat streaming
- One streamed request per message, open for the 3 seconds the model takes to answer. Async servers hold a connection, not a thread, so CPU is the limit; it is a custom part because the palette's API server blocks a thread per request. Assumes 1,000 open streams a second per c7g.xlarge, half the catalogue's API rule of thumb, because every token is relayed to the client. Usage records and file searches go to N. Virginia.
- Threads API
- The sidebar, opening an old chat, renaming and sharing, all from the local replica. The rare search over past chats goes to N. Virginia.
- Sync API
- Phones, desktops and open tabs asking what changed since their last cursor, so a chat started on one device shows up on the others.
- Account API
- Settings, saved memories and profile. Reads stay local; the rare account change goes to the writer in N. Virginia.
- File upload API
- Checks the plan, then stores each part of an uploaded file in N. Virginia, where indexing runs. About one request in five completes a file and queues it.
- Telemetry ingest
- Batched client events: errors, timings and feedback thumbs, forwarded to the telemetry stream in N. Virginia.
- Model quota A
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota B
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota C
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota D
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Query embeddings
- Turns the question into a vector when a chat has files or a project attached, about one message in ten.
- Plan limits
- Checks the person's message window before every message and upload. Other calls verify the signed session token in process and never come here.
- Safety classifier
- Classifies every new user message before the model sees it. Assumes a distilled text classifier on CPU doing 100 short checks a second per vCPU, 800 per c7g.2xlarge, in about 40 ms.
- Limit counters
- Message-window counters, three nodes across three AZs, 98% hits. A miss falls back to the usage-window table.
- Accounts reader
- Aurora Global Database reader for plan, settings and profile reads, replicated from the writer in N. Virginia.
- Usage windows
- Durable message-window counts, a DynamoDB global table. Every counted message is written here, so a Redis node loss or a failover doesn't reset anyone's window.
- Thread store
- Every chat's messages, a DynamoDB global table replicated to every region, so a person who fails over keeps their history.
- Saved memories
- Facts the person asked the assistant to remember, read before every answer and updated when they add or delete one. A DynamoDB global table.
- Device sync feed
- Per-device change cursors, a table of its own so sync's steady polling stays off the thread store.
- People · Ireland
- 17,000 requests a second from the web, desktop and phone apps near Ireland.
- Route 53 · Ireland
- Latency routing keeps people near Ireland in this region and sends them to Frankfurt when its health checks fail.
- CloudFront edge
- Serves the web app's scripts, styles and images from the nearest edge; 98% never reach the origin bucket.
- Chat streaming
- One streamed request per message, open for the 3 seconds the model takes to answer. Async servers hold a connection, not a thread, so CPU is the limit; it is a custom part because the palette's API server blocks a thread per request. Assumes 1,000 open streams a second per c7g.xlarge, half the catalogue's API rule of thumb, because every token is relayed to the client.
- Threads API
- The sidebar, opening an old chat, renaming and sharing, all from the local replica.
- Sync API
- Phones, desktops and open tabs asking what changed since their last cursor, so a chat started on one device shows up on the others.
- Account API
- Settings, saved memories and profile. Reads stay local; the rare account change goes to the writer in Ireland.
- File upload API
- Checks the plan and stores each part of an uploaded file. About one request in five completes a file and queues it for indexing.
- Telemetry ingest
- Batched client events: errors, timings and feedback thumbs.
- Model quota A
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota B
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota C
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota D
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Query embeddings
- Turns the question into a vector when a chat has files or a project attached, about one message in ten.
- Plan limits
- Checks the person's message window before every message and upload. Other calls verify the signed session token in process and never come here.
- Safety classifier
- Classifies every new user message before the model sees it. Assumes a distilled text classifier on CPU doing 100 short checks a second per vCPU, 800 per c7g.2xlarge, in about 40 ms.
- Limit counters
- Message-window counters, three nodes across three AZs, 98% hits. A miss falls back to the usage-window table.
- Accounts reader
- Aurora Global Database reader for plan, settings and profile reads, replicated from the writer in Ireland.
- Usage windows
- Durable message-window counts, a DynamoDB global table. Every counted message is written here, so a Redis node loss or a failover doesn't reset anyone's window.
- Thread store
- Every chat's messages, a DynamoDB global table replicated to every region, so a person who fails over keeps their history.
- Saved memories
- Facts the person asked the assistant to remember, read before every answer and updated when they add or delete one. A DynamoDB global table.
- Device sync feed
- Per-device change cursors, a table of its own so sync's steady polling stays off the thread store.
- File vectors
- OpenSearch k-NN index of every uploaded file's chunks for Ireland, Frankfurt and Mumbai. Edge regions call it for file search, one message in ten.
- Chat history search
- Full-text search over past chats for Ireland, Frankfurt and Mumbai.
- Accounts writer
- Aurora Global Database writer for accounts whose home is Ireland, Frankfurt and Mumbai. Every reader in the group replicates from it.
- Uploaded files
- The original uploaded files from Ireland, Frankfurt and Mumbai, kept for re-indexing and download.
- Hourly billing run
- Starts the hourly billing job in the region that holds the usage it reads, so billing never reads across an ocean.
- File ingest queue
- One message per batch of chunks, so a burst of uploads waits here instead of hitting the embedding quota.
- File ingest workers
- Read the uploaded file, embed a batch of chunks and write them to the vector index.
- Chunk embeddings
- Embeds document chunks while files are indexed, on its own quota so a big upload never slows query embeddings.
- Billing sync
- Reads usage per account, renews web subscriptions in Stripe and checks app-store subscriptions. Three workers, so losing an AZ only slows the run.
- Usage events
- Usage records from every chat server in Ireland, Frankfurt and Mumbai, read by the rollups.
- Usage rollups
- Sums messages and tokens per account per minute for billing and the usage page.
- Usage per account
- Per-account usage totals that the billing job reads.
- Client telemetry
- About 3,312 telemetry batches a second from Ireland, Frankfurt and Mumbai, on their own stream so a flood of events can never delay usage records.
- Telemetry archiver
- Batches telemetry into large S3 objects for dashboards and model evals.
- Telemetry archive
- Raw client events kept for audits and evals.
- People · Frankfurt
- 15,000 requests a second from the web, desktop and phone apps near Frankfurt.
- Route 53 · Frankfurt
- Latency routing keeps people near Frankfurt in this region and sends them to Ireland when its health checks fail.
- CloudFront edge
- Serves the web app's scripts, styles and images from the nearest edge; 98% never reach the origin bucket.
- Chat streaming
- One streamed request per message, open for the 3 seconds the model takes to answer. Async servers hold a connection, not a thread, so CPU is the limit; it is a custom part because the palette's API server blocks a thread per request. Assumes 1,000 open streams a second per c7g.xlarge, half the catalogue's API rule of thumb, because every token is relayed to the client. Usage records and file searches go to Ireland.
- Threads API
- The sidebar, opening an old chat, renaming and sharing, all from the local replica. The rare search over past chats goes to Ireland.
- Sync API
- Phones, desktops and open tabs asking what changed since their last cursor, so a chat started on one device shows up on the others.
- Account API
- Settings, saved memories and profile. Reads stay local; the rare account change goes to the writer in Ireland.
- File upload API
- Checks the plan, then stores each part of an uploaded file in Ireland, where indexing runs. About one request in five completes a file and queues it.
- Telemetry ingest
- Batched client events: errors, timings and feedback thumbs, forwarded to the telemetry stream in Ireland.
- Model quota A
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota B
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota C
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota D
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Query embeddings
- Turns the question into a vector when a chat has files or a project attached, about one message in ten.
- Plan limits
- Checks the person's message window before every message and upload. Other calls verify the signed session token in process and never come here.
- Safety classifier
- Classifies every new user message before the model sees it. Assumes a distilled text classifier on CPU doing 100 short checks a second per vCPU, 800 per c7g.2xlarge, in about 40 ms.
- Limit counters
- Message-window counters, three nodes across three AZs, 98% hits. A miss falls back to the usage-window table.
- Accounts reader
- Aurora Global Database reader for plan, settings and profile reads, replicated from the writer in Ireland.
- Usage windows
- Durable message-window counts, a DynamoDB global table. Every counted message is written here, so a Redis node loss or a failover doesn't reset anyone's window.
- Thread store
- Every chat's messages, a DynamoDB global table replicated to every region, so a person who fails over keeps their history.
- Saved memories
- Facts the person asked the assistant to remember, read before every answer and updated when they add or delete one. A DynamoDB global table.
- Device sync feed
- Per-device change cursors, a table of its own so sync's steady polling stays off the thread store.
- People · Mumbai
- 14,000 requests a second from the web, desktop and phone apps near Mumbai.
- Route 53 · Mumbai
- Latency routing keeps people near Mumbai in this region and sends them to Tokyo when its health checks fail.
- CloudFront edge
- Serves the web app's scripts, styles and images from the nearest edge; 98% never reach the origin bucket.
- Chat streaming
- One streamed request per message, open for the 3 seconds the model takes to answer. Async servers hold a connection, not a thread, so CPU is the limit; it is a custom part because the palette's API server blocks a thread per request. Assumes 1,000 open streams a second per c7g.xlarge, half the catalogue's API rule of thumb, because every token is relayed to the client. Usage records and file searches go to Ireland.
- Threads API
- The sidebar, opening an old chat, renaming and sharing, all from the local replica. The rare search over past chats goes to Ireland.
- Sync API
- Phones, desktops and open tabs asking what changed since their last cursor, so a chat started on one device shows up on the others.
- Account API
- Settings, saved memories and profile. Reads stay local; the rare account change goes to the writer in Ireland.
- File upload API
- Checks the plan, then stores each part of an uploaded file in Ireland, where indexing runs. About one request in five completes a file and queues it.
- Telemetry ingest
- Batched client events: errors, timings and feedback thumbs, forwarded to the telemetry stream in Ireland.
- Model quota A
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota B
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota C
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Model quota D
- A quarter of this region's chat answers on a 200M tokens-per-minute quota. Quota is paid per token used, so the spare room for a failover costs nothing.
- Query embeddings
- Turns the question into a vector when a chat has files or a project attached, about one message in ten.
- Plan limits
- Checks the person's message window before every message and upload. Other calls verify the signed session token in process and never come here.
- Safety classifier
- Classifies every new user message before the model sees it. Assumes a distilled text classifier on CPU doing 100 short checks a second per vCPU, 800 per c7g.2xlarge, in about 40 ms.
- Limit counters
- Message-window counters, three nodes across three AZs, 98% hits. A miss falls back to the usage-window table.
- Accounts reader
- Aurora Global Database reader for plan, settings and profile reads, replicated from the writer in Ireland.
- Usage windows
- Durable message-window counts, a DynamoDB global table. Every counted message is written here, so a Redis node loss or a failover doesn't reset anyone's window.
- Thread store
- Every chat's messages, a DynamoDB global table replicated to every region, so a person who fails over keeps their history.
- Saved memories
- Facts the person asked the assistant to remember, read before every answer and updated when they add or delete one. A DynamoDB global table.
- Device sync feed
- Per-device change cursors, a table of its own so sync's steady polling stays off the thread store.
What breaks first
The five model quotas in N. Virginia, at about 3.2x. They are a hard wall; the servers around them either autoscale or were sized with more room.
At 5x the N. Virginia quotas reject about a third of that region's messages. Next to go are N. Virginia's usage and telemetry stream shards, which carry the whole group's records, and Ireland's quotas. Raising a quota takes a request to the provider, so the fixes are planned ahead: more quotas, which cost nothing until used; cross-region inference to borrow another region's capacity; prompt caching and shorter context to cut tokens per message; and an honest 'busy, try again' for free users so paying ones keep their answers.
The simulator checks this every build: it runs the design at 100,010 req/s, then ramps traffic to 5x (500,050 req/s) and records which part fails first. In the playground, press Break it to watch the same thing happen.
Trade-offs
What it gets right
- A failed region's traffic moves to its partner with no errors. The busiest survivor is N. Virginia or Oregon covering for the other, with model quotas at 48%.
- Edges aren't copies of the core. Four of the six regions run no streams, queues or batch workers, and hold only table replicas, a Redis counter cache and an Aurora reader, so there are two of each pipeline to run, not six.
- Batch work runs where its data lives: billing reads usage in its own region and indexing reads files in its own region, so no scheduled job reads across an ocean.
- Model quota is billed per token used, so the spare quota each region keeps for its partner costs nothing.
- Every request path has at least two instances behind a load balancer or a managed service spread across zones, so losing an availability zone fails 0.07% of requests.
What it costs you
- Tokens are 99.5% of the roughly $29.5 million monthly bill. Servers, databases, streams and the CDN together cost about $158,000.
- Edges send usage, telemetry, uploads and file searches across regions, so they pay a round trip (about 150 ms from Tokyo to N. Virginia) and inter-region transfer. Edge telemetry servers hold a thread for that round trip, so they run more servers than their CPU needs.
- A full core-region outage leaves its edges serving chats, but their usage records, telemetry and uploads have nowhere to go until it recovers. The region-down test here only removes a load balancer, so it doesn't show that.
- When Mumbai fails over to Tokyo, its usage records land in N. Virginia, so the two billing jobs have to merge usage by account.
- Global tables copy every chat to all six regions. A strict EU-residency promise needs EU-only tables, which this design doesn't have.
- Losing an availability zone fails the file-indexing and billing jobs running there, about 0.07% of requests. They have to be retried from the queue.
In the real world
- ChatGPT's memory saves facts you ask it to remember and uses them in later chats; you can see and delete them in settings.
- Claude's Projects keep uploaded documents as shared context across every chat in the project.
- Amazon Bedrock's cross-region inference sends requests to other regions when one region's capacity is busy.
- DynamoDB global tables replicate a table to every region you choose, and each replica accepts writes, which is what lets a person's history follow them to the partner region.
In the interview
- Start with the token arithmetic: messages a second times tokens per message is both your quota and your bill. Size the servers last.
- Split what every region needs to answer a request from what needs to run once per data set, and put batch jobs next to the data they read.
- Pair regions and size each for the partner it absorbs, then prove it: fail a region and read the partner's busiest part.
- Name the parts that can't autoscale (model quotas, stream shards, search nodes, a classifier fleet) and give them headroom on day one.
Run it yourself
The playground opens this design with 100,010 requests a second already flowing. Press Break it, or change one part yourself, and watch which number goes first.
Read the walkthrough: Design an AI Agent System
Questions people ask
How does Global AI assistant work at the system design level?
Regions have two jobs. N. Virginia and Ireland are core: they serve chats and run everything that writes or batches. Oregon and Tokyo send their background work to N. Virginia; Frankfurt and Mumbai send theirs to Ireland. Edges carry only what a request needs: load balancer, chat servers, safety, plan limits, model quotas and read replicas. Route 53 sends each person to the nearest region and fails over in pairs: N. Virginia and Oregon, Ireland and Frankfurt, Mumbai and Tokyo. Each region is sized for its own peak or for its partner's traffic on top of its own, whichever is bigger, so Oregon is built for more than its own users. A message is one streamed request. The chat server checks the message window in Redis, which falls back to a DynamoDB table that also takes every count. It runs the safety classifier, reads saved memories and the thread, streams the answer from a local model quota and sends a usage record to its core region's stream. One message in ten has files attached: the question is embedded locally and the core region's file index searched. One in twenty calls a web search API for fresh facts. Chats are under a tenth of the traffic. Most requests are the sidebar, opening old threads and devices polling for changes, all answered from local replicas. Sync reads its own table, so the thread store stays well under its per-table throughput limit. The chat servers are async. A 3-second answer holds a connection, not a thread, so CPU is the limit. A thread-per-request API tier would run out of threads long before CPU. Background work runs next to its data. Uploads land in the core region's S3 bucket and queue, where workers embed the chunks on their own quota. Usage records feed Flink rollups, and each core's hourly billing job reads its own usage table before calling Stripe and the app stores. Telemetry batches land in S3. Threads and memories are DynamoDB global tables, so a person who fails over keeps their history. Accounts live in two Aurora Global Databases, one writer per core region with readers in its edges.
What breaks first in a Global AI assistant design?
The five model quotas in N. Virginia, at about 3.2x. They are a hard wall; the servers around them either autoscale or were sized with more room. At 5x the N. Virginia quotas reject about a third of that region's messages. Next to go are N. Virginia's usage and telemetry stream shards, which carry the whole group's records, and Ireland's quotas. Raising a quota takes a request to the provider, so the fixes are planned ahead: more quotas, which cost nothing until used; cross-region inference to borrow another region's capacity; prompt caching and shorter context to cut tokens per message; and an honest 'busy, try again' for free users so paying ones keep their answers.
What are the trade-offs of this Global AI assistant architecture?
A failed region's traffic moves to its partner with no errors. The busiest survivor is N. Virginia or Oregon covering for the other, with model quotas at 48%. Edges aren't copies of the core. Four of the six regions run no streams, queues or batch workers, and hold only table replicas, a Redis counter cache and an Aurora reader, so there are two of each pipeline to run, not six. Batch work runs where its data lives: billing reads usage in its own region and indexing reads files in its own region, so no scheduled job reads across an ocean. Model quota is billed per token used, so the spare quota each region keeps for its partner costs nothing. Every request path has at least two instances behind a load balancer or a managed service spread across zones, so losing an availability zone fails 0.07% of requests. Tokens are 99.5% of the roughly $29.5 million monthly bill. Servers, databases, streams and the CDN together cost about $158,000. Edges send usage, telemetry, uploads and file searches across regions, so they pay a round trip (about 150 ms from Tokyo to N. Virginia) and inter-region transfer. Edge telemetry servers hold a thread for that round trip, so they run more servers than their CPU needs. A full core-region outage leaves its edges serving chats, but their usage records, telemetry and uploads have nowhere to go until it recovers. The region-down test here only removes a load balancer, so it doesn't show that. When Mumbai fails over to Tokyo, its usage records land in N. Virginia, so the two billing jobs have to merge usage by account. Global tables copy every chat to all six regions. A strict EU-residency promise needs EU-only tables, which this design doesn't have. Losing an availability zone fails the file-indexing and billing jobs running there, about 0.07% of requests. They have to be retried from the queue.
What do interviewers look for in a Global AI assistant system design answer?
Start with the token arithmetic: messages a second times tokens per message is both your quota and your bill. Size the servers last. Split what every region needs to answer a request from what needs to run once per data set, and put batch jobs next to the data they read. Pair regions and size each for the partner it absorbs, then prove it: fail a region and read the partner's busiest part. Name the parts that can't autoscale (model quotas, stream shards, search nodes, a classifier fleet) and give them headroom on day one.