Continue where you left off ×
One building or many: monolith, microservices and the strangler
The Monolith That Never Died · Open board
One large program that kept serving a fast-growing company, with the few parts that really needed to leave drawn as separate boxes around it. This lesson is about deciding which parts leave, and how.
Before you start. You need The Contract at the Counter (API design) : two programs meet across a written list of what you may ask, and adding a new line to that list breaks nobody. You need Thirty stalls on one order (availability, the nines, and the tail at scale) : when a request needs many parts, the chance that all of them work is each chance multiplied together. When the neighbour is slow: timeouts, retries, breakers gave you the timeout, the retry limit and the circuit breaker, which return in the second read. Changing the engine in flight (live schema and data migrations) showed how to move live data in small safe steps, and the migration here uses the same habit.
The idea in 30 seconds
A monolith is one program deployed as one unit. A function call inside it is about 5,800 times cheaper than a network call.
Microservices are many programs reached over a network. They buy independent deploys, scaling and failure, and charge for it in lost requests, many contracts and drifting shared code.
A modular monolith keeps one deployment but enforces strict module boundaries, so a module can leave later.
Split only for a reason with a number: separate scaling, separate failure, or a separate team that must ship alone.
A strangler fig migration puts an API gateway in front, moves one piece at a time by percent, and deletes the old piece at 100%.
Segment merged over 140 services back into one, so the right size can go both ways.
Read the story
Lesson 33 of 115 in System Design
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year .
See plans Already a member? Sign in
Or start free : a free account opens lessons 2 and 3 of every track.
In this lesson The problem: 140 services and three engineers keeping them alive Monolith: one program, one deployment Microservices: one program per job, and what the split costs Modular monolith: strict boundaries, still one deployment When to split: three reasons that pay Strangler fig migration: replace it piece by piece Terms it explains: monolith, microservice, modular monolith, API gateway, Common mistakes, Service discovery, service mesh.
Review System Design
Mark as read Saved in this browser, and to your account when you sign in.