System Design

System Design Adventure-21

Monolith vs Microservices: The Decision That Changes Everything

Posted by Afsal on 27 Nov 2026

Hi Pythonistas!

Let me start with a real story.
A project I worked on.
Simple architecture.

Load Balancer (AWS ALB)
    ↓
EC2 instances
    ↓
RDS (database)
    ↓
EFS (file storage)

Working perfectly.

  • Zero errors.
  • Zero downtime.
  • Then the client took over.
  • They replaced everything with Kubernetes clusters.

Same application.10x more infrastructure.

Result:

  • system became unreliable.
  • Pods crashing.
  • Database connections exhausted.
  • Files inaccessible.
  • Deployments causing downtime.
  • Zero new features delivered.
  • The system went from working
    to broken.
  •  

Not because the old architecture was wrong.
Because the new one was unnecessary.
That experience taught me
the most important lesson in system design:

The best architecture is the simplest one that solves your actual problems

What Is a Monolith?

Everything in one codebase.
One deployable unit.
myapp/
├── users/
├── orders/
├── payments/
├── inventory/
└── main.py

One deployment:

# entire application running
One database:
PostgreSQL
├── users table
├── orders table
├── payments table
└── inventory table
Everything together.

What Are Microservices?

Split into separate services.
Each service:
owns one business capability.
has its own codebase.
has its own database.
deployed independently.
user-service/
order-service/
payment-service/
inventory-service/
notification-service/
Five separate deployments.
Five separate databases.
Services communicate via:
HTTP/REST APIs
Message queues
gRPC

Monolith-The Real Picture

Not always bad.
Simple to develop:

# need order with user details?
def get_order_with_user(order_id):
    order = Order.objects.get(id=order_id)
    user  = User.objects.get(id=order.user_id)
    return {**order.to_dict(), 'user': user.to_dict()}

One function.
Same codebase.
No network.
No API.

Simple to test:

def test_order_creation():
    user  = create_test_user()
    order = create_order(user.id, items=[...])
    assert order.status == 'pending'

No mocking services.
No network calls.
Simple to deploy:

git push → tests run → deploy one thing

Simple to debug:
Error in production?
One log file.
One stack trace.
One place to look.
No distributed problems:
No network calls between components.
No partial failures.
No distributed transactions.
No saga needed.
No circuit breakers between your own modules.

Monolith Problems

As system grows:

Deployment coupling:

Team A: ready to deploy ✅
Team B: ready to deploy ✅
Team C: bug in their code ❌
→ nobody deploys
→ Team A and B blocked by Team C

Scaling coupling:

Users feature:    low traffic
Payments feature: high traffic

To scale payments:

must scale entire monolith.
Even parts that don't need it.
Wasteful.

Codebase complexity:

100 developers. One codebase.
Merge conflicts everywhere.
Fear of breaking something.
Nobody understands the whole thing.

Slow tests:

Small monolith:  2 minutes
Large monolith:  45 minutes
Change one line: wait 45 minutes

Microservices - The Real Picture

Independent deployment:

Payment team deploys payment-service.
Doesn't affect user-service.
Each team on their own schedule.

Independent scaling:

payment-service gets high traffic?
Scale only payment-service.
user-service stays at 1 instance.
Technology freedom:

user-service:     Python + PostgreSQL
payment-service:  Go + PostgreSQL
search-service:   Java + Elasticsearch

Fault isolation:

notification-service crashes.
Users don't get emails.

But:

order-service still works.
payment-service still works.
Core business continues.

Microservices Problems

Network complexity:

# Monolith: local call, microseconds
order = Order.objects.get(id=order_id)

# Microservice: network call, milliseconds
order = requests.get(
    'http://order-service/orders/' + order_id
)

# can fail + needs retry + needs circuit breaker

Every function call became a network call.
Remember everything from Phase 4?
Message queues (Post 16)
Rate limiting (Post 17)
Circuit breakers (Post 18)
Idempotency (Post 19)
Distributed transactions (Post 20)

All of these exist because of microservices.
Monolith doesn't have most of these problems.

Operational complexity:
Monolith:          1 thing to deploy, monitor, debug
5 microservices:   5 things
20 microservices:  20 things
50 microservices:  50 things

Need:
Kubernetes.
Service mesh.
Distributed tracing.
Centralized logging.
CI/CD per service.
And as I learned firsthand:

Kubernetes without a dedicated DevOps team is a reliability nightmare.
Pods crashing with no clear reason.
Database connections exhausted:
  → EC2: 3 servers × 20 connections = 60 (fine)
  → K8s: 50 pods × 20 connections = 1000 (RDS limit exceeded)

File storage broken:
  → EFS worked perfectly on EC2
  → PVC misconfiguration on K8s broke everything

Deployments causing downtime:
  → rolling deployment misconfigured
  → old pods killed before new ones ready

Same application.
Same database.
Same file storage.
But now unreliable.
Because of unnecessary complexity.

The Biggest Lie in System Design

You've read blog posts.
"Netflix uses microservices."
"Amazon uses microservices."
"You should use microservices."
Here's what they don't tell you:
Netflix started as a monolith.
Amazon started as a monolith.
Uber started as a monolith.
Airbnb started as a monolith.
Every large system started as a monolith.
They moved to microservices when the monolith caused real pain.
Not because microservices are better.
Because their specific problems required it.
Netflix pain:
→ teams blocking each other
→ needed to scale video streaming independently
→ microservices solved THOSE problems

Your startup:
→ 3 developers
→ 1000 users
→ no deployment conflicts
→ microservices add complexity with zero benefit

The Honest Comparison

                   Monolith         Microservices
────────────────────────────────────────────────────
Development         Simple           Complex
Testing             Simple           Complex
Deployment          All or nothing   Independent
Scaling             All together     Independent
Technology          One stack        Multiple
Team autonomy       Low              High
Fault isolation     Low              High
Network calls       None             Many
Distributed issues  None             Many
Operational effort  Low              Very high
Good for            Small teams      Large organizations
                    Early stage      Multiple teams

The Middle Ground - Modular Monolith

The option most people miss.
One codebase.
One deployment.
But internally organized into modules.
Clear boundaries.

myapp/
├── users/
│   ├── models.py
│   ├── services.py
│   └── api.py
├── orders/
│   ├── models.py
│   ├── services.py
│   └── api.py
└── payments/
    ├── models.py
    ├── services.py
    └── api.py

Rules:

# Wrong — direct import across modules
from payments.models import Payment  ❌

# Right — through defined interface
from payments.api import get_payment  ✅

Benefits:
no network calls.
no distributed transactions.
no circuit breakers.
fast tests.
simple deployment.
clear boundaries.
easy to extract into microservice later if needed.
This is what most successful companies actually run.
Not 50 microservices.
A well-organized modular monolith.

When to Go Microservices

Real signals:
Teams blocking each other constantly?
→ microservices

One component needs 10x more scaling?
→ extract that component

Compliance: payment data must be isolated?
→ payment microservice

Team > 50 engineers on same codebase?
→ consider splitting
When NOT to:
Small team (< 10 engineers)
→ monolith

Early stage (< 1 year old)
→ monolith

No deployment conflicts
→ monolith

No DevOps expertise
→ definitely monolith

The Migration Path

Most successful systems follow this:

Stage 1: Monolith
→ build fast
→ validate product
→ don't over-engineer

Stage 2: Modular Monolith
→ organize into modules
→ enforce boundaries
→ prepare for potential split

Stage 3: Selective Extraction
→ identify ONE real pain point
→ extract ONLY that service
→ not everything at once

Stage 4: More Extraction (if needed)
→ extract more as pain appears
→ never extract for the sake of it

Conway's Law

One of the most important concepts.
"Organizations design systems that mirror
their own communication structure." - Melvin Conway, 1967

Simply:
system architecture mirrors team structure.
One team     → monolith (natural)
Three teams  → three services (natural)

Inverse Conway Maneuver:

want three independent services?
create three independent teams.
architecture follows naturally.

What Actually Happened on That Project

Looking back:
the client changed the architecture for the wrong reasons.

Reason 1: Resume-driven development
→ "Kubernetes on my CV" > "system works"

Reason 2: Cargo culting
→ "Netflix uses K8s"
→ "therefore we should too"
→ without asking: are we Netflix?

Reason 3: Premature optimization
→ "we might get 1 million users someday"
→ but: you have zero users today
→ solve today's problems

Reason 4: Looks impressive
→ "Kubernetes sounds good in board meetings"
→ technology chosen for perception
→ not for need
The original architecture:
Load Balancer + EC2 + RDS + EFS

Could have handled:
→ thousands of concurrent users
→ with proper EC2 sizing
→ RDS read replicas when needed
→ ElastiCache for caching
→ Auto Scaling Groups for traffic spikes
→ all managed by AWS
→ all battle-tested
→ all simple to debug at 2am

Companies That Kept It Simple
Stack Overflow:
1.5 billion page views per month.
Runs on:
→ 9 web servers
→ 4 SQL servers
→ 2 load balancers
Not Kubernetes. Not microservices.
Basecamp:
Millions of users.
Runs on a monolith.
MySQL database.
They wrote a book about it:
"The Majestic Monolith"
Simple systems.
Reliable systems.
Teams that can sleep at night.

Mental Model

Monolith         → one codebase, one deployment, simple
Microservices    → separate services, separate databases, complex
Modular monolith → one codebase, clear internal boundaries
Conway's Law     → system mirrors team structure
Deployment coupling → can't deploy one part without others
Scaling coupling → can't scale one part independently
Resume-driven    → wrong reason to add complexity
Cargo culting    → "Netflix does it" ≠ "we should"
Migration path   → monolith → modular → selective extraction
Best architecture → simplest one that solves actual problems
Always start with → monolith
Extract when     → real pain appears, not imaginary future pain

What's Coming Next

Now you know when to split.
But when you do split how do services find each other?
How does Service A know
where Service B is?
Service Discovery and API Gateway.
The glue that holds microservices together.

← Previous Post

Recent posts