| Users / Scale | System Complexity | Subsystem Calls | Performance Impact | Maintenance Effort |
|---|---|---|---|---|
| 100 users | Simple facade calls few subsystems | Low number of calls, minimal overhead | Negligible latency | Easy to maintain |
| 10,000 users | More concurrent facade requests | Increased subsystem calls, some queuing | Moderate latency possible | Need monitoring for bottlenecks |
| 1,000,000 users | High concurrency, many facade instances | Subsystems may become overloaded | Latency increases, possible timeouts | Complex coordination and scaling needed |
| 100,000,000 users | Massive scale, distributed facades | Subsystems must be highly scalable | Latency critical, failures impact facade | Requires automated scaling and fault tolerance |
Facade pattern in LLD - Scalability & System Analysis
The first bottleneck is usually the subsystems behind the facade. As user requests grow, the facade itself is lightweight but the underlying subsystems it calls can become overloaded. This causes increased latency and failures that propagate through the facade.
- Horizontal scaling: Add more instances of subsystems and facade servers behind load balancers.
- Caching: Cache frequent responses at the facade to reduce subsystem calls.
- Asynchronous calls: Use async messaging to decouple facade from slow subsystems.
- Sharding: Partition data and subsystem responsibilities to reduce load per instance.
- Rate limiting: Protect subsystems by limiting facade request rates.
- Monitoring and circuit breakers: Detect failures early and prevent cascading issues.
- At 1M users, assuming 1 request per second per user, facade handles ~1M RPS.
- Each facade request calls 3 subsystems on average -> 3M subsystem calls per second.
- Subsystem servers handle ~5,000 RPS each -> need ~600 servers total.
- Network bandwidth depends on payload size; assume 10KB per request -> 10GB/s total bandwidth.
- Caching can reduce subsystem calls by 50% or more, cutting server needs and bandwidth.
When discussing facade pattern scalability, start by explaining the facade role as a simple interface. Then identify that subsystems are the real bottleneck as load grows. Discuss how horizontal scaling, caching, and async communication help. Always connect solutions to the bottleneck you identified.
Your database handles 1000 QPS. Traffic grows 10x. What do you do first?
Answer: Add read replicas and caching layers to reduce load on the main database before scaling application servers.