Java Zero to All All questionsPractise free
Interview questions › Distributed Systems & Messaging › Microservice Patterns & Architecture

How do you migrate a monolith to microservices with the strangler-fig pattern, and which piece do you extract first?

Level III · MidMicroservice Patterns & Architecture
Short answer

Put a routing layer (API gateway/reverse proxy) in front of the monolith so it can selectively divert specific routes to new services while the monolith keeps serving the rest, then peel off one capability at a time until the monolith is decommissioned.

Explanation

Extract a high-change or high-scale, loosely-coupled component first to get value early and prove the seam. The hard part is data: the new service needs its own store, so you often run a transition period with change-data-capture or dual writes to keep the old and new data in sync until the cutover is complete.

Common mistakes
  • Rewriting everything at once.
  • Extracting the most tangled module first instead of a well-bounded one.

Can you say this out loud in two minutes? Drill it in a timed mock interview, with flashcards and runnable code for Microservice Patterns & Architecture.

Practise free

More on Microservice Patterns & Architecture