Full answer
Monolith
One codebase and one deployable process (possibly many identical copies behind a load balancer), usually with one database.
- Function calls instead of network calls: fast and no partial failures.
- Transactions across features are easy: enrol and charge in one database transaction.
- One build, one deploy pipeline, easy local development and debugging.
- Problems grow with size: slow builds and tests, teams blocking each other's releases, one bad change taking down everything, and the whole app scaled together even if only video encoding needs more CPU.
A modular monolith keeps one deployable but enforces internal module boundaries (separate packages, no reaching into another module's tables). It keeps most monolith benefits and makes a later split far easier.
Microservices
Each service owns one business capability and its own data, exposes an API, and is deployed independently.
- Teams own services end to end and release on their own schedule.
- Services scale independently and can use different technology where justified.
- Failures can be isolated, if designed for it.
Costs:
- Every call can fail or be slow: timeouts, retries, circuit breakers are required.
- No cross-service transactions: sagas, outbox and eventual consistency.
- Queries across services need API composition or replicated read models.
- Platform work: service discovery, CI/CD per service, distributed tracing, centralised logs, secrets, versioned APIs.
- More things to monitor and be paged for.
When to split
Good signals:
- Many teams (often several teams of 5 to 10 people) blocked by a shared release train.
- A component with very different scaling or reliability needs (video transcoding, search indexing).
- A clear business boundary with little shared data (billing versus content authoring).
Poor reasons: "microservices are modern", or splitting a small team's product into ten services.
How to split safely
- Make module boundaries clean inside the monolith first.
- Use the strangler fig pattern: route one capability's traffic to a new service, keep the rest in the monolith, repeat.
- Give the new service its own data store and migrate data with change data capture or dual writes plus verification.
- Avoid a "distributed monolith" where services share a database or must deploy together; that has the costs of both and the benefits of neither.
Boundaries follow the business domain (bounded contexts), not technical layers. A "database service" and a "UI service" are layers, not good service boundaries.
By level
Fresher: Describe both styles in simple terms and give one benefit and one drawback of each. A fresher can describe a modular monolith as a middle step.
Mid: Discuss data ownership, sagas, observability and deployment, and when a modular monolith is the better choice. Expect concrete signals for when to split.
Senior: Plan an incremental extraction with the strangler fig pattern and data migration, define service boundaries by domain, assess platform cost, and recognise and fix a distributed monolith. The senior answer includes a step-by-step extraction and data migration plan.
Key points
- Monoliths are simple, fast and transactional but hurt large teams
- Microservices enable independent deploys and scaling at the cost of distributed-system complexity
- A modular monolith is often the right middle step
- Split for team autonomy or distinct scaling needs, along business boundaries
- Avoid the distributed monolith with shared databases
Common mistakes
- Splitting by technical layer instead of business capability
- Sharing one database across services
- Ignoring the platform and observability work microservices need
- Starting a small product as dozens of services
Follow-ups
- How would you extract the payments module from a monolith?
- What is the strangler fig pattern?
- How do you run a report that needs data from five services?
Tips
- Give two benefits and two costs of each
- Name concrete signals for splitting
- Mention modular monolith as an option
Evaluation rubric
- Balanced trade-offs
- Correct consequences for data and failures
- Clear criteria for when to split
- Safe migration approach