Skip to content

RS: Clarified formula and examples for disk sizing for heavy write scenarios #1790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,127 @@ description: Sizing considerations for persistent disk space for heavy throughpu
linktitle: Disk sizing
weight: $weight
---
In extreme write scenarios, when AOF is enabled, the AOF rewrite process
may require considerably more disk space for database persistence.

To estimate the required persistent disk space in such cases, use the
formula described below.

**The required persistent disk space for AOF rewrite purposes in extreme
write scenarios, assuming identical shard sizes:**

**X (1 + 3Y +Y²)**
where:
**X** = each shard size
**Y** = number of shards

Following are examples of database configurations and the persistence
disk space they would require in this scenario:

| | Example 1 | Example 2 | Example 3 | Example 4 |
|---|------------|-----------------|------------|-----------------|
| Database size (GB) | 10 | 10 | 40 | 40 |
| Number of shards | 4 | 16 | 5 | 15 |
| Shard size (GB) | 2.5 | 0.625 | 8 | 2.67 |
| Required disk space (GB) | 73 | 191 | 328 | 723 |

For disk size requirements in standard usage scenarios, refer to the
[Hardware
requirements]({{< relref "/operate/rs/installing-upgrading/install/plan-deployment/hardware-requirements.md" >}})
section.
In extreme write scenarios when append-only files (AOF) are enabled, the AOF rewrite process can require considerably more disk space for [database persistence]({{<relref "/operate/rs/databases/configure/database-persistence/">}}).

For disk size requirements for standard usage, see [Hardware requirements]({{< relref "/operate/rs/installing-upgrading/install/plan-deployment/hardware-requirements" >}}).

## Estimate required disk space

To estimate the required persistent disk space for AOF rewrite purposes in extreme write scenarios, use the following formula:

**X (1 + 3Y + Y²)**

Where:
- **X** = size of each shard in GB
- **Y** = number of shards


## Examples

The following examples show how to calculate the persistent disk space required for heavy write scenarios for different database configurations, where:

- **Database size** is the memory limit configured for the database.

- **Number of shards** is the total number of shards (primary shards + replica shards).

### Example 1

- Database size = 10 GB
- Number of shards = 4

1. Calculate the shard size:

```sh
Shard size = database size / number of shards
= 10 GB / 4 shards
= 2.5 GB per shard
```

1. Use the formula to calculate the required persistent disk space:

```sh
Disk space = X (1 + 3Y + Y²)
= 2.5 (1 + 3 × 4 + 4²)
= 2.5 (1 + 12 + 16)
= 2.5 × 29
= 72.5 GB
```

1. Round up to 73 GB of required disk space.

### Example 2

- Database size = 10 GB
- Number of shards = 16

1. Calculate the shard size:

```sh
Shard size = database size / number of shards
= 10 GB / 16 shards
= 0.625 GB per shard
```

1. Use the formula to calculate the required persistent disk space:

```sh
Disk space = X (1 + 3Y + Y²)
= 0.625 (1 + 3 × 16 + 16²)
= 0.625 (1 + 48 + 256)
= 0.625 × 305
= 190.625 GB
```

1. Round up to 191 GB of required disk space.

### Example 3

- Database size = 40 GB
- Number of shards = 5

1. Calculate the shard size:

```sh
Shard size = database size / number of shards
= 40 GB / 5 shards
= 8 GB per shard
```

1. Use the formula to calculate the required persistent disk space:

```sh
Disk space = X (1 + 3Y + Y²)
= 8 (1 + 3 × 5 + 5²)
= 8 (1 + 15 + 25)
= 8 × 41
= 328 GB
```

1. Required disk space: 328 GB.

### Example 4

- Database size = 40 GB
- Number of shards = 15

1. Calculate the shard size:

```sh
Shard size = database size / number of shards
= 40 GB / 15 shards
= 2.67 GB per shard
```

1. Use the formula to calculate the required persistent disk space:

```sh
Disk space = X (1 + 3Y + Y²)
= 2.67 (1 + 3 × 15 + 15²)
= 2.67 (1 + 45 + 225)
= 2.67 × 271
= 723.57 GB
```

1. Round up to 724 GB of required disk space.