0
0
HLDsystem_design~12 mins

Why database scaling handles data growth in HLD - Architecture Impact

Choose your learning style9 modes available
System Overview - Why database scaling handles data growth

This system shows how database scaling helps manage increasing amounts of data. As data grows, the system uses scaling techniques to keep performance steady and avoid slowdowns.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
Application Service
  |
  v
+-------------------+       +-------------------+
|   Cache (Redis)   |<----->|   Database Cluster |
+-------------------+       +-------------------+
                              /           \
                             /             \
                    Shard 1 DB           Shard 2 DB
Components
User
client
Sends requests to the system
Load Balancer
load_balancer
Distributes incoming requests evenly to API Gateway instances
API Gateway
api_gateway
Handles client requests, routes them to application services
Application Service
service
Processes business logic and queries data
Cache (Redis)
cache
Stores frequently accessed data to reduce database load
Database Cluster
database_cluster
Stores all persistent data, scaled horizontally by sharding
Shard 1 DB
database_shard
Holds a subset of data to distribute load
Shard 2 DB
database_shard
Holds another subset of data to distribute load
Request Flow - 10 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayApplication Service
Application ServiceCache (Redis)
Cache (Redis)Application Service
Application ServiceDatabase Cluster
Database ClusterApplication Service
Application ServiceCache (Redis)
Application ServiceAPI Gateway
API GatewayUser
Failure Scenario
Component Fails:Database Cluster
Impact:New writes fail and some reads may fail if data is not cached. Cached reads still work.
Mitigation:Use database replication and sharding to isolate failures. Cache helps serve reads during partial DB failure.
Architecture Quiz - 3 Questions
Test your understanding
Why does the system use a cache before querying the database?
ATo replace the database completely
BTo store all user requests permanently
CTo reduce database load and speed up data access
DTo slow down the response time
Design Principle
This design shows horizontal scaling of databases using sharding to handle data growth. Caching reduces database load and improves response time. Load balancers and API gateways ensure smooth request distribution and routing.