Fundamentals
The notes
Key building blocks
Core principles and the components most systems are built from.
Scalability
- Vertical scaling (scale up): add more power to existing machines (CPU, RAM). Simple but has limits
- Horizontal scaling (scale out): add more machines. Unlimited growth but more complex
Reliability and availability
- Reliability: the system performs consistently without failure
- Availability: percentage of operational time (99.99% = 52.6 min downtime per year)
- Fault tolerance: redundancy, graceful degradation, automatic failover
Performance
- Latency: time between request and response. Critical for user experience
- Throughput: volume of operations processed. Important for concurrent users
Consistency (CAP theorem)
- Distributed systems can only guarantee 2 of 3:
- Consistency: all nodes see the same data
- Availability: every request gets a response
- Partition tolerance: works despite network failures
Load balancer
- Distributes requests across servers
- Prevents overload, improves availability, enables scaling
- Algorithms: round-robin, least connections, weighted distribution
Caching
- Stores frequently accessed data in fast storage
- Cache hit: immediate return
- Cache miss: query the database, store a copy
- Tools: Redis, Memcached, CDNs
Databases
- SQL: structured tables, ACID properties, complex queries. Best for structured data (PostgreSQL, MySQL)
- NoSQL: flexible schemas, prioritizes scalability
- NoSQL types: document (MongoDB), key-value (Redis), column-family (Cassandra)
Message queue
- Asynchronous producer-consumer communication
- Provides reliability, scalability, load smoothing, loose coupling
- Examples: RabbitMQ, Kafka, Amazon SQS
Patterns and trade-offs
Monolithic vs microservices
- Monolithic: a single unit. Simple to develop and deploy, but hard to scale specific features
- Microservices: independent services. Offers independent scaling and faster deployment, but increases operational complexity
Understanding trade-offs (system design balances competing goals)
- Consistency vs availability (CAP theorem)
- Performance vs cost: more resources = better performance
- Simplicity vs flexibility: easy to use vs configurable
The design process
- 1. Understand requirements: gather functional and non-functional requirements, define scale and metrics
- 2. High-level design: create an architectural overview, identify building blocks, draw the data flow
- 3. Detailed design: define data models, APIs, address bottlenecks, plan for failures
Key takeaway. Goal: build scalable, reliable and performant systems that meet business needs. Start simple, measure needs, and evolve as requirements grow.
System design deck
1. Fundamentals
2. Scaling
3. Frontend vs backend
4. Client-server architecture
5. Databases
6. Load balancer
7. Caching
8. Latency vs throughput
9. Availability and redundancy
10. CAP theorem
and many more
Make them stick
Sign in to see every card full size, tick the ones you've got, come back to the rest later, and keep your own notes on each card.