# System design and scalability

### Scalability

* **Horizontal vs vertical scaling**
  * Vertical scaling means increasing the resources of a specific node. It's easier than horizontal scaling but it's limited by memory or disk space.
  * Horizontal scaling means increasing the number of nodes.&#x20;
* **Load balancer**
* **Database denormalization and NOSQL**
* **Database partitioning (sharding)**
* **Caching**
* **Asynchronous processing & queues**
* **Network metrics**
  * 1.Bandwidth: The maximum amount of data that can be transfer (bits/gigabytes per second)
  * 2.Throughput: The actual amount of data that is transferred
  * 3.Latency: The delay between the sender sending the sending information and the receiver receiving it
  * 增加傳送道的寬度: Bandwidth, Throughput增加, 但Latency不變
  * 縮短傳送道: Bandwidth, Throughput不變, 但Latency減少
  * 加速: Bandwidth, Throughput增加, Latency減少
* **MapReduce**

### Considerations

* Failures
* Availability
* Reliability
* Read-heavy: cache
* Write-heavy: queuing up the writes
* Security
