System design fundamentals learning path Level 2 This level · 9 of 20
Medium architecture microservices

When would you choose a monolith instead of microservices?

The 30 second answer

I choose based on deployment and ownership needs, not traffic alone. A modular monolith keeps calls local and transactions simpler, which is often a good fit for a small team or changing domain. Microservices help when teams need independent releases or a capability needs independent scaling. But they add network failures, cross-service consistency work, and operational overhead, so the benefits need to justify those costs.

Could you say this in an interview?

A monolith is deployed as one application unit; it need not be one unstructured codebase. A modular monolith can enforce clear business boundaries while keeping interactions in-process. Microservices turn selected boundaries into independently deployed services, usually aligned with business capabilities and owning their data. The architectural distinction is independent deployment and autonomy, not simply repository count, container count, or line count.

Decision framework (editorial synthesis of the documented tradeoffs):

  • Prefer a modular monolith when the domain boundaries are still changing, one team owns the application, and independent releases or scaling have little demonstrated value. Local calls avoid network round trips, and a business operation can use a local database transaction when its data is in that transaction's scope.
  • Consider microservices when business capabilities have stable ownership, teams are blocked by shared releases, or a particular capability has materially different scaling or availability needs. Services must actually be independently deployable; splitting code while requiring coordinated releases creates a distributed monolith rather than useful autonomy.
  • Budget for service discovery, deployment automation, contract evolution, distributed tracing, timeouts, and data consistency. Calls can time out after a remote service has already committed, so retries need idempotency. Multi-service business workflows cannot simply reuse an in-process database transaction.

These benefits and challenges are described in the official architecture guidance and its tradeoff analysis.

For example, an early commerce application can keep catalog, checkout, and billing as modules in one Spring Boot deployment. If catalog search later needs a separately owned release cadence and much heavier read capacity, extracting that capability may be justified while checkout and billing remain together. This is an illustrative decision, not a universal rule that search must be a service. Do not split every entity into a service: domain boundaries and cohesive business capabilities matter more than producing tiny services.

Neither style guarantees resilience. A monolith can run multiple replicas behind a load balancer; microservices can propagate failures through synchronous call chains unless callers isolate faults. Likewise, millions of requests do not by themselves dictate microservices: capacity depends on workload, storage, caching, and measured bottlenecks.

Alternate interview scenarios

"How would you migrate a monolithic Spring Boot application to microservices without disrupting customers?"

I migrate step by step with the strangler fig approach, not a big-bang rewrite. A routing layer such as a gateway or proxy sits in front of the monolith. I extract one well-bounded capability at a time and route only its traffic to the new service, while everything else still goes to the monolith. Data is the hard part. The new service needs to own its data, so I copy and sync it with change data capture or dual writes, and switch reads first and writes later. A new route can go to a small share of traffic first and switch back to the monolith quickly. I stop extracting when the remaining monolith is cohesive. Part of the system staying a modular monolith is a valid end state.

Sources (6)
  1. Microsoft Azure Architecture Center: microserviceslearn.microsoft.com
  2. Microsoft Azure Architecture Center: Microservices benefitslearn.microsoft.com
  3. Microsoft Azure Architecture Center: Microservices challengeslearn.microsoft.com
  4. Microsoft: service boundaries and best practiceslearn.microsoft.com
  5. Martin Fowler: Strangler Fig Applicationmartinfowler.com
  6. Microsoft Azure Architecture Center: Strangler Fig patternlearn.microsoft.com
Previous
Next