DevPrep
  • Interview Prep
  • Projects
  • Resources
  • Pricing
  • About Us
Submit Question
DevPrep
  • Pricing
  • About Us
Submit Question
  1. Home
  2. Articles
  3. System Design
  4. Microservices Interview Questions, Answered With Real Failure Modes
XLinkedInReddit
MediumSystem Design

Microservices Interview Questions, Answered With Real Failure Modes

Thirteen questions, organised the way an interview actually goes. Not definitions: the transactional outbox, saga compensation, why retries make outages worse, and the arithmetic that makes a four-service chain a 99.6% endpoint.

R
rahulrana1
9 min read·0
Table of Contents
  • The question underneath every other question
  • Fundamentals
  • 1. What actually makes a service boundary correct?
  • 2. Synchronous or asynchronous between services?
  • 3. How does a request keep its identity across services?
  • Data, which is where the real difficulty lives
  • 4. Why can't two services share a database?
  • 5. You need to write to a database and publish an event. How do you make that atomic?
  • 6. A payment succeeded but shipping failed. Now what?
  • 7. What does eventual consistency mean for the person using the product?
  • Failure, which is the whole job
  • 8. What does a circuit breaker actually prevent?
  • 9. Why does retrying make an outage worse?
  • 10. How do you know your system is healthy?
  • Questions for staff-level candidates
  • 11. When would you merge two services back together?
  • 12. How do you change an API without breaking consumers you do not control?
  • 13. What is the first thing you would add to a system that has none of this?
  • How to prepare
  • Sources
The short answer
Microservices interviews are not about definitions. They are about whether you understand what you give up: a network call where a function call used to be, eventual consistency where a transaction used to be, and a distributed failure where a stack trace used to be. Every question below is really asking whether you have paid that price.

Most microservices interview prep is a glossary. Service discovery, API gateway, circuit breaker, saga, CQRS. You can memorise all of it and still fail the interview, because the interviewer is not checking whether you know the words. They are checking whether you have felt the consequences.

This is organised the way an interview actually goes: fundamentals first, then the questions that separate someone who has read about distributed systems from someone who has been paged by one.

The question underneath every other question

Before any of the specifics, interviewers want to know whether you can argue against microservices. A candidate who only knows the upside has not run one.

The honest summary: a monolith makes a function call that either returns or throws. Microservices turn that into a network call that can return, throw, time out, return late, or succeed on the server while failing on the client. You adopt them when the organisational benefit of independent deployment outweighs that, which is usually a team-size problem rather than a technical one.

Martin Fowler, who popularised the term, is blunt about the threshold: the microservice premium is only worth paying when complexity would otherwise slow you down, and "don't even consider microservices unless you have a system that's too complex to manage as a monolith."

Fundamentals

1. What actually makes a service boundary correct?

The useful answer is not "one service per domain". It is: a boundary is correct when a typical change touches one service. If adding a field to an order means deploying four services in a fixed order, the boundary is in the wrong place, whatever the diagram says.

The test to say out loud: count how many services a normal feature touches. One is right. Two is tolerable. Four means you have built a distributed monolith, which has the operational cost of microservices and the coupling of a monolith.

2. Synchronous or asynchronous between services?

// Synchronous: the caller's latency is the sum of the chain, and its
// availability is the product of the chain's.
const user = await fetch(`${USERS}/users/${id}`).then((r) => r.json());
const cart = await fetch(`${CART}/carts/${id}`).then((r) => r.json());

// Three services at 99.9% each, called in series:
// 0.999 * 0.999 * 0.999 = 99.7%  -> roughly 2 hours of downtime a month
// that none of the three services is responsible for.

// Asynchronous: the caller returns immediately; the work happens later.
await queue.publish("order.placed", { orderId, items });

Use synchronous calls when the caller genuinely cannot continue without the answer. Use events when it can. The number above is the argument: chained synchronous calls multiply failure probability, and each service's own uptime target hides that.

Where people get stuck
Answering "it depends on the use case" and stopping. Everyone says that. The answer that lands names the arithmetic: synchronous chains multiply availability and add latency, so a four-service chain of 99.9% services is a 99.6% endpoint no matter how good each service is. Then give the exception, because there is one: a payment authorisation must be synchronous, since returning "probably paid" to a customer is worse than being slow.

