> For the complete documentation index, see [llms.txt](https://liuyang89116.gitbook.io/system-design/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://liuyang89116.gitbook.io/system-design/chapter/harvard_scalability.md).

# Scalability - Harvard lecture

> <https://www.youtube.com/watch?v=-W9F__D3oY4>

## Vertical Scaling

* CPU: cores, L2 cache
* Disk
* RAM

## Horizontal Scaling

* multiple servers
* then we need to distribute requests - load balancer

## load balancer

* round robin is not so good if there's some heavy users in specific server
* RAID (redundant array of independent disks) - RAID works by placing data on multiple disks and allowing input/output (I/O) operations to overlap in a balanced way, improving performance. Because the use of multiple disks increases the mean time between failures (MTBF), storing data redundantly also increases fault tolerance.
* Software: ELB, HAProxy
* Hardware

## Sticky sessions - 断电之类的 single failure

* shared storage
* cookies

## Caching

* .html
* MySQL Query Cache
* memcached

## Replication

* Master-slave
* Master-master
