Backend interviews rarely stop at a coding puzzle. Once you pass the algorithm round, most loops include at least one conversation about how real services behave: how an API should look, why a query is slow, when a cache helps and when it hurts, and what happens when two requests touch the same row at the same time.
These questions are hard to cram because there is no single right answer. Interviewers want to hear how you reason about trade offs, and whether you have actually run something in production. The good news is that the same few areas come up again and again. If you can talk clearly about APIs, databases, caching and concurrency, you will be ready for most of what a backend loop throws at you.
This guide walks through each area with typical questions, what a strong answer covers, and the mistakes that cost candidates points. It ends with a checklist and a one week plan.
How backend interviews are usually structured
Most backend loops mix three kinds of rounds:
- Coding. Data structures and algorithms, sometimes with a practical twist such as parsing logs or building a rate limiter. Our coding interview patterns post covers the common shapes.
- System design. A larger open problem such as a URL shortener, a notification service or a feed. See the system design interview guide for a framework.
- Backend fundamentals. A conversation, often with a senior engineer, that goes deep on the topics below. Sometimes it is folded into the design round, sometimes it is its own session.
Some companies replace the coding round with a take home task, usually a small API. The take home guide explains how to scope one without losing a weekend.
API design questions
Typical questions
- How would you design a REST API for orders, including creating, updating and cancelling them?
- What is the difference between PUT and PATCH? When is a request idempotent?
- How do you version an API without breaking existing clients?
- How would you paginate a list endpoint that returns millions of rows?
- REST, GraphQL or gRPC: how do you choose?
What interviewers listen for
A strong answer starts with the resources and the clients, not the framework. Name the nouns, the operations on them, and who calls the API. Then cover the details that show experience:
- Status codes that mean something. 400 for bad input, 401 versus 403, 404, 409 for conflicts, 429 for rate limits.
- Idempotency. GET, PUT and DELETE should be safe to retry. For POST, explain idempotency keys so a client retry after a timeout does not create a duplicate order.
- Pagination. Offset pagination is simple but gets slow and skips rows when data changes. Cursor pagination based on a stable sort key is the usual answer for large tables.
- Versioning and compatibility. Adding optional fields is safe, removing or renaming them is not. Mention a version in the path or a header, and a deprecation period.
- Errors. A consistent error body with a machine readable code helps clients far more than a free text message.
Database questions
Typical questions
- When would you choose a relational database over a document store?
- Explain how an index works. Why might adding one make writes slower?
- A query got slow after the table grew. How do you investigate?
- What are transaction isolation levels, and what anomalies does each prevent?
- How would you shard or partition a table that no longer fits on one machine?
What interviewers listen for
For the SQL versus NoSQL question, avoid slogans. Talk about the shape of the data, the queries you need, consistency requirements, and what the team already knows how to operate. A relational database is a reasonable default for most business data because of transactions and flexible querying.
For indexes, explain that a typical B tree index keeps sorted keys so lookups and range scans avoid reading the whole table, and that every write has to update every index. Mention composite indexes and why column order matters for which queries can use them.
For a slow query, show a method rather than a guess:
- Reproduce it and read the query plan (for example with EXPLAIN in PostgreSQL or MySQL).
- Look for full scans, bad row estimates, or sorts that spill to disk.
- Check whether an index exists that matches the filter and sort.
- Look for N+1 patterns in the application code that issue many small queries.
- Only then consider caching, denormalising, or bigger hardware.
For isolation levels, know the standard four (read uncommitted, read committed, repeatable read, serializable) and the anomalies they address: dirty reads, non repeatable reads, and phantoms. Mention that default levels differ between databases, so you check rather than assume.
Common mistakes
Saying "just add an index" without considering write cost, forgetting about migrations on large tables, and proposing sharding before trying read replicas, better indexes or partitioning.
Caching questions
Typical questions
- Where would you add a cache to this service, and what would you store?
- Explain cache aside, write through and write behind.
- How do you invalidate cached data when the source changes?
- What is a cache stampede, and how do you prevent it?
- What happens to your system if the cache goes down?
What interviewers listen for
Start by asking what problem the cache solves: read latency, database load, or the cost of an expensive computation. Then pick a pattern:
| Pattern | How it works | Good for | Watch out for |
|---|---|---|---|
| Cache aside | App reads cache, falls back to the database, then fills the cache | Read heavy data, simple to add | Stale data until expiry or explicit delete |
| Write through | App writes to the cache and the database together | Data that is read right after writing | Slower writes, cache holds data nobody reads |
| Write behind | App writes to the cache, which flushes to the database later | Very high write rates | Risk of losing writes if the cache fails |
| TTL only | Entries simply expire after a set time | Data where some staleness is fine | Choosing the TTL, bursts of misses at expiry |
Strong candidates talk about invalidation honestly: deleting a key after a write is common, but races between a slow read and a fast write can put stale data back. Mention short TTLs as a safety net. For stampedes, describe request coalescing (one request rebuilds the value while others wait), adding random jitter to TTLs, and serving slightly stale values while refreshing in the background.
Always answer the failure question. A cache should make the system faster, not become a single point of failure. If the cache disappears, can the database survive the extra load, or do you need rate limits and graceful degradation?
Concurrency questions
Typical questions
- Two users buy the last item at the same moment. How do you stop overselling?
- What is the difference between optimistic and pessimistic locking?
- Explain a race condition you have seen and how you fixed it.
- How would you process jobs from a queue exactly once?
- Threads, processes, async I/O: when would you use each?
What interviewers listen for
For the overselling question, show several options and their costs:
- Atomic update in the database, such as decrementing stock only where stock is above zero and checking the number of affected rows.
- Pessimistic locking with SELECT ... FOR UPDATE inside a transaction. Simple and correct, but it holds locks and can reduce throughput.
- Optimistic locking with a version column. Cheap when conflicts are rare, but clients must retry on conflict.
- A single writer, such as a queue partitioned by product, when contention is very high.
For queues, the honest answer is that most systems deliver at least once, so consumers must be idempotent. Explain deduplication with a processed message table or idempotency key, and what happens when a worker crashes halfway through a job.
For threads versus async, connect the choice to the workload. CPU heavy work benefits from parallelism across cores. I/O heavy work, such as calling other services, often scales better with async I/O or lightweight processes. Mention the model in the language you use daily, whether that is goroutines in Go, the event loop in Node.js, threads and virtual threads in Java, or processes on the BEAM in Elixir.
Common mistakes
Claiming exactly once delivery without explaining how, ignoring deadlocks when taking several locks, and describing a fix that only works on a single server.
Backend interview prep checklist
- [ ] I can design a small REST API with status codes, pagination and idempotency keys.
- [ ] I can explain how an index works and read a basic query plan.
- [ ] I know the four isolation levels and one anomaly each prevents.
- [ ] I can compare cache aside, write through and TTL only caching.
- [ ] I can describe how to prevent a cache stampede.
- [ ] I can solve the "last item in stock" problem three different ways.
- [ ] I can explain at least once delivery and how to make a consumer idempotent.
- [ ] I have two production stories ready: one slow query or outage, one concurrency bug.
- [ ] I know how my main language handles concurrency.
- [ ] I have read the job post and know which database, queue and cloud the team uses.
A one week prep plan
- Day 1: API design. Design two APIs on paper, for example orders and comments. Write out the endpoints, errors and pagination.
- Day 2: Databases. Set up a local PostgreSQL or MySQL, create a table with a lot of rows, and compare query plans with and without an index.
- Day 3: Transactions and locking. Reproduce a lost update with two sessions, then fix it with a lock and with a version column.
- Day 4: Caching. Add a cache aside layer to a toy service and think through invalidation and failure.
- Day 5: Queues and concurrency. Write a small worker that processes jobs and survives being killed mid job without double processing.
- Day 6: Stories. Write short notes on two or three real incidents or bugs from your work, using the situation, action, result shape.
- Day 7: Mock round. Ask a friend to pick questions from this post and answer them aloud, with a timer.
FAQ
How deep do backend interviews go on databases?
It depends on the level. Junior candidates are usually asked about SQL basics, joins and indexes. Senior candidates should expect isolation levels, locking, replication and migrations on large tables. Read the job post for the database the team uses and study that one first.
Do I need to know a specific framework?
Usually not. Interviewers care more about HTTP, data modelling and concurrency than about one framework. If the job post names a stack, be ready to explain how that stack handles requests, connections and background work.
What if I have never run a service at scale?
Say so honestly, then reason from first principles. Small projects still produce real stories: a slow query you fixed, a bug caused by retries, a cache that served stale data. A clear explanation of a small problem often beats a vague claim about a large one.
Prepare for your next backend interview
If you are applying for backend roles, you can browse open positions in our backend jobs hub and save the ones you like. For each interview, Interviews builds a prep plan with AI suggested topics and AI generated quizzes based on the company and the stack in the role, so you can practise the areas above against the job you are actually going for. Pro adds a tailored resume and cover letter for each role, which you review before anything is sent. You can create a free account to start.