Microservices Interview Questions: Boundaries, Failure Handling, and Data Ownership
Quick Overview
Learn a practical microservices interview framework for service boundaries, failure isolation, data ownership, sagas, outbox patterns, and safe migration.
A weak microservices interview answer draws a box for every noun: User Service, Order Service, Payment Service, and Notification Service. A strong answer explains why those boundaries exist, which service owns each business invariant, and what happens when the third network call times out after the first two have already committed.
That is the real difficulty. Once a system is distributed, a local database transaction no longer protects the whole workflow. Calls can be slow, duplicated, or lost; services can deploy independently but still fail together; and copied data can become stale.
Start with PracHub's Backend Engineer interview questions to practice these decisions in company and role context. This guide gives you a reusable framework for service boundaries, failure handling, data ownership, and cross-service consistency.

Quick answer: use a seven-step microservices framework
Do not begin with Kubernetes, Kafka, or a service count. Build the answer from business rules outward:
- Name the business capability and invariants. State what must remain true, such as never overselling inventory or never posting the same payment twice.
- Find a bounded context. Group behavior and vocabulary that change together instead of creating one service per table.
- Assign one data owner. Name the sole writer for each authoritative entity and explain how other services read or copy that information.
- Design the contract. Choose synchronous calls, asynchronous events, or both; define schemas, versions, idempotency, and error behavior.
- Bound the failure path. Use deadlines, safe retries, backoff, circuit breakers, bulkheads, and graceful degradation where the product permits them.
- Coordinate multi-service work. Keep each local transaction atomic, then use an outbox, saga, compensating actions, and reconciliation across services.
- Define operational ownership. Include SLOs, tracing, deployment independence, rollback, incident ownership, and signals that a boundary should change.
This sequence makes the architecture defendable. It also exposes when a modular monolith is simpler and safer than a distributed design.
What interviewers are actually evaluating
Microservices questions test whether you can trade local simplicity for independent change without losing correctness. Interviewers want to see high cohesion inside a boundary and low coupling across boundaries.
A senior answer treats those as architecture questions, not implementation details. It names the failure, the customer-visible behavior, the owner, the recovery mechanism, and the metric that proves recovery is working.
Draw boundaries around business capabilities
A service boundary should contain rules and data that form one coherent business capability. "Order" is not merely an orders table. It may include order lifecycle rules, allowed state transitions, cancellation policy, and the decision about when an order is considered confirmed.
Use domain language to find seams. In a commerce system, Inventory may reason about reservations and available quantity, while Payments reasons about authorization, capture, refund, and ledger entries. Those models change for different reasons and can justify separate ownership.
Avoid CRUD services and horizontal layers
Splitting User, Address, and Preference into tiny CRUD services often creates chatty workflows with little independent behavior. Separating API, business logic, and database access into network services is worse: every feature crosses every boundary.
Prefer a boundary that can complete meaningful work. Ask whether one team can change and deploy it without coordinating a lockstep release, whether it can enforce its own invariants, and whether its interface speaks in business operations rather than exposing internal tables.
| Signal | Keep together when | Consider separating when |
|---|---|---|
| Business rules | Objects participate in the same invariant and transaction | They use different models, vocabulary, or lifecycle rules |
| Change pattern | Features and schemas usually change together | Teams need independent release cadence and ownership |
| Scale | Workload shape and capacity needs are similar | One capability has a distinct hot path or resource profile |
| Failure impact | Partial availability would not help the user | Isolation lets healthy capabilities continue safely |
| Communication | Calls are frequent, fine-grained, and transaction-heavy | The contract is coarse-grained and changes less than internals |
Boundaries are hypotheses, not permanent truth
Start coarser when the domain is uncertain. A modular monolith can enforce logical boundaries while preserving local calls and transactions. Extract a service when independent scaling, deployment, security, or team ownership produces more value than the new network and operating cost.
The reverse is valid too. If two services require constant synchronous calls, coordinated releases, and shared incident response, the boundary may be wrong. Merging them can restore cohesion.
Give every piece of authoritative data one owner
A service owns data when it is the only component allowed to enforce writes and schema rules for that domain. Other services do not reach into its tables, even if the database technology makes that convenient.
Consumers use an API for current decisions or subscribe to published events and maintain a local read model. A Shipping service may store an order ID, destination snapshot, and fulfillment status, but the Order service remains authoritative for the order lifecycle.
Data duplication can reduce coupling
Microservices often duplicate selected facts deliberately. A local projection avoids a synchronous call and can keep reads available during another service's outage. The cost is eventual consistency, so include source version, event ID, update time, and a replay or reconciliation path.
Do not copy data that must be fresh for a safety or money decision without a clear staleness contract. A stale product description may be acceptable; a stale authorization or account balance may not be.
A shared database is more than a storage choice
When multiple services write the same schema, a migration by one team can break another, invariants have no single owner, and independent deployment becomes fiction. If physical database separation is temporarily impractical, enforce logical schema ownership, permissions, and APIs while planning the migration.
Choose synchronous and asynchronous communication deliberately
Use a synchronous request when the caller needs an immediate answer to continue. Keep the call chain shallow, propagate an end-to-end deadline, and return an error or explicit partial result when the required dependency cannot respond.
Use asynchronous events when the producer should commit its work without waiting for every downstream reaction. Events fit notifications, analytics, search indexing, and long-running workflows, but they introduce duplicate delivery, lag, ordering, schema evolution, and replay concerns.
Stop one failing service from becoming a system outage
Every remote call needs a time budget. A per-call timeout prevents a slow dependency from consuming the caller's threads, connections, and request deadline indefinitely. Propagate the remaining deadline so downstream work that can no longer help the user is cancelled.
Retry only transient errors and only when the operation is idempotent or carries an idempotency key. Use exponential backoff with jitter and a retry budget. Unbounded retries amplify load exactly when a dependency has the least spare capacity.
Circuit breakers and bulkheads solve different problems
A circuit breaker fast-fails calls to a dependency that is already unhealthy, allowing it time to recover. A bulkhead limits the concurrency, connection pool, or worker budget assigned to that dependency so it cannot consume every resource in the caller.
Fallbacks must be product-safe. Serving a cached catalog entry may be reasonable; inventing a payment approval is not. State whether the endpoint fails closed, returns partial data, serves a bounded stale value, or queues work for later.
Measure the dependency graph, not only each service
Track per-hop latency, error and timeout rate, retries, circuit state, concurrency saturation, queue age, and degraded responses. Propagate trace and correlation IDs across calls and events. A service can show healthy CPU while waiting on a dependency that is collapsing the user journey.
Coordinate data without pretending it is one transaction
Keep strong ACID transactions inside one service boundary. When a workflow spans services, decide which intermediate states are visible and how the system moves forward or compensates after partial success.
A saga models the workflow as local transactions. Choreography lets services react to events; orchestration uses a coordinator or durable state machine to issue commands and record progress. Orchestration is often easier to inspect for a complex workflow, while choreography can reduce central coupling for a small event flow.
Compensation is a business action, not a database rollback
Releasing an inventory reservation or issuing a refund does not erase history. It is a new, auditable action that can also fail. Design compensations to be idempotent, retriable, observable, and reconciled.
Use a transactional outbox when a local database update must publish an event. Write the business row and outbox row in one local transaction; a relay publishes the event later. Consumers still need idempotency because the relay may publish more than once.

