Okay, let's begin Phase 2: Core System Design Concepts (Building Blocks).
- Goal: Develop a deep understanding of the fundamental building blocks used in distributed systems.
- Duration: 3-4 Weeks
We'll cover these topics:
Advertisement
- Scalability
- Horizontal vs. Vertical Scaling
- Load Balancing
- Stateless vs. Stateful Services
- Data Management
- Databases (SQL, NoSQL, SQL vs. NoSQL, Database Scaling)
- Caching (Strategies, Policies, Types)
- Data Consistency (Strong vs. Eventual, CAP Theorem)
- Networking
- DNS
- TCP/IP Model
- HTTP/HTTPS
- RESTful APIs
- WebSockets
- System Design Patterns
- Microservices Architecture
- Message Queues
- API Gateways
- Proxy Servers
- Content Delivery Networks (CDNs)
- Availability and Reliability
- Redundancy
- Fault Tolerance
- Monitoring and Alerting
- Rate Limiting
- Circuit Breaker Pattern
We'll start with 2.1 Scalability.
2.1.a Horizontal vs. Vertical Scaling
-
Scalability: The ability of a system to handle a growing amount of work. This is a fundamental requirement for any system that expects to grow over time.
-
Vertical Scaling (Scaling Up):
- Definition: Increasing the capacity of a single machine by adding more resources (CPU, RAM, disk space).
- Analogy: Like moving to a bigger house. You have more space, but it's still just one house.
- Pros:
- Simpler to implement (initially).
- No need to change the application code (usually).
- Cons:
- Hard Limit: There's a limit to how much you can upgrade a single machine. You eventually hit a physical or cost barrier.
- Single Point of Failure: If that single machine goes down, the entire system goes down.
- Cost: High-end hardware can be very expensive. The cost doesn't scale linearly (doubling the RAM might more than double the price).
- Example: Upgrading a server from 16GB of RAM to 64GB of RAM.
Advertisement
-
Horizontal Scaling (Scaling Out):
- Definition: Increasing capacity by adding more machines to the system.
- Analogy: Like adding more houses to a neighborhood. You have more overall capacity, and if one house has a problem, the others are still functional.
- Pros:
- No Hard Limit: You can theoretically keep adding machines indefinitely.
- Fault Tolerance: If one machine fails, the others can take over.
- Cost-Effectiveness: You can use commodity hardware, which is generally cheaper than high-end hardware.
- Cons:
- More Complex: Requires load balancing, data replication, and other distributed systems techniques.
- Application Design: The application must be designed to work in a distributed environment (stateless services are often preferred).
- Example: Adding more web servers to a cluster and using a load balancer to distribute traffic among them.
-
When to Use Which:
- Vertical Scaling: Good for small applications with limited growth potential or for situations where simplicity is paramount.
- Horizontal Scaling: Generally preferred for large-scale, distributed systems that require high availability, fault tolerance, and scalability. This is the approach you'll focus on for Google L5 interviews.
-
In an Interview You should be able to discuss horizontal vs. vertical scaling, and state that horizontal scaling is preferable for large-scale distributed systems.
Advertisement