Web Development
System Design
Desain sistem yang scalable — load balancing, caching, microservices.
Status Membaca:Belum Dibaca
Daftar Bab (2)
Bab 1 dari 2
Scalability & Architecture
System Design Fundamentals
System design adalah proses mendefinisikan arsitektur, komponen, dan interface sistem untuk memenuhi requirement tertentu.
Monolith vs Microservices
Monolith
Semua fitur dalam satu aplikasi.
┌─────────────────────────────┐
│ Monolith App │
│ ┌──────┐ ┌──────┐ ┌─────┐ │
│ │ Auth │ │Posts │ │Chat │ │
│ └──────┘ └──────┘ └─────┘ │
│ One Database │
└─────────────────────────────┘✅ Mudah develop & deploy awal
✅ Tidak ada network latency antar service
❌ Sulit scale bagian tertentu
❌ Satu error bisa crash semua
Microservices
Setiap fitur jadi service terpisah.
Client
↓
API Gateway
├── Auth Service → Auth DB
├── Post Service → Post DB
└── Chat Service → Chat DB✅ Scale per service
✅ Deploy independen
❌ Kompleks — network calls, distributed tracing
❌ Tidak cocok untuk tim kecil
Load Balancing
Mendistribusikan traffic ke beberapa server.
┌─── Server 1
Client → Load ├─── Server 2
Balancer └─── Server 3
Algoritma:
- Round Robin — bergantian urut
- Least Connections — ke server paling sedikit koneksi
- IP Hash — client yang sama selalu ke server yang samaHorizontal vs Vertical Scaling
Vertical (Scale Up): Horizontal (Scale Out):
Server kecil → besar Tambah server baru
▲ □ □ □
█ → ████ → tambah □ □
▼
Mahal, ada batas Murah, bisa terus tambah