# Memory Levels

## Memory Levels

Designing systems involves balancing speed, cost, and capacity to optimize performance.

#### 1. **CPU Cache (L1, L2, L3 Caches)**:

* **Access Time**: Nanoseconds
* **Description**: Extremely fast but very small. Stores frequently accessed data to speed up processing.

#### 2. **RAM (Main Memory)**

* **Access Time**: Tens of nanoseconds
* **Description**: Larger than CPU caches, used to store currently running programs and data.

#### 3. **SSD (Solid State Drive)**

* **Access Time**: Microseconds
* **Description**: Faster than traditional hard drives, used for storing files and applications.

#### 4. **HDD (Hard Disk Drive)**

* **Access Time**: Milliseconds
* **Description**: Slower than SSDs, used for large-scale storage.

#### 5. **Network Storage (e.g., NAS, SAN)**

* **Access Time**: Milliseconds to seconds (depends on network speed)
* **Description**: Storage accessed over a network, used for shared access to data.

#### 6. **Remote Storage (e.g., Cloud)**

* **Access Time**: Variable, typically slower due to network latency
* **Description**: Data stored in remote servers, accessible over the internet.

{% hint style="info" %}
For obvious reasons, we want low latency and high throughput for any application

**Throughput:** Number of transactions per sec

**Latency:** Response time for a single request

**Cost**: Faster storage is generally more expensive.
{% endhint %}
