Microservices Interview Questions

Microservices questions rarely have a single correct answer. Interviewers want to hear that you understand the costs (network failure, data consistency, operations) as well as the benefits. Use these answers as a starting point for your own examples.

Architecture and communication

When would you choose microservices over a monolith?

Microservices help when independent teams need to deploy and scale separate parts of a system on their own schedule. They add distributed-systems complexity: network failures, versioning, observability and data consistency. A well-structured modular monolith is often the better starting point for a small team.

Synchronous vs asynchronous communication?

Synchronous calls (REST, gRPC) are simple and give an immediate answer but couple availability and latency of services. Asynchronous messaging (a broker or event streaming platform) decouples services in time and absorbs spikes, at the cost of eventual consistency and harder debugging.

What does an API gateway do?

It is a single entry point that routes requests to services and can handle cross-cutting concerns such as authentication, rate limiting and request aggregation. Keep business logic out of it, and make sure it does not become a single point of failure.

What is service discovery?

Instances come and go, so clients need to find healthy instances by name rather than a fixed address. It can be client-side (a registry such as Eureka or Consul) or provided by the platform, for example Kubernetes Services and DNS.

Resilience and data consistency

How do you make service-to-service calls resilient?

Set timeouts on every remote call, retry only idempotent operations with exponential backoff and jitter, use a circuit breaker to stop hammering a failing dependency, and use bulkheads to isolate resources. Libraries such as Resilience4j provide these patterns. Always design a sensible fallback or error.

How do you handle a transaction that spans services?

Avoid distributed two-phase commit in most cases. Use a saga: a sequence of local transactions, each with a compensating action if a later step fails. Sagas can be choreographed through events or orchestrated by a coordinator.

What is the transactional outbox pattern?

When a service must update its database and publish an event, it writes the event to an outbox table in the same local transaction. A separate process publishes outbox rows to the broker, so the event is neither lost nor published for a rolled-back change. Consumers must tolerate duplicates.

What is idempotency and why does it matter?

An idempotent operation has the same effect when applied more than once. Because retries and redelivery happen, handlers should be safe to repeat, commonly by using an idempotency key or de-duplicating on a message id.

Why does each service own its database?

Sharing a database couples services through the schema and prevents independent change. Each service owns its data and exposes it via APIs or events, which means cross-service queries need composition or read models.

Operating microservices

How do you trace a request across services?

Propagate a trace or correlation id in request headers, include it in logs, and use distributed tracing (for example OpenTelemetry) together with metrics to see where time is spent and where errors originate.

How do you change an API without breaking consumers?

Make additive, backward-compatible changes, version breaking ones, and use consumer-driven contract tests so producers learn about breakage before release. Deprecate old versions with a clear timeline.

Practice this on Quick Tech Learners

Reading answers is only the first step. Quick Tech Learners lets you turn architecture and backend concepts into active practice once you create an account and sign in.

  • Interview Insights: browse interview questions shared by the community and filter them by topic tag.
  • Practice Quiz: choose the concepts you want to revise, answer questions, and review how you did.
  • Coding Practice: write and run code in a browser editor against test cases. Pick a language, a difficulty band from Beginner to Expert, and either Practice mode (with hints) or Interview mode.
  • Study Plan and reports: set the topics you are preparing, then check performance, mastery and readiness reports to see where the gaps are.
  • Share Interview Question: add a question you were asked so other learners can practise it.