Worked scenario: design a resilient checkout workflow
Assume four domains: Order owns order state, Inventory owns stock and reservations, Payment owns authorization and capture, and Shipping owns fulfillment. Each has a private schema and a stable command or event contract.
The Order service creates a PENDING order and an OrderCreated outbox record in one transaction. A saga orchestrator sends ReserveInventory with order_id and a step ID. Inventory records the reservation idempotently and returns its reservation ID.
The orchestrator then requests payment authorization. If authorization succeeds, Order moves to CONFIRMED and publishes the next event. If payment is declined, the saga asks Inventory to release the reservation and marks the order PAYMENT_FAILED.
If Payment times out, the orchestrator does not guess. It queries by idempotency key or retries the same command within a budget. If the release command also fails, the saga remains in a compensating state, alerts on age, and retries until reconciliation proves the reservation was released.
Order may store a projected payment status for display, but Payment owns the authorization truth. Every event includes an ID, order key, schema version, and trace context. Dashboards expose saga age, step retries, compensation backlog, duplicate suppression, and mismatches found by reconciliation.
Migrate one capability at a time
For a monolith migration, choose one capability with a clear boundary and measurable pain. Place a routing layer or facade in front, build an anti-corruption layer around the legacy model, backfill service-owned data, and compare old and new reads before shifting writes.
Use a strangler rollout with canary traffic, reversible routing, contract tests, and explicit rollback. Avoid extracting many services before the platform has deployment, observability, schema compatibility, and on-call ownership.
Define success before migration: shorter deployment lead time, fewer coordinated releases, isolated scaling, reduced incident blast radius, or clearer ownership. "More services" is not a success metric.
Practice microservices questions on PracHub
These prompts cover migration, data consistency, partial failure, and internal contracts. Use the stored question as practice context; it is not a prediction of an exact future interview.
| PracHub question | Practice focus | Why it helps |
|---|---|---|
| Migrate a monolithic wallet to microservices | Boundaries, data ownership, and migration | Forces a phased design with regulated data, rollback, and measurable cutover safety. |
| Design distributed transactions protocol | Sagas, 2PC, idempotency, and partitions | Tests whether you can state the realistic consistency and failure trade-offs. |
| Design a Resilient Bootstrap API | Timeouts, retries, bulkheads, and partial results | Connects dependency failures to customer-visible API behavior and observability. |
| Design a REST API Abstraction Layer | Contracts, versioning, and shared reliability policy | Builds clear separation between per-service interfaces and cross-cutting transport concerns. |
A seven-day microservices interview plan
| Day and focus | What to do |
|---|---|
| Day 1: Domain boundaries | Map capabilities, vocabulary, invariants, and owners for one commerce workflow. |
| Day 2: Data ownership | Assign one writer per entity; design APIs, events, projections, and reconciliation. |
| Day 3: Failure handling | Trace timeouts, safe retries, circuit breakers, bulkheads, and fallbacks. |
| Day 4: Consistency | Compare local transactions, outbox, saga choreography, and orchestration. |
| Day 5: Checkout saga | Draw every success, failure, compensation, and idempotency boundary. |
| Day 6: Migration | Plan a strangler rollout with data backfill, canary traffic, rollback, and metrics. |
| Day 7: Mock interview | Deliver the seven-step framework and defend one boundary under follow-ups. |
Frequently asked questions
How do you choose microservice boundaries?
Start from business capabilities, bounded contexts, invariants, and change patterns. Keep behavior that must change and transact together inside one boundary; separate capabilities when independent ownership and operation justify the network cost.
Should every microservice have its own database?
Each service should own its authoritative domain data and be the sole writer. Physical isolation can be phased, but shared write access undermines schema autonomy, invariant ownership, and independent deployment.
How do microservices handle distributed transactions?
Use local transactions per service and coordinate the workflow with a saga, durable state machine, idempotent commands, compensating actions, and reconciliation. An outbox reliably connects a local commit to event publication.
How do you prevent cascading failures?
Set end-to-end deadlines, bound concurrency, retry only safe transient failures with backoff and jitter, use circuit breakers, shed load, and define product-safe degradation. Monitor the dependency graph and retry amplification.
When is a modular monolith better?
Use a modular monolith when the team is small, boundaries are uncertain, workflows need frequent local transactions, or the organization lacks the platform and on-call maturity to operate many independent services.
What metrics matter in a microservices interview answer?
Include end-to-end and per-hop latency, errors, timeouts, retries, saturation, circuit state, queue or saga age, compensation backlog, deployment frequency, rollback rate, and cross-service data mismatches.
Final takeaway
A good microservices answer is not a diagram with more boxes. It is a coherent argument about business boundaries, one authoritative data owner, explicit contracts, bounded failure, and recoverable cross-service workflows.
Practice that argument with PracHub's Backend Engineer question bank. For each prompt, name the invariant, owner, failure window, compensation, and metric before choosing infrastructure.
Sources and Further Reading
- Microsoft Azure Architecture Center: Microservices Architecture Style
- Microsoft Azure Architecture Center: Use Domain Analysis to Model Microservices
- Microsoft Learn: Data Sovereignty per Microservice
- AWS Prescriptive Guidance: Saga Pattern
- AWS Prescriptive Guidance: Transactional Outbox Pattern
- Google SRE: Addressing Cascading Failures
- Martin Fowler: How to Break a Monolith into Microservices
Research note: This guide was checked on August 22, 2026. Microservice boundaries and reliability controls should be selected from domain, workload, team, and operational constraints rather than copied as fixed rules.
Related Articles
小林coding 够用吗?后端八股到真实面试实战的差距
小林coding准备后端面试够用吗?本文分析图解八股的优势、真实面试中的Coding与系统设计差距,并给出7天实战训练路线。
Distributed Lock Interview Questions: Leases, Fencing Tokens, and Failure Modes
Prepare for distributed lock interviews with leases, fencing tokens, stale-writer protection, Redis and etcd trade-offs, and failure walkthroughs.
Message Queue Interview Questions: Ordering, Retries, Delivery Semantics, and DLQs
Prepare for message queue interviews with ordering, retries, delivery semantics, acknowledgements, idempotency, DLQs, and failure scenarios.
Caching Interview Questions for Backend Engineers: Eviction, Stampedes, and Consistency
Prepare for backend caching interviews with eviction policies, stampede defenses, consistency trade-offs, failure modes, and worked scenarios.
Comments (0)