# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jenhsuan.gitbook.io/algorithm/algorithms-in-a-nutshell/system-design-and-scalability.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
