# Architectual scalability
# Overview
Scalability is the ability of a system to handle an increased workload without losing performance
TIP
AVOID TIGHT COUPLING
# Scaling Data layer
- Replication
- Leader follower
- Multi-leader
- Leaderless
- Sharding
- Scalability
- Improved perf
- Availability
- Distributed cache
- Cache clusters
- Key Distribution
- Cache Invalidation
- CQRS Pattern
- Optimized perf
- Scaling reads & writes
- Flexibility in storage solutions
# DB Scaling
- Denormalization: Reduce complex joins to improve query performance
- Indexing: analyzae the query patterns of the app & create the right index
- Marterizalized views: pre-compute complex query results & store for faster access
- Vertical scaling: boost the DB server by adding more CPU, RAM, ...
- Sharding: Load resources that the page will need before they're needed
- Replication: Create replicas of the primary db on different servers for scaling the reads
- Database caching: Store frequently accessed data in a faster storage layer
# Load balancing
Load balancing use cases:
- Traffic distribution
- High availability
- SSL termination
- Session persistence
- Scalability
- Health monitoring
# API Gateway
API Gateway: A Centralized Hub for API Management
API Gateway use cases:
- Build an ecosystem: Partners collaborate to provide better integrations in the ecosystem
- Shareholder for the Economy: Monetization of APIs for developers & developer teams
- Multi-platform integration: Provide seamless compatibility among different platforms