Core Module
12 min forge
Scalability Basics
Learn how systems handle growth. Understand the fundamental concepts of vertical vs horizontal scaling and elasticity.
π Scalability Basics
Scalability is the ability of a system to handle a growing amount of work or its potential to be enlarged to accommodate that growth.
π‘ The Logic (ELI5)
Think of a Highway:
- You have a road with 1 lane. Traffic is fine.
- Suddenly, 1,000 more cars arrive. The road is blocked!
- Scaling is how you solve this:
- Option A: Make the 1 lane wider (Vertical Scaling).
- Option B: Add 5 more lanes (Horizontal Scaling).
- Option C: A road that automatically adds lanes when it gets busy and removes them when it's quiet (Elasticity).
π The Deep Dive
Vertical Scaling (Scaling Up)
Adding more power (CPU, RAM, SSD) to an existing server.
- Pros: Simple, no code changes.
- Cons: Has a hard ceiling (you can only buy a server so big); creates a single point of failure (SPOF).
Horizontal Scaling (Scaling Out)
Adding more servers into your pool of resources.
- Pros: No theoretical limit; highly resilient (if one server dies, others take over).
- Cons: Complex; requires a Load Balancer and "Stateless" application design.
Elasticity vs. Scalability
- Scalability: Can you handle 1,000,000 requests if you add enough hardware?
- Elasticity: Can you automatically add/remove that hardware based on real-time traffic (e.g., AWS Auto-Scaling)?
π― Interview Pulse
When to choose which?
Interviewers love to ask: "Why don't we just buy a bigger server?" Answer: Vertical scaling is great for low-traffic sites, but eventually, you hit a cost wall ($$$) and a performance wall. Horizontal scaling is the standard for modern cloud-native apps.
Keywords for the Interview
- Load Balancing: Distributing work across horizontal servers.
- Statelessness: Decoupling user sessions from specific servers so any server can handle any request.
- SPOF (Single Point of Failure): The deadly risk of vertical scaling. ποΈ