Featured image of post Monolith vs. Microservices: The 'Mansion vs. Village' Mental Model

Monolith vs. Microservices: The 'Mansion vs. Village' Mental Model

Is Microservices mostly hype? A mastery guide to the 'Distributed Monolith', Latency taxes, and knowing when to split.

“We are rewriting our Monolith into Microservices.”

This sentence has destroyed more startups than bad product-market fit.

Engineers love Microservices because it looks like Netflix. Business owners hate Microservices because features take 3x longer to ship.

This is the Mastery Guide to Architecture. We’ll find out why a Monolith is usually better, and the exact moment you should actually switch.


Part 1: Foundations (The Mental Model)

The Monolith = The Mansion

Imagine a huge Mansion where everyone lives together (Auth, Payments, Users, Orders).

  • Communication: Instant. If the Cook needs the Butler, he just shouts. (Function calls in memory: Nanoseconds).
  • Database: One giant pantry. Everyone shares the ingredients.
  • Deployment: You fix the roof? You have to evacuate the whole house for a day. (Redeploy the whole app).
  • Risk: If the kitchen catches fire, the whole house burns down.

Microservices = The Village

Imagine a Village of small, separate houses.

  • Communication: Slow. The Cook has to walk down the street to ask the Butler for salt. (Network calls: Milliseconds).
  • Database: Every house has its own small fridge. No sharing allowed.
  • Deployment: You can fix the Butler’s roof while the Cook keeps cooking. Independent scaling.
  • Risk: If the kitchen burns down, the rest of the village is safe… but now nobody has dinner.

Part 2: The Investigation (The Hidden Costs)

Switching to Microservices is not free. You are trading Code Complexity for Operational Complexity.

1. The Latency Tax

In a Monolith, UserService.getUser() takes 0.0001ms (Memory lookup). In Microservices, HTTP GET /users/1 takes 20ms (Network serialization + TCP handshake + Latency).

You just made your basic operation 200,000x slower.

2. The Distributed Tracing Nightmare

In a Monolith, if an error happens, you look at the Stack Trace. It tells you exactly line 42 failed.

In Microservices, User request -> Gateway -> Auth Service -> Order Service -> Payment Service (Error). Where are the logs? You have to search 4 different servers.

  • Fix: You MUST implement Distributed Tracing (OpenTelemetry/Jaeger). Without it, you are flying blind.

Part 3: The Diagnosis (The Distributed Monolith)

This is the worst architecture in existence.

It happens when you build a Village, but you still act like a Mansion.

  • Symptom: “I cannot deploy Service A because it requires Service B to be updated first.”
  • Symptom: Service A reaches directly into Service B’s database. (Breaking the #1 rule: Private Fridges).
  • Symptom: Massive API calls. To load the homepage, the frontend has to make 50 separate calls to 50 services.

If your services are “Micro” but tightly coupled, you have built a Distributed Monolith. You have all the slowness of Microservices with none of the independence.


Part 4: The Resolution (When to Split?)

Don’t split by size (“The code is too big”). Split by Domain.

The Rule of Two Pizzas (Amazon)

If a team gets too big to be fed by two pizzas, split the team. Then split the software to match the team.

The Breakdown Strategy

  1. Start Monolith. Always. It moves fast.
  2. Split the Heaviest Component First.
    • Is “Image Processing” using 90% of CPU? Move just that to a separate service (Lambda/Worker).
    • Leave the rest in the Monolith.
  3. Split the Different Lifecycle.
    • Does the “Billing” module only change once a year, but the “Frontend” changes every day? Split Billing so you don’t risk breaking payments when changing CSS.

Final Mental Model

1
2
3
4
Monolith      -> A Mansion. Fast, easy to share, scary to renovate.
Microservices -> A Village. Slow communication, robust, easy to renovate individually.

Distributed Monolith -> A Village where everyone is handcuffed together. Hell on Earth.

Unless you are scaling the ORGANIZATION (people), keep the MONOLITH (code). You are not Netflix. You don’t need Netflix’s problems.

Made with laziness love 🦥

Subscribe to My Newsletter