Besu, an Ethereum execution layer client, can be optimized for minimal database growth (7-8 GiB/week), and for block processing speed.
The relevant parameter is --Xbonsai-limit-trie-logs-enabled=true
If you have 64 GiB of RAM or more, you can also add --Xplugin-rocksdb-high-spec-enabled=true
for even better performance.
A long-running Besu DB will have sizeable trie log storage. This can be reduced with a one-off prune using the
storage x-trie-log prune
subcommand.
Edit the service:
sudo nano /etc/systemd/system/besu.service
Add two lines to ExecStart
. You'll add a \
to the last line, then ones more line after that. It'll look something
like this, with the new lines after the jwt secret:
ExecStart=/usr/local/bin/besu/bin/besu \
--network=mainnet \
--data-path=/var/lib/besu \
--engine-jwt-secret=/var/lib/jwtsecret/jwt.hex \
--Xbonsai-limit-trie-logs-enabled=true
If you have 64 GiB of RAM or more, also add --Xplugin-rocksdb-high-spec-enabled=true
so it looks something like this instead
ExecStart=/usr/local/bin/besu/bin/besu \
--network=mainnet \
--data-path=/var/lib/besu \
--engine-jwt-secret=/var/lib/jwtsecret/jwt.hex \
--Xbonsai-limit-trie-logs-enabled=true \
--Xplugin-rocksdb-high-spec-enabled=true
Keep an eye on release notes, as the trie log parameter will be renamed to --bonsai-limit-trie-logs-enabled
and become default, likely from Besu 24.6.0
If you have a long-running Besu DB, there will be accumulated trie logs in it. These can be pruned once, and from there the trie log pruning parameter in ExecStart takes care of any new entries.
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 x-trie-log prune
Once this is done, start the service
sudo systemctl start besu
For users of Eth Docker, these parameters are active by default. A long-running
DB can be pruned with ./ethd prune-besu
.