Skip to main content

Monolith vs Modular Monolith vs Microservices

Level 9: Level 9: Modern Architecture & Deliverymedium30 minmicroservicesmonolitharchitecture

Default to a modular monolith with clean seams, extract services only on a concrete org, cadence, or scaling trigger, and never build a distributed monolith (shared DB or coupled deploys) that has every cost and no benefit.

Match the architecture to the org and the load

This is the most-tested architecture tradeoff in system design rounds, and the industry mood has swung back toward starting monolithic. Amazon Prime Video famously moved a monitoring pipeline from microservices back to a monolith and cut cost 90%. Shopify runs a modular monolith at enormous scale. The strong senior answer is not "microservices are modern" but "match the architecture to the org and the load."

 Monolith            Modular Monolith           Microservices
 one deploy          one deploy                 many deploys
 no enforced         enforced module            network boundaries
 boundaries          boundaries, single DB      DB-per-service
 fastest to build    fast + refactorable        independent scaling

A plain monolith is one codebase, one deploy, one database. It is the fastest way to ship and the easiest to reason about, because a call across features is a function call, not a network hop. Its weakness is that without discipline the internals turn to spaghetti and one team's change blocks another's deploy.

A modular monolith keeps the single deploy and single database but enforces internal module boundaries: the Orders module talks to the Inventory module only through a defined interface, not by reaching into its tables. You get most of the maintainability benefit of services with none of the network cost, and you keep clean seams so you can split a module out later when you actually need to.

Microservices split each capability into its own deployable service with its own datastore. The benefits are real but specific: independent deploy cadence, independent scaling (the search service can run 50 pods while checkout runs 5), fault isolation, and polyglot freedom. The costs are also real: network latency on every hop, no cross-service transactions (you need sagas), eventual consistency, distributed tracing to debug anything, and a large ops and cloud bill.

The extraction triggers

The decision rule: default to a modular monolith, then extract a service only when a concrete trigger appears. Real extraction triggers are (1) org scaling, when too many teams contend on one deploy pipeline (Conway's Law), (2) divergent deploy cadence, when one part ships hourly and the rest ships weekly, (3) divergent scaling profile, when one component needs 10x the hardware, (4) fault isolation for a critical path, and (5) a genuine polyglot need.

Interview nuance: the worst outcome is a distributed monolith: services that share a database or must be deployed together. You pay the full network and ops cost of microservices and still cannot deploy or scale independently, so you get every cost and no benefit. Interviewers probe for this by asking "what if two of your services need the same data?" The right answer is API or event access, never a shared table.

Argue both directions from the requirements. If asked to justify microservices, ground it in a named trigger. If asked why not, cite the distributed-monolith risk and the ops overhead a small team cannot absorb.

Recap: default to a modular monolith with clean seams, extract services only on a concrete org, cadence, or scaling trigger, and never build a distributed monolith.

Apply

Your turn

The task this lesson builds to.

Recommend an architecture for a 12-engineer Series-B startup's ordering platform, then define the exact triggers that would make you extract the first microservice.

Think about

  1. Why default to a modular monolith first?
  2. What are the real extraction triggers (org, deploy cadence, scaling profile)?
  3. What is a distributed monolith and why is it the worst outcome?

Practice

Make it stick

A second problem on the same idea, so it survives past today.

Design the migration path for a company like Prime Video that already runs a 12-microservice media-monitoring pipeline costing too much, where the services are chatty and pass large frames over the network. Recommend whether to consolidate and how, leading with the deliverable.

Think about

  1. How do you confirm the cost is network/storage transfer, not compute?
  2. Which services consolidate and which stay split?
  3. Why does per-step independent scaling lose nothing here?