Skip to content

Commit

Permalink
docs: add Optimizing vm.min_free_kbytes for MDBX Storage in Reth do…
Browse files Browse the repository at this point in the history
…cs (#218)
  • Loading branch information
j75689 authored Jan 13, 2025
1 parent 833886f commit 376538e
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,48 @@ Or, opt for installing op-reth with the command:
make install-op
```

## Before setting up the node

### Optimizing `vm.min_free_kbytes` for MDBX Storage in Reth

#### Why Adjust `vm.min_free_kbytes`?

Reth uses **MDBX** as its underlying storage engine, which relies on **memory-mapped I/O (mmap)** for high-performance operations. However, MDBX can consume a significant amount of memory, and in scenarios where applications allocate memory aggressively, the system may run into **memory pressure**.

By increasing `vm.min_free_kbytes`, you can **prevent the Linux OOM (Out-Of-Memory) killer** from terminating essential processes when free memory runs low. This ensures smoother performance and better stability.

#### Recommended Setting

We recommend setting `vm.min_free_kbytes` to at least **4GB (4194304 kbytes)** to ensure system stability when using MDBX.

#### **Linux**

To apply the setting temporarily (until reboot):

```sh
sudo sysctl -w vm.min_free_kbytes=4194304
```

To make it persist across reboots, add the following line to /etc/sysctl.conf:

```sh
echo "vm.min_free_kbytes=4194304" | sudo tee -a /etc/sysctl.conf
```

Then apply the changes:

```sh
sudo sysctl -p
```

### Verifying the Configuration

To verify that the setting has been applied correctly, run:

```sh
cat /proc/sys/vm/min_free_kbytes
```

## Run Reth for BSC

### Hardware Requirements
Expand Down

0 comments on commit 376538e

Please sign in to comment.