Skip to content

Instantly share code, notes, and snippets.

@yorickdowne
Last active July 13, 2024 07:57
Show Gist options
  • Save yorickdowne/2b12d29dd4346453f9029ea393b64231 to your computer and use it in GitHub Desktop.
Save yorickdowne/2b12d29dd4346453f9029ea393b64231 to your computer and use it in GitHub Desktop.
Optimal Besu settings for database growth

Overview

Besu, an Ethereum execution layer client, is optimized for minimal database growth (7-8 GiB/week) with default parameter --bonsai-limit-trie-logs-enabled. It can use RAM for more block processing speed.

If you have 64 GiB of RAM or more, you can add --Xplugin-rocksdb-high-spec-enabled=true for better performance.

A long-running Besu DB, started before trie-log limit was enabled, will have sizeable trie log storage. This can be reduced with a one-off prune using the storage trie-log prune subcommand, assuming Besu 24.7.0 or later.

Somer Esat adjustment

If you have 64 GiB of RAM or more, also add --Xplugin-rocksdb-high-spec-enabled=true.

Edit the service:

sudo nano /etc/systemd/system/besu.service

It'll look something like this - your existing options and then the new parameter:

ExecStart=/usr/local/bin/besu/bin/besu \
  --network=mainnet \
  --data-path=/var/lib/besu \
  --engine-jwt-secret=/var/lib/jwtsecret/jwt.hex \
  --Xplugin-rocksdb-high-spec-enabled=true

One-off pruning

If you have a long-running Besu DB, there will be accumulated trie logs in it. These can be pruned once.

Get into screen or tmux, so that the session won't be interrupted

screen

Stop the service

sudo systemctl stop besu

Prune Besu

sudo -u besu besu --data-path=/var/lib/besu storage trie-log prune

Once this is done, start the service

sudo systemctl start besu

Obligatory Docker flex

For users of Eth Docker, these parameters are active by default. A long-running DB can be pruned with ./ethd prune-besu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment