System Design Basics
#system design
- 2 minutes read - 273 words
Consideration While Attempting a System Design Problem
- Understand the problem and strict requirements
- Clarify design consideration
- Based on requirements and consideration do a simple estimation of performance and capacity
- Create a high level design of components
- For every components discuss the need for high availability and how to address that requirement
- Get the final component design and architecture and discuss single point failures and tradeoffs
- Design individual components
- Justify each design choice, its tradeoffs and other possible options
Web Host vs VPS
Web Host are server applications running on a physical server which can host multiple web resources. nginx, apache etc are examples of web hosts where admin can host multiple websites.
VPS are dedicated servers which can run any application and in some cases a web host.
Vertical Scaling
Upgrading a single machine by increasing RAM, Disk, Network Capacity or CPU capacity
Horizontal Scaling
Adding more machines and load balancing the application traffic.
- Most basic Load balancing technique is round robin using DNS bind. Basically assign multiple IP addresses to your domain name and DNS query will handle the lb.
RAID
Redundant array of independant disk
- RAID0: Data stripping, two disk array of identical data, alternate write of data chunk, improves speed.
- RAID1: Two disk, data mirroring, data safety.
- RAID10: RAID1 and RAID0, four disks.
- RAID5: One disk for redundancy and rest for performance.
Sticky Session
LoadBalancing persistency. Insert cookie to remember backend server
Caching
- Generate html pages on disk
- MySQL query cache
- memcached (key-value pair)
- LRU caching (capacity)
Databases
Data Replication
- Master - Slave
- Master - Master - Slave
LB HA : High Availability
- Active Active
- Active Passive
Remote/Shared disks
- iSCSI