3. How does a request keep its identity across services?

// Generate once at the edge, propagate everywhere.
app.use((req, _res, next) => {
  req.traceId = req.headers["x-request-id"] ?? crypto.randomUUID();
  next();
});

// Every outbound call carries it.
await fetch(url, { headers: { "x-request-id": req.traceId } });

// Every log line carries it.
log.info({ traceId: req.traceId, msg: "charging card" });

Without this, debugging a failure means reading five services' logs and guessing which lines belong together. With it, one grep reconstructs the request. In practice you would adopt OpenTelemetry's trace context rather than inventing a header, because it also gives you spans and timing, and the traceparent header is a W3C Recommendation rather than a local convention.

Data, which is where the real difficulty lives

4. Why can't two services share a database?

They can, and it is the most common way a microservices migration quietly fails. The reason not to is that a shared schema is a shared contract nobody owns: service B writes a column service A validates, and now neither can deploy a schema change alone. You have paid for network calls and gained nothing.

The harder follow-up is what you do instead when service A genuinely needs service B's data. Three answers, in increasing cost: call B synchronously, subscribe to B's events and keep a local read model, or accept that the boundary was wrong and merge them.

5. You need to write to a database and publish an event. How do you make that atomic?

You cannot. There is no transaction spanning a database and a message broker. This is the transactional outbox, and it is the single most common senior-level microservices question.

// Both rows commit together, or neither does.
await db.transaction(async (tx) => {
  await tx.insert("orders", order);
  await tx.insert("outbox", {
    id: crypto.randomUUID(),
    type: "OrderPlaced",
    payload: order,
    sentAt: null,
  });
});

// A separate poller publishes and marks rows sent.
const rows = await db.query(
  "select * from outbox where sent_at is null order by id for update skip locked limit 100"
);
for (const row of rows) {
  await queue.publish(row.type, row.payload);
  await db.query("update outbox set sent_at = now() where id = $1", [row.id]);
}
Where people get stuck
Expecting exactly-once delivery. You cannot have it. The poller either publishes before marking sent, which can publish twice after a crash, or marks first, which can lose the event entirely. Choose at-least-once, publish first, and make consumers idempotent by keying on the event id. The other half is FOR UPDATE SKIP LOCKED: without it, two poller instances read the same unsent rows and double-publish everything. Saying that line out loud is usually what separates a strong answer from a textbook one.

6. A payment succeeded but shipping failed. Now what?

This is the saga question. There is no rollback across services, so you compensate: run the inverse of each completed step, in reverse order.

okokfailsCharge cardstep 1Reserve stockstep 2Book courierstep 3Release stockcompensate 2Refundcompensate 1Order failed
The forward path, and what runs when step three fails. Payment is compensated last because shipping depended on stock, and stock on payment.

Two things the diagram does not show, and both get asked. The step that failed is not compensated, because it never completed: cancelling a courier booking that was never made either errors or cancels someone else's. And if a compensation itself fails you cannot roll back the rollback, so the saga state has to be durable and a human has to be told. The alternative is a customer charged for an order that does not exist.

7. What does eventual consistency mean for the person using the product?

This question is really asking whether you can translate a distributed systems property into a product decision. The answer is that a user who places an order and immediately refreshes may not see it, and you have to decide what they see instead.

The options are to show the write optimistically from the client, to read your own writes from the service that accepted them, or to make the UI honest ("processing"). Saying "it will be consistent eventually" to a product manager is not an answer; saying "the order list lags by about a second, so we show it optimistically and reconcile" is.

Failure, which is the whole job

8. What does a circuit breaker actually prevent?

Not failure. It prevents a slow dependency from consuming all of your threads or connections while it is slow. If service B takes 30 seconds to time out and you call it on every request, your own service runs out of capacity waiting, and now two services are down instead of one.

// closed  -> calls pass through, failures counted
// open    -> calls fail immediately, no waiting on a dependency that is down
// half-open -> one probe call decides whether to close again

if (state === "open" && Date.now() - openedAt < cooldownMs) {
  throw new Error("circuit open");   // fail in microseconds, not 30 seconds
}

The follow-up worth preparing: what should the caller do when the circuit is open? "Return an error" is often wrong. A recommendations service being down should produce a page without recommendations, not a 500.

9. Why does retrying make an outage worse?

Because every client retries at the same moment. A service that falls over, recovers, and is immediately hit by the accumulated retries of every client falls over again. This is a retry storm, and it is why backoff needs jitter.

// Wrong: a thousand clients that failed together retry together.
await sleep(baseDelay * 2 ** attempt);

// Right: spread them across the window.
const delay = baseDelay * 2 ** attempt;
await sleep(delay * (0.5 + Math.random() * 0.5));

AWS's Builders' Library article on timeouts, retries and backoff is the standard reference, and citing it is a reasonable thing to do in an interview. The other half of the answer is a retry budget: retrying only a small percentage of requests overall, so retries cannot multiply load without bound.

10. How do you know your system is healthy?

Not CPU. The answer interviewers want is that you measure what the user experiences: latency, error rate, traffic and saturation, and you alert on symptoms rather than causes. Google's SRE book calls these the four golden signals, and naming them is a short, credible answer.

The sharper follow-up is about percentiles. A mean latency of 200ms tells you almost nothing; if p99 is 8 seconds then one request in a hundred is unusable, and on a page that makes ten service calls that is roughly one user in ten having a bad time. Always answer latency questions in percentiles.

Questions for staff-level candidates

11. When would you merge two services back together?

A genuinely good answer is "more often than people do". Signals: the two always deploy together, a change to one almost always requires a change to the other, or they share a database. Merging is not a failure; keeping a boundary that costs network calls and buys no independence is.

12. How do you change an API without breaking consumers you do not control?

Expand and contract. Add the new field alongside the old, migrate consumers, then remove the old field once nobody reads it. The constraint people miss is that you need to know when nobody reads it, which means per-consumer metrics on the deprecated field, not a guess and a deadline.

13. What is the first thing you would add to a system that has none of this?

Tracing. Not a service mesh, not Kubernetes, not CQRS. Until you can follow one request across services, every other decision is guesswork, and most teams discover their real boundary problems the first time they look at a trace.

How to prepare

If you have never run microservices, the honest move in an interview is to say so and reason from first principles rather than reciting patterns. Interviewers can tell the difference immediately, and "I have not operated this, but here is what I would expect to go wrong" is a much stronger answer than a confident wrong one.

If you have, prepare one real incident in detail: what broke, how you found it, what you changed. One concrete story outperforms a dozen definitions.

Sources

  • Martin Fowler, MicroservicePremium - when the complexity cost is worth paying
  • W3C Trace Context - the traceparent header, a W3C Recommendation
  • OpenTelemetry, Traces - spans and context propagation
  • AWS Builders' Library, Timeouts, retries and backoff with jitter
  • Google SRE Book, Monitoring Distributed Systems - the four golden signals

Related Articles

MediumSystem Design

System Design: Design an API Progress Bar — The Illusion of Speed

14 min read

Comments (0)

Sign in to leave a comment.

No comments yet. Be the first to comment.

Table of Contents

  • The question underneath every other question
  • Fundamentals
  • 1. What actually makes a service boundary correct?
  • 2. Synchronous or asynchronous between services?
  • 3. How does a request keep its identity across services?
  • Data, which is where the real difficulty lives
  • 4. Why can't two services share a database?
  • 5. You need to write to a database and publish an event. How do you make that atomic?
  • 6. A payment succeeded but shipping failed. Now what?
  • 7. What does eventual consistency mean for the person using the product?
  • Failure, which is the whole job
  • 8. What does a circuit breaker actually prevent?
  • 9. Why does retrying make an outage worse?
  • 10. How do you know your system is healthy?
  • Questions for staff-level candidates
  • 11. When would you merge two services back together?
  • 12. How do you change an API without breaking consumers you do not control?
  • 13. What is the first thing you would add to a system that has none of this?
  • How to prepare
  • Sources

Series

View all System Design articles →

Practice

  • JavaScript
  • DSA
  • Machine Coding
  • System Design

Resources

  • Learning Tracks
  • Articles
  • Roadmaps
  • Compare Concepts
  • Glossary
  • Developer Tools
  • All Questions

Company

  • About
  • Pricing

Legal

  • Privacy Policy
  • Terms of Service
DevPrep

© 2026 DevPrep. All rights reserved.