System Design Glossary
Concurrency Models
Thread-per-request Model
- Blocking I/O
Reactive Programming
- Non-blocking I/O
- The program flow transforms from a sequence of synchronous operations, into an asynchronous stream of events.
- Publisher and subscriber don’t need to be on the same thread
DDD (Domain-Driven Design)
此頁面正在建設中。
- Hexagonal Architecture
Distributed System Patterns
- Ambassador - Proxy pattern for offloading common connectivity tasks
- Circuit Breaker - Prevents cascading failures in distributed systems
- CQRS - Command Query Responsibility Segregation
- Event Sourcing - Store state changes as sequence of events
- Leader Election - Coordinate distributed nodes by electing a leader
- Publisher/Subscriber - Asynchronous messaging pattern
- Sharding - Horizontal partitioning of data across nodes
Event-Driven Architecture
Forward Proxy
See Proxy
Hexagonal Architecture
Also known as Ports and Adapters architecture.
Load Balancing Algorithms
- Round Robin
- Weighted Round Robin
- Least Connections
- IP Hash
- Random
LMAX Exchange Architecture
High-performance trading architecture using disruptor pattern.
Reverse Proxy
See Proxy
Thundering Herd(驚群效應)
大量 concurrent 請求同時被喚醒,爭搶同一共享資源,造成瞬間流量暴衝打垮後端。
常見場景:
- Cache Stampede:熱門 cache key 過期 → 所有請求同時打 DB
- Process Wake-up:一個事件喚醒所有 sleeping process,但只有一個能處理
緩解策略:
| 策略 | 說明 |
|---|---|
| Mutex Lock / Single Flight | 只讓一個請求回源,其餘等待結果 |
| Probabilistic Early Expiration | 在 TTL 到期前機率性提前更新,分散壓力 |
| Jitter on TTL | cache 過期時間加隨機抖動,避免集中到期 |
| Cache Warming | 主動預熱,避免冷啟動 |