Getting Service Granularity Right
What you'll learn: How to recognize when services are too small or too large, and find the optimal service boundaries.
The Goldilocks Problem of Service Size
After decomposing a system into microservices, you face a critical question: did you slice too thinly or not enough? Services that are too fine-grained create unnecessary complexity, while overly coarse services defeat the purpose of microservices.
Signs Your Services Are Too Fine-Grained
Too many network calls: If a simple business operation requires 10+ service calls, you've likely over-decomposed. Each network hop adds latency and failure points.
Chatty services: Services that constantly communicate with the same few neighbors might belong together.
Shared fate: If services always deploy together or fail together, they're functionally coupled and should probably merge.
No independent value: A service that only exists to serve one other service is likely too small.
Signs Your Services Are Too Coarse
Multiple teams competing: If several teams need to modify the same service frequently, it's too large.
Mixed concerns: A service handling both payment processing and inventory management violates Single Responsibility.
Deployment bottlenecks: If you can't deploy one feature without coordinating five others within the same service, it's too coarse.
Database sprawl: A single service owning 50+ database tables likely contains multiple bounded contexts.
Finding the Right Size
Use business capabilities as your guide—can a small team understand, own, and evolve this service independently? A good service supports a complete business capability without requiring constant coordination with other services for common operations.
Think of services like city districts: too small (one building per district) creates administrative chaos; too large (one district for the whole city) loses local autonomy.
Key Takeaway: Right-sized services align with business capabilities, can be owned by one team, communicate minimally with others for common operations, and provide independent value without creating excessive network overhead.