27. Monolith vs Microservices
1
The picture to keep in your head2
27.1 What is a monolith?3
27.2 What are a monolith's strengths?4
27.3 What is a modular monolith?5
27.4 What are microservices?6
27.5 What is the real cost of microservices?7
27.6 How do you draw service boundaries?8
27.7 How does service discovery work?9
27.8 Sync vs async calls between services: when to use which?10
27.9 What does "database per service" mean?11
27.10 When should you split?12
Memory card and where the analogy breaks13
Practice: five levels14
Interview questions15
Solutions16
Sources17
Code lab27. Monolith vs Microservices
Memory card and where the analogy breaks
3 min read+10 XP
The memory card (tear this page out)
| # | Question | Memory code |
|---|---|---|
| 27.1 | Monolith? | One kitchen, one menu, one door |
| 27.2 | Monolith strengths? | One kitchen is fast and simple until there are too many cooks |
| 27.3 | Modular monolith? | One kitchen, but every station guards its own shelf |
| 27.4 | Microservices? | Each stall runs itself, from pantry to counter |
| 27.5 | Real cost? | Every stall you split off is another queue, another lock, another thing to run |
| 27.6 | Boundaries? | Cut where the cooks rarely talk |
| 27.7 | Service discovery? | Check the board, not your memory: stalls move |
| 27.8 | Sync vs async? | Wait at the counter only for what you're about to eat |
| 27.9 | Database per service? | Each stall keeps its own pantry and asks politely for the rest |
| 27.10 | When to split? | Split for teams and needs you can name, one stall at a time |
The whole chapter in one line: Start with a well-moduled monolith, split out services only for named team, scaling or isolation needs, cut along business capabilities, give each service its own data, and keep synchronous chains short.
Where the analogy breaks
- Food court stalls rarely depend on each other. Services often do, and a slow dependency can freeze the caller unless it has timeouts.
- A stall's pantry is physical. Data can be copied, so services can keep their own copies of others' data, updated by events.
- Opening a stall is slow and visible. Creating a service is a few commands, which is exactly why teams end up with too many.
Quick check
Five questions on this chapter. Pick an answer, then check it.
quiz