You inherit a 10-year-old Java monolith used by 8 teams. Leadership wants microservices. How do you approach it?

Short answer

First confirm the problem microservices should solve (release contention, scaling, team autonomy). Modularize inside the monolith along bounded contexts, build platform capabilities, then extract services incrementally with the strangler fig pattern, starting with a well-bounded, high-value domain, keeping data ownership clear.

Detailed answer

  1. Diagnose: measure lead time, deployment frequency, change failure rate, incident causes, and where teams collide. Microservices are a means, not a goal.
  2. Map domains: event storming and capability mapping to identify bounded contexts; analyse code coupling (hotspots, dependency graphs).
  3. Modularize first: enforce module boundaries inside the monolith (packages, ArchUnit/Spring Modulith), separate schemas per module. This alone often fixes much of the pain.
  4. Platform prerequisites: CI/CD per service, observability, container platform, API gateway, event streaming.
  5. Extract incrementally: strangler facade routes a capability to a new service; data synchronized via CDC during transition; choose a first candidate with clear boundaries and business value (e.g. notifications, catalog, search).
  6. Team alignment: each extracted service owned by one stream-aligned team.
  7. Stop when value stops: not everything needs extraction.

Architecture diagram

flowchart LR
  C[Clients] --> F[Strangler facade]
  F --> M[Modular monolith]
  F --> S1[Extracted: catalog service]
  F --> S2[Extracted: search service]
  M -- CDC --> S1
  S1 -- events --> M

Real-world example

Shopify invested in a modular monolith; others such as Amazon and Netflix moved to services as team count grew. Both can be right.

Follow-up questions

  • How do you handle shared tables? (Assign ownership, expose via APIs/events, migrate consumers.)
  • How do you test during migration? (Contract tests, parallel runs, shadow traffic.)

What the interviewer expects

Pragmatism, measurement, incremental approach, data ownership awareness and organizational alignment.

Common mistakes to avoid

Big-bang rewrite, splitting by technical layer, shared database across new services, ignoring platform readiness.