0
0
Microservicessystem_design~10 mins

Service decomposition strategies in Microservices - Scalability & System Analysis

Choose your learning style9 modes available
Scalability Analysis - Service decomposition strategies
Growth Table: Service Decomposition at Different Scales
Users / TrafficSystem CharacteristicsService DecompositionChallenges
100 users Low traffic, simple features Monolith or few coarse-grained services Minimal overhead, easy coordination
10,000 users Moderate traffic, growing features Split by business capabilities (e.g., user, order, payment) Service boundaries start to matter, data duplication risk
1 million users High traffic, many teams, complex domain Fine-grained services, domain-driven design, bounded contexts Inter-service communication overhead, data consistency
100 million users Very high traffic, global scale Highly autonomous services, event-driven, asynchronous flows Network latency, eventual consistency, operational complexity
First Bottleneck

At small scale, the monolithic database or tightly coupled services become the bottleneck due to limited scalability and deployment speed.

As users grow, the main bottleneck shifts to inter-service communication overhead and data consistency challenges between services.

At very large scale, network latency and operational complexity (deployments, monitoring) become the biggest challenges.

Scaling Solutions for Service Decomposition
  • Horizontal scaling: Run multiple instances of services behind load balancers to handle more requests.
  • Service boundaries: Decompose by business capabilities or domain to reduce coupling and improve team autonomy.
  • Data management: Use database per service pattern, with asynchronous events for data sync to reduce tight coupling.
  • Communication: Prefer asynchronous messaging (event buses, queues) over synchronous calls to reduce latency and failures.
  • API gateways: Centralize access and routing to services, enabling easier client interaction and security.
  • Monitoring and automation: Use centralized logging, tracing, and automated deployments to manage complexity.
Back-of-Envelope Cost Analysis

Assuming 1 million users with 1 request per second each:

  • Requests per second: ~1,000,000 QPS total
  • Each service instance handles ~5,000 QPS → need ~200 instances distributed across services
  • Database load: split per service, each DB handles ~5,000 QPS; requires read replicas and sharding
  • Network bandwidth: 1 Gbps = 125 MB/s; high traffic requires multiple network links and CDN for static content
  • Storage: depends on data retention; event logs and databases require scalable storage solutions
Interview Tip: Structuring Scalability Discussion

Start by describing the current scale and system design.

Identify the first bottleneck as traffic grows.

Explain how service decomposition helps isolate and scale parts independently.

Discuss trade-offs between fine-grained and coarse-grained services.

Describe concrete scaling techniques: horizontal scaling, asynchronous communication, data partitioning.

Conclude with operational considerations like monitoring and automation.

Self Check Question

Your database handles 1000 QPS. Traffic grows 10x. What do you do first?

Answer: Introduce read replicas to distribute read load and reduce pressure on the primary database. Also consider caching frequently accessed data to reduce database queries.

Key Result
Service decomposition evolves from monolith to fine-grained microservices as users grow, with the first bottleneck shifting from database limits to inter-service communication and operational complexity.