| Users | System Components | Design Focus | Challenges |
|---|---|---|---|
| 100 users | Single server, simple database | Basic architecture, clear modules | Basic reliability and usability |
| 10,000 users | Multiple servers, load balancer, database replicas | Scalability, fault tolerance | Handling concurrent requests, data consistency |
| 1 million users | Distributed services, caching layers, sharded databases | High availability, performance optimization | Data partitioning, network latency, failover |
| 100 million users | Global data centers, CDN, microservices, event-driven systems | Global scalability, disaster recovery | Data synchronization, cost management, complex monitoring |
What high level design encompasses in HLD - Scalability & System Analysis
At the start, the database is usually the first bottleneck because it handles all data storage and queries. As users grow, the single database server struggles with read/write operations and connection limits.
- Vertical Scaling: Upgrade server hardware to handle more load temporarily.
- Horizontal Scaling: Add more servers behind load balancers to distribute traffic.
- Caching: Use caches like Redis or Memcached to reduce database load.
- Database Replication: Use read replicas to spread read queries.
- Sharding: Split database into parts to handle more data and queries.
- Content Delivery Network (CDN): Cache static content closer to users to reduce latency.
Assuming 10,000 users with 1 request per second each:
- Requests per second: 10,000 QPS
- Database: Needs to handle ~10,000 QPS (likely requires replicas and caching)
- Storage: Depends on data size per user; e.g., 1MB/user -> 10GB total
- Bandwidth: 10,000 QPS * 100KB response ≈ 1GB/s (8Gbps network needed)
Start by explaining the main components of high level design: modules, data flow, and interactions. Then discuss how these components change as the system scales. Always mention bottlenecks and your approach to solve them step-by-step.
Your database handles 1000 QPS. Traffic grows 10x. What do you do first?
Answer: Add read replicas and implement caching to reduce load on the main database before considering more complex solutions.
Practice
Solution
Step 1: Understand the purpose of HLD
HLD focuses on the big picture, showing main parts and their relationships.Step 2: Differentiate from detailed design
Detailed code or UI specifics are not part of HLD but come later in design phases.Final Answer:
The main components and how they connect -> Option BQuick Check:
HLD = Big parts and connections [OK]
- Confusing HLD with detailed design
- Thinking HLD includes UI styling
- Assuming HLD shows exact code
Solution
Step 1: Identify typical HLD contents
HLD includes diagrams of components and their interactions, not code or UI details.Step 2: Eliminate incorrect options
Code snippets, SQL queries, and UI mockups belong to detailed design or implementation.Final Answer:
Component diagrams showing system parts -> Option AQuick Check:
HLD = component diagrams [OK]
- Including code snippets in HLD
- Confusing HLD with low-level design
- Adding UI mockups in HLD
Solution
Step 1: Analyze component connections
Sequence connection means data moves in order from first to last component.Step 2: Determine flow direction
Data flows from A to B to C as per the sequence shown.Final Answer:
Data flows from A to B to C -> Option AQuick Check:
Sequence = A -> B -> C data flow [OK]
- Reversing data flow direction
- Assuming random data flow
- Ignoring component connections
Solution
Step 1: Identify missing architectural layer
Backend services handle logic and security between UI and database.Step 2: Understand why direct UI to database is bad
Direct connection risks security and breaks separation of concerns.Final Answer:
Missing backend layer to handle business logic -> Option CQuick Check:
Backend needed between UI and database [OK]
- Thinking UI can safely connect to database
- Ignoring backend role
- Confusing component count with design quality
Solution
Step 1: Identify scalable system components
Load balancers, web servers, and databases are key parts for scalability.Step 2: Exclude irrelevant details
CSS styles, SQL queries, and sensitive data are not part of HLD.Final Answer:
Components like load balancers, web servers, and databases with their interactions -> Option DQuick Check:
HLD = scalable components + interactions [OK]
- Adding UI styles in HLD
- Including sensitive data in design
- Confusing HLD with implementation details
Ready to prove it?
Pass the test and this pattern moves unknown
