| Users / Scale | 100 Users | 10,000 Users | 1,000,000 Users | 100,000,000 Users |
|---|---|---|---|---|
| Domain Model Complexity | Simple, few bounded contexts | Multiple bounded contexts emerge | Many bounded contexts, complex aggregates | Highly modular domains, strict context boundaries |
| Team Structure | Small team, single team owns domain | Multiple teams per bounded context | Large teams, clear ownership per context | Many teams, microservices aligned with contexts |
| Communication | Direct, informal | Defined interfaces between contexts | Asynchronous messaging, event-driven | Automated contracts, API gateways |
| Data Management | Single database, simple schema | Separate databases per bounded context | Database per microservice, eventual consistency | Polyglot persistence, CQRS, event sourcing |
| Scaling Focus | Code clarity, domain understanding | Modularization, decoupling | Service isolation, independent deploys | Global distribution, resilience, automation |
Domain-Driven Design basics in LLD - Scalability & System Analysis
At small scale, the main bottleneck is unclear domain boundaries causing confusion and slow development.
As users grow, the bottleneck shifts to communication overhead between teams and tightly coupled code.
At large scale, data consistency and integration between bounded contexts become the bottleneck.
- Define clear bounded contexts: Separate domain areas to reduce complexity and team conflicts.
- Use context maps: Explicitly document relationships and integration patterns between contexts.
- Apply microservices: Align services with bounded contexts for independent scaling and deployment.
- Implement asynchronous communication: Use events and messaging to decouple contexts and improve scalability.
- Adopt eventual consistency: Accept temporary data differences to improve performance and availability.
- Use domain events and event sourcing: Capture changes as events for auditability and replay.
- Automate testing and deployment: Ensure safe changes in complex domain models.
Assuming 10,000 active users generating 1 request per second:
- Requests per second: ~10,000 QPS
- Database queries: 20,000 QPS (including reads and writes)
- Storage: Depends on domain events and aggregates; estimate 100GB/month for event store
- Network bandwidth: ~100 Mbps assuming 10KB per request/response
- Compute: Multiple app servers to handle load, plus messaging infrastructure
Scaling beyond 100,000 users requires sharding databases, adding read replicas, and partitioning event streams.
When discussing Domain-Driven Design scalability, start by explaining bounded contexts and their importance.
Describe how clear domain boundaries reduce complexity and improve team autonomy.
Explain how asynchronous communication and eventual consistency help scale integrations.
Finally, mention how microservices and event-driven patterns support independent scaling and deployment.
Your database handles 1000 QPS. Traffic grows 10x. What do you do first?
Answer: Introduce read replicas and caching to reduce load on the primary database before considering sharding or redesign.