Monoliths vs Microservices 🗿
All the technical and organizational tradeoffs and how to choose between them, or anything in between.
In the book Sapiens, historian Yuval Noah Harari spends some initial chapters explaining the transition of humans from the hunter-gatherer lifestyle to the farmer one.
In doing so, he debunks several myths about the life of prehistoric men.
Hunter-gatherers lived a simple, happy life: they had a diverse diet, famine was rare, they were physically fit, and, contrary to popular belief, they only had to work a few hours a day.
The transition to farming, instead, brought some unexpected setbacks. Farmers had to work long hours, sometimes twice as much as their ancestors did. Their health got worse because of intense work, bad diet (mainly carbs), and diseases brought on by the poor hygiene of primordial villages.
The farmer lifestyle had one main upside, though: it produced more food, which would sustain the creation of larger communities.
In other words, life sucked at pretty much everything, but hey — it was scalable now!
Does it remind you of anything?
The first farmers were pretty much the engineers of the prehistoric world. To their defense, nobody chose to make their own life worse on purpose — on paper, odds where overwhelmingly in favor of farming life. Most downsides were not obvious (e.g. diseases, diet problems) and wouldn’t be so until generations later.
Many big engineering choices are similar. Implications are far reaching, and we may fail to account for the second and third-order consequences.
One of the most divisive of such choices is about monoliths vs microservices, as a strategy for designing our systems.
This article tries to shed light into the tradeoffs, upsides and downsides of both (or anything in between), both from the technical and organizational point of view.
We will go through:
📖 Definitions — Let’s get everyone on the same page.
✏️ System Design — How is design effort different? And when is it worth it?
📈 Scalability — Do microservices scale better than monoliths? Spoiler, it’s complicated.
🚚 Productivity — Does your dev process change based on your architecture? You bet it!
🔍 Case Studies — Three real-world stories of evolving monoliths and microservices.
⚖️ How to decide — Let’s bottom-line all of this and figure out what’s the best for you.
Hey 👋 this is Luca! Welcome to a new 🔒 weekly edition 🔒 of Refactoring.
Every week I write advice on how to become a better engineering leader, backed by my own experience, research and case studies.
Here are the latest articles you may have missed:
To receive all the full articles and support Refactoring, consider subscribing 👇
You can also learn more about the benefits of a paid plan.