Microservices
A set of small, autonomous, independently deployable services, communicating over a network.
Context
An organization with many teams wants to independently deploy and scale specific parts of its system.
Problem
A monolith couples teams, release cycles, and scaling.
Solution
Small services, aligned with a bounded context, each with its own database, communicating via messages or HTTP.
#Example
CSHARP
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Orders │ │ Payments │ │ Shipping │
│ + DB │ │ + DB │ │ + DB │
└────┬─────┘ └────┬─────┘ └────┬─────┘
└─────── Message Bus ───────┘
When NOT to use it
- Small team / early product: operational cost will crush you.
- Without mature observability: you will suffer.
- If services need to share a lot of data in transactions: you are partitioning the domain incorrectly.
Tradeoffs
| Pro | Con |
|---|---|
| Autonomous teams, independent deployment | Complex operations (orchestration, observability) |
| Granular scaling | Latency and network failures everywhere |
| Isolates failures | Eventual consistency |
#architecture #distributed