Skip to main content
1:1 mock interviews with Sumit, scored on a real hiring rubric.Book a slot →
TOPIC 3 OF 5 · 2 MIN READ

Monolith vs Microservices

Microservices split an application into independently deployed services that own their data. They help large teams move independently but add network calls, distributed failures and operational work. Interviewers want a balanced answer, not hype.

What you will learn

  • Compare monolith, modular monolith and microservices
  • Know service boundaries, API gateways and service discovery
  • Handle distributed transactions with sagas
  • Know when to split

Key concepts

Modular monolith

One deployable app with strict internal modules and boundaries. Most of the design benefit of microservices without network calls. A good default.

Database per service

Each service owns its tables; others use its API or events. Sharing a database couples services together again.

API gateway

A single entry point that routes to services and handles auth, rate limits and request aggregation.

Saga

A business transaction across services as a series of local transactions, each with a compensating action (refund, release stock) if a later step fails. Coordinated by events (choreography) or an orchestrator.

Step by step

When microservices make sense

  • Many teams blocked on one deploy pipeline
  • Parts with very different scaling needs
  • Clear domain boundaries that rarely change
  • Mature CI/CD, monitoring and on-call already in place

Examples

Order saga with compensations

1. Order service:     create order (PENDING)
2. Payment service:   charge card        ✗ fail → cancel order
3. Inventory service: reserve stock      ✗ fail → refund payment → cancel order
4. Order service:     mark CONFIRMED → publish OrderConfirmed

Practise it

Try these without looking back. If you can explain each one out loud, you are ready for this question.

  • Split an e-commerce monolith into services and say which data each owns.
  • Explain what happens to the order saga if the payment service times out.

Interview questions

What interviewers ask next on this topic. Answer out loud first, then open the model answer.

What are the biggest costs of microservices?

Network latency and partial failures, distributed data and no simple transactions, harder debugging (you need tracing), more infrastructure, versioned APIs between teams, and harder local development.

How do services find each other?

Through service discovery: DNS in Kubernetes (orders.default.svc), a registry such as Consul or Eureka, or a service mesh. Clients add timeouts, retries with backoff and circuit breakers.

Summary

Start with a well-structured monolith; move to microservices when team size and scaling needs justify the cost, give each service its own data, and use sagas instead of distributed transactions.

Stuck on this one? Talk to Sumit.

Keys: F focus mode · ← → previous / next topic · Esc leave focus