0
0
HLDsystem_design~12 mins

Why choosing the right storage matters in HLD - Architecture Impact

Choose your learning style9 modes available
System Overview - Why choosing the right storage matters

This system demonstrates how choosing the right storage affects performance, scalability, and reliability. It shows a typical web application using cache, database, and file storage to handle different data types efficiently.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
+-------------------+
|    Application    |
|      Server       |
+-------------------+
  |          |          
  v          v          v
Cache      Database   File Storage
(Redis)   (SQL DB)    (Object Store)
Components
User
client
Sends requests to the system
Load Balancer
load_balancer
Distributes incoming requests evenly to servers
API Gateway
api_gateway
Routes requests to appropriate services and handles security
Application Server
service
Processes business logic and coordinates data access
Cache (Redis)
cache
Stores frequently accessed data for fast retrieval
Database (SQL DB)
database
Stores structured data with strong consistency
File Storage (Object Store)
storage
Stores large unstructured files like images and videos
Request Flow - 12 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayApplication Server
Application ServerCache (Redis)
Cache (Redis)Application Server
Application ServerDatabase (SQL DB)
Database (SQL DB)Application Server
Application ServerFile Storage (Object Store)
File Storage (Object Store)Application Server
Application ServerAPI Gateway
API GatewayLoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:Database (SQL DB)
Impact:Structured data queries fail; cache may serve stale data; writes are blocked
Mitigation:Use database replication and failover; rely on cache for read availability; queue writes for retry
Architecture Quiz - 3 Questions
Test your understanding
Why does the system check the cache before querying the database?
ATo avoid using the load balancer
BTo store large files efficiently
CTo reduce latency by serving frequent data faster
DTo handle user authentication
Design Principle
Choosing the right storage type for different data ensures the system is fast, scalable, and reliable. Cache speeds up frequent reads, databases provide consistency for structured data, and file storage handles large files efficiently.