Who uses it?
- Regular users
- Administrators
- Human reviewers
- Other systems
- Background jobs
System design interview · practical field guide
You do not need to sound complicated. Move from the problem to the big picture, then prove one hard part works. This page gives you the order, the questions, the math, and the exact words to use.
“Let me restate the problem. We are building ___ for ___ so they can ___.”
“Which three or four features should I focus on?”
Say what you will not design: payments, login, mobile apps, advanced reports, or internal tools.
“Must users see an update immediately, or is a short delay okay?”
This choice changes how much coordination your system needs.
requests/sec = daily users × actions/day ÷ 86,400Sizes the API and database.
peak requests/sec = average × 3 to 10Capacity must handle the busy period.
read traffic = total traffic × read %Heavy reads may benefit from a cache or read copies.
write traffic = total traffic × write %Heavy writes may force data splitting.
storage = items × bytes/item × retention × copiesInclude indexes and backups.
bandwidth = requests/sec × bytes/requestLarge uploads may make the network the limit.
work in progress = jobs/sec × seconds/jobEstimates workers and open connections.
review hours = cases × review rate × min/case ÷ 60People may be the real limit.
“This tells me ___. Therefore, I would ___.”
“I’ll focus on ___. Peak traffic is about ___. Writes must ___. ___ may be slightly delayed. I’ll leave ___ outside the scope.”
Draw who starts work and the providers your system calls.
Receive the request, check identity, apply limits, and route it.
Start with one application. Split a responsibility only if it must scale, deploy, or fail separately.
Store the information your system considers correct: users, orders, cases, payments, decisions, status.
Use for images, videos, documents, backups, and large generated results.
Use for slow work: processing, email, AI calls, reports, and slow providers.
Add only for repeated reads. Name the key, lifetime, stale behavior, and fallback.
Add only when database queries cannot handle full text, complex filters, similarity, or location.
Show timeouts, safe retries, and provider limits.
Quick architecture choices
| Choice | Use it when | Cost |
|---|---|---|
| One application | Parts can scale and release together | Less freedom later |
| Separate services | Parts must scale, release, or fail alone | More network and operational work |
| Direct call | The work is quick and the user needs the result now | Caller waits; failures spread |
| Queue | The work is slow or can finish later | Delayed result; duplicates are possible |
| Redis cache | Many requests read the same data | May be stale; must be rebuildable |
“The client sends a request. The API checks access. The application validates it and saves the official record. Slow work enters a queue. A worker processes it, saves the result, and the client reads the new status.”
POST /submissions
GET /submissions/{id}
POST /submissions/{id}/complete
GET /cases/{id}
POST /review-tasks/{id}/claim
POST /decisionsAdd pagination. Return a cursor that points to the next page.
Accept a unique retry key so a repeated request does not create two payments, orders, or decisions.
Require the record version: “Update only if this case is still version 7.”
Response choice
| Style | Best when | Trade-off |
|---|---|---|
| Return result | Work is fast and predictable | Request stays open |
| Return job ID | Work is slow or failure-prone | Client must check status |
User · Submission · Document · Case · Review task · Decision
ID · customer ID · current state · version · created time · updated time · relationships
Case by ID · pending tasks for a reviewer · documents in a submission · evidence behind a decision
Finish upload · send case to review · claim task · publish decision
“These records have clear relationships and important updates, so I would begin with a relational database.”
Say which copies may be slightly old. If two copies disagree, name which one wins.
Quick database choices
| Choice | Pick it when | Watch out for |
|---|---|---|
| PostgreSQL | Related records and safe updates | Scaling writes takes planning |
| DynamoDB | Huge traffic; known key lookups | Changing queries are harder |
| MongoDB | Records are flexible documents | Relationships become harder |
| Redis | Tiny, key-based data needs extreme speed | RAM cost, limited queries, careful durability |
| Choice | Pick it when | Watch out for |
|---|---|---|
| Postgres search | Search is simple | Limited ranking and typo handling |
| OpenSearch | Advanced text, filters, ranking | Another system; results may lag |
| PostGIS | Nearby or area search | Only solves location search |
| pgvector | AI similarity search at moderate scale | Measure before very large scale |
Default: PostgreSQL holds the official data. Redis is usually a rebuildable cache. Add a separate search database only when PostgreSQL search is not enough.
Quick AI choices
An embedding is a list of numbers that represents meaning. A vector database finds items with similar embeddings; it does not replace the official database.
| Choice | Pick it when | Main cost |
|---|---|---|
| pgvector | PostgreSQL already exists; start simple | Shares resources with normal database work |
| Pinecone | Want a managed service with little operations work | Vendor dependency and recurring cost |
| Qdrant | Want focused open-source vector search | Another database to run and synchronize |
| Weaviate | Want objects, vectors, and AI integrations together | More concepts and moving parts |
| Milvus | Vector search is central and extremely large | More infrastructure and operational work |
| Redis | Already use Redis and need very low latency | Memory cost; not the official document store |
| OpenSearch | Need keywords, filters, and vectors together | Heavy if vector search is the only need |
| Choice | Pick it when | Watch out for |
|---|---|---|
| Prompt only | Task is simple and facts are already supplied | Less control and grounding |
| Retrieval (RAG) | Facts change or answers need citations | Bad retrieval produces bad context |
| Fine-tuning | Need repeated behavior, style, or format | Needs training data and release testing |
| Human review | A wrong answer has a high cost | Slower and limited by reviewer capacity |
| Choice | Pick it when | Watch out for |
|---|---|---|
| One model | Start simple; one quality level is enough | May overpay for easy work |
| Model routing | Tasks need different cost, speed, or quality | Every route needs separate evaluation |
| Fallback model | Availability matters more than identical output | Behavior and quality can change |
| Choice | Pick it when | Watch out for |
|---|---|---|
| Save evidence | Need audit, debugging, or review | Storage and privacy cost |
| Cache output | Same safe input repeats often | Stale or sensitive answers may be reused |
| Generate again | Freshness matters and variation is acceptable | Higher cost and different answers |
Strong default: Start without vectors. Add pgvector when meaning-based search clearly helps. Use retrieval for changing facts, fine-tuning for repeated behavior, and human approval when a wrong result is expensive.
What user action or outside event begins the work?
Which component receives it and checks it?
What existing data is needed?
What official state changes?
What happens immediately? What happens later?
What happens if this step does not finish?
“The hard part is ___. For example, ___. I would solve it by ___. The trade-off is ___.”
Freshness choice
| Choice | Use it for | Cost |
|---|---|---|
| Immediate | Money, ownership, approvals | More waiting and coordination |
| Short delay | Search, analytics, notifications | Users may briefly see old data |
| Failure to test | What you must answer |
|---|---|
| The client sends the same request twice | How do we recognize it? Does the second call return the first result? |
| A worker crashes halfway through | Where was progress saved? Can another worker continue? |
| The queue sends the same job twice | Can processing twice change the result twice? |
| A provider finishes but the response times out | Can we look up the provider’s result before trying again? |
| Two users update one record | Does a version check reject the older update? |
| The database is unavailable | Do we fail, wait, or accept only work we can save safely? |
| One region fails | Who takes over? Could two regions both think they are in charge? |
| A job always fails | What is the retry limit? Where does a person see it? |
Retry choice
| Choice | Use it when | Risk |
|---|---|---|
| Retry automatically | Failure is temporary and duplicates are blocked | Can overload a sick system |
| Stop and review | Result is unknown or failure repeats | Slower; needs a person |
“How do we detect it? Is retrying safe? Where is progress saved? When do we stop retrying? When does a person step in?”
“The server finds the customer from the signed-in user. It never trusts a customer ID from the browser without checking it.”
Database growth choices
| Choice | Helps with | Cost |
|---|---|---|
| Bigger server | Early read and write growth | Has a limit |
| Read copies | Heavy reads | May briefly return old data |
| Split data | Writes or data exceed one database | Harder queries and operations |
“To summarize, we are building ___ for ___. The API handles ___. The official state is stored in ___. Slow work goes through ___ and is handled by ___. The main safety mechanism is ___. The system scales by ___. The main trade-off is ___, which is acceptable because ___.”
Use only when the interviewer goes deeper
The interview still follows the ten steps above. This bottom section is a lookup tool. Do not force every idea into every answer.
First name the read you need. Then choose the smallest change that makes that read fast enough.
| Choice | Use it when | Main cost |
|---|---|---|
| Normal index | You filter or sort by known fields | More storage; writes become a little slower |
| Read copy | Reads are much heavier than writes | It may briefly show old data |
| Split the data | One database cannot hold or write everything | Queries across splits become harder |
| Saved result view | The same expensive result is requested often | The saved result must be refreshed |
A queue lets the API accept work quickly and lets workers finish it later.
| Choice | What it means | Use it when |
|---|---|---|
| At most once | A job may be lost, but it is not repeated | Losing the work is harmless |
| At least once | A job is not lost, but it may arrive twice | The worker can safely recognize repeats |
| One business result | Repeats may arrive, but only one result is saved | Use a stable job ID and a database uniqueness rule |
| Ordered | Jobs with the same key are handled in order | Order matters more than maximum speed |
A cache is a fast copy. The system should still be correct if the cache is empty or unavailable.
| Problem | Simple response | Why |
|---|---|---|
| Old value | Use an expiry time and remove changed entries | Limits how long old data survives |
| Missing value | Read the main database, then fill the cache | The main database still owns the truth |
| Many requests miss together | Let one request refill while others wait briefly | Protects the database from a sudden rush |
| One very popular key | Copy it locally or spread the load | One cache machine should not take all traffic |
| Cache is down | Fall back to the database and limit traffic | The cache improves speed, not correctness |
| Choice | Best for | Main cost |
|---|---|---|
| Polling | Simple, occasional status checks | Extra requests; updates arrive late |
| Long polling | Updates should feel quick but are uncommon | Connections stay open longer |
| Server-sent events | The server continuously sends updates to the browser | Mostly one-way |
| WebSocket | Frequent two-way messages, such as chat or live editing | More connection and recovery work |
| Webhook | One server tells another server that something happened | Must verify sender and handle repeats |
Recovery time objective: how long the service may take to come back.
Recovery point objective: how much recent data may be lost.
“RTO is one hour. RPO is five minutes. We test restoring backups and switching regions.”
Approximate downtime per year
| Situation | Use | Plain meaning |
|---|---|---|
| Several records in one database | Database transaction | Save all changes or save none |
| Save data, then publish a message | Outbox record | Save the business change and “message to send” together |
| Several independent services | Steps with undo actions | If a later step fails, reverse earlier work where possible |
| Provider timed out | Look up by stable request ID | Find whether it already finished before trying again |
| Two people update one item | Expected version check | Reject an update based on an older copy |
| Choice | Pick it when | Main cost |
|---|---|---|
| Database number | One main database creates the records | Harder to create independently in many places |
| UUID | Many machines create records independently | Larger and less friendly to database indexes |
| Time-sortable ID | You want distributed IDs that roughly sort by time | Time order is not the same as cause-and-effect order |
| Dedicated ID service | Extreme distributed scale requires compact IDs | Another important service to operate |
Treat AI output as a proposed result. Decide when software may accept it, when it must show evidence, and when a person must approve it.
These are starting points, not rules. Explain the requirement first, then name the component.