| Users | Entry Requests/sec | Exit Requests/sec | System Components Impacted | Notes |
|---|---|---|---|---|
| 100 | ~10 | ~10 | Single server handles all flows | Simple synchronous processing |
| 10,000 | ~1,000 | ~1,000 | App server CPU load increases, DB handles more writes | Need load balancing and caching |
| 1,000,000 | ~100,000 | ~100,000 | Database becomes bottleneck, network bandwidth stressed | Introduce sharding, async processing, CDN for static content |
| 100,000,000 | ~10,000,000 | ~10,000,000 | Multiple data centers, global load balancing, complex partitioning | Microservices, event-driven architecture, advanced caching |
Entry and exit flow in LLD - Scalability & System Analysis
Start learning this pattern below
Jump into concepts and practice - no test required
At low scale, the application server CPU and memory handle entry and exit flows easily. As users grow to thousands, the database becomes the first bottleneck because it must process many writes and reads for entry and exit events. The database's limited query per second (QPS) capacity causes delays. Network bandwidth and server CPU become bottlenecks only at very large scale.
- Horizontal Scaling: Add more application servers behind a load balancer to handle increased entry and exit requests.
- Database Read Replicas: Use read replicas to offload read queries from the primary database.
- Caching: Cache frequent queries or session data to reduce database load.
- Sharding: Partition the database by user or region to distribute load.
- Asynchronous Processing: Use message queues to handle entry and exit events asynchronously, smoothing spikes.
- CDN: For static content related to entry/exit flows, use CDN to reduce server load.
- At 10,000 users with 1,000 requests/sec, expect ~80 GB/day of log data storage for entry/exit events.
- Network bandwidth at 1,000 requests/sec with 1 KB payload ≈ 1 MB/s (8 Mbps), manageable on 1 Gbps link.
- Database QPS limit ~5,000; above this, need replicas or sharding.
- Each app server can handle ~2,000 concurrent connections; scale servers accordingly.
Start by describing the flow of entry and exit requests through the system. Identify the components involved and their capacity limits. Discuss how load increases affect each component. Then propose scaling solutions step-by-step, explaining why each is needed. Use real numbers to support your reasoning.
Your database handles 1,000 QPS. Traffic grows 10x to 10,000 QPS. What do you do first?
Answer: Add read replicas and implement caching to reduce load on the primary database before considering sharding or more complex solutions.
Practice
Solution
Step 1: Understand the concept of entry and exit flow
Entry and exit flow describes how users or data enter and leave a system, showing the path they take.Step 2: Identify the purpose in system design
This flow helps designers understand and explain the system's operation clearly, making it easier to improve and test.Final Answer:
To show how users or data move through the system from start to finish -> Option CQuick Check:
Entry and exit flow = user/data movement [OK]
- Confusing entry/exit flow with UI design
- Thinking it lists hardware or languages
- Ignoring the flow of users or data
Solution
Step 1: Identify what an entry point means
An entry point is where users or data first enter the system, such as submitting a form or making a request.Step 2: Match options to entry points
Only 'User submits a login form' is a user action entering the system; others are internal processes.Final Answer:
User submits a login form -> Option BQuick Check:
Entry point = user action start [OK]
- Choosing internal system tasks as entry points
- Confusing monitoring or backup as entry
- Ignoring user interaction as entry
Solution
Step 1: Identify the entry point
The API Gateway is where data enters the system, so it must be first in the flow.Step 2: Follow the data path to exit
Data moves from API Gateway to Processing Service, then exits via Notification Service.Final Answer:
API Gateway -> Processing Service -> Notification Service -> Option DQuick Check:
Entry to exit = API Gateway to Notification Service [OK]
- Reversing the order of services
- Confusing exit with entry points
- Ignoring the processing step
Solution
Step 1: Understand the role of entry and exit points
Entry points are where users or data enter; exit points are where they leave. Mixing them causes confusion.Step 2: Analyze the impact of reversing them
If exit is shown as entry, the system may receive data incorrectly, leading to failures or errors.Final Answer:
Users or data may enter the system incorrectly, causing failures -> Option AQuick Check:
Wrong flow = system errors [OK]
- Assuming reversed flow improves performance
- Thinking system auto-corrects flow
- Ignoring the importance of correct flow direction
Solution
Step 1: Identify scalability needs
Handling thousands of orders requires distributing load and parallel processing to avoid bottlenecks.Step 2: Evaluate each option for scalability
Orders enter via a load balancer, pass through multiple processing queues, and exit via a notification service uses a load balancer and multiple queues, enabling parallel processing and efficient exit via notifications.Step 3: Reject options with bottlenecks or manual steps
Options A, C, and D have single points or manual processes that limit scalability.Final Answer:
Orders enter via a load balancer, pass through multiple processing queues, and exit via a notification service -> Option AQuick Check:
Load balancer + queues = scalable flow [OK]
- Choosing single-thread or manual processing
- Ignoring parallel processing needs
- Overlooking bottlenecks in flow design
