Skip to content
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

Add Limit Trie Logs Early Access Feature Guide #1495

Closed
wants to merge 4 commits into from

Conversation

siladu
Copy link
Contributor

@siladu siladu commented Jan 31, 2024

@siladu siladu requested a review from a team as a code owner January 31, 2024 07:25
Copy link

vercel bot commented Jan 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
besu-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 2, 2024 6:07am

Copy link
Contributor

@non-fungible-nelson non-fungible-nelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good but this reads like a blog - just clean-up needed. we need to have this long-lived and optimized for SEO/Google.

---
title: Limit Trie Logs for Bonsai
sidebar_position: 12
description: Enable this early access feature to reduce the size of your database
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enable this feature**


1. Update Besu config to add --Xbonsai-limit-trie-logs-enabled but don’t restart yet
1. Stop Besu
1. (optional) Run:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we provide relative paths?

Copy link
Contributor Author

@siladu siladu Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this example, I opted to use the most widely used paths, which fortunately are the same for ethstaker docs and the two most popular step by step guides: Somer Esats and CoinCashew.

I put a warning to not copy and paste, but if ppl still do then it should work out of the box if they followed the popular guides.

`sudo /usr/local/bin/besu/bin/besu --data-storage-format=BONSAI --data-path=/var/lib/besu --sync-mode=X_SNAP storage x-trie-log prune`
1. Start Besu (remembering to run sudo systemctl daemon-reload if you use a systemd service file as per CoinCashew and Somer)
1. Look out for `Limit trie logs enabled: retention: 512; prune window: 30000` in your Besu config printout during startup
1. Enjoy more GBs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enjoy more free space


:::

*Targeting 24.1.2 release, but currently you must be on the Besu `main` branch for this to work*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should wait on this page until the feature is released.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this line


## How?
If you want to use this feature before it is enabled by default, simply add this option to your Besu command: `--Xbonsai-limit-trie-logs-enabled`
When you restart Besu it will begin pruning, block by block (and a cheeky bit during Besu startup).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block by block after an initial reduction in the database.

If you want to use this feature before it is enabled by default, simply add this option to your Besu command: `--Xbonsai-limit-trie-logs-enabled`
When you restart Besu it will begin pruning, block by block (and a cheeky bit during Besu startup).

If you want **maximum database size reduction**, read on.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete


If you have a long-running node, this will not immediately clear your backlog of trie logs in the same way that resyncing does. In order to do this we’re providing a “run once” **offline** command to immediately **prune all your old trie logs in a few minutes or less**. Note, this requires Besu to be shutdown before running, but downtime will be minimal. You will **not** need to run this command a second time if you keep `--Xbonsai-limit-trie-logs-enabled`.

## I’m impatient, reduce my database size now!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this header

If you have a long-running node, this will not immediately clear your backlog of trie logs in the same way that resyncing does. In order to do this we’re providing a “run once” **offline** command to immediately **prune all your old trie logs in a few minutes or less**. Note, this requires Besu to be shutdown before running, but downtime will be minimal. You will **not** need to run this command a second time if you keep `--Xbonsai-limit-trie-logs-enabled`.

## I’m impatient, reduce my database size now!
Okay, okay - we got you! We built a one-off Besu command to remove this extra data (usually in seconds) and avoid having to resync. For minimal downtime, we recommend running this command **before** restarting Besu `--Xbonsai-limit-trie-logs-enabled` (easiest to do it all at the same time).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove okay we got you

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Limit Trie Logs for Bonsai
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonsai... to reduce database size.

change this for SEO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting, "Limit Trie Logs to Reduce Database Size"?

Are you happy to exclude Bonsai from the title? I wanted to make it clear it was irrelevant for FOREST, but if we plan to remove FOREST soon, maybe that doesn't matter.


:::caution

We strongly recommend reading the rest of this documentation before running these commands because your node’s configuration may require changes to these commands.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We strongly recommend reading the rest of this documentation before running these commands because your node’s configuration may require changes to these commands.
Limiting trie logs is an early access feature. Before executing the commands in this guide, ensure you review your node configuration.

## Why?
Some users noticed that resyncing Besu can free up disk space, especially for longer running nodes. This is despite `--data-storage-format=BONSAI` having “implicit pruning”. More on this reddit thread: https://www.reddit.com/r/ethstaker/comments/12xnxxi/clearing_up_besubonsai_confusion_on_state_growth/

In reality, whilst the Merkle Patricia Trie is implicitly pruned, the BONSAI feature did introduce an extra data structure: the Trie Log (more detail about BONSAI and trie logs here: https://consensys.io/blog/bonsai-tries-guide)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this is needed in this guide

Copy link
Contributor Author

@siladu siladu Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, this is better for the initial announcement blog instead

@joaniefromtheblock
Copy link
Contributor

looks good but this reads like a blog - just clean-up needed. we need to have this long-lived and optimized for SEO/Google.

Agree with @non-fungible-nelson. This will have to be rewritten for the tech dev docs. We (docs team) can help with that. Would you prefer if we opened a PR on top of this one for suggestions, or make commits directly to this PR?

1. Look out for `Limit trie logs enabled: retention: 512; prune window: 30000` in your Besu config printout during startup
1. Enjoy more GBs

## What?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move the explanation for why this feature exists early on in the doc... so maybe move this to the start

1. Enjoy more GBs

## What?
We have a new experimental feature available: `--Xbonsai-limit-trie-logs-enabled` which aims to keep Besu’s database as small as it can be. After a brief grace period, we intend to make this enabled by default for stakers. This is only relevant if you're using `data-storage-format=BONSAI`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For tech docs, we typically don't write with a marketing tone and usually opt for language that is a but more succinct and to the point. I think a rewrite for this would be something like:

Suggested change
We have a new experimental feature available: `--Xbonsai-limit-trie-logs-enabled` which aims to keep Besu’s database as small as it can be. After a brief grace period, we intend to make this enabled by default for stakers. This is only relevant if you're using `data-storage-format=BONSAI`.
The feature `--Xbonsai-limit-trie-logs-enabled` minimizes the database size of Besu and requires the use of `data-storage-format=BONSAI`. When enabled, this feature can reduce database growth by more than 3 GB each week.

From our testing, we estimate this will **save users > 3 GB per week** in database growth. Early testing indicates Besu’s **overall database growth with this enabled is ~7 GB per week** (thanks Yorick!) which is on par with geth.

## Why?
Some users noticed that resyncing Besu can free up disk space, especially for longer running nodes. This is despite `--data-storage-format=BONSAI` having “implicit pruning”. More on this reddit thread: https://www.reddit.com/r/ethstaker/comments/12xnxxi/clearing_up_besubonsai_confusion_on_state_growth/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be removed

## Why?
Some users noticed that resyncing Besu can free up disk space, especially for longer running nodes. This is despite `--data-storage-format=BONSAI` having “implicit pruning”. More on this reddit thread: https://www.reddit.com/r/ethstaker/comments/12xnxxi/clearing_up_besubonsai_confusion_on_state_growth/

In reality, whilst the Merkle Patricia Trie is implicitly pruned, the BONSAI feature did introduce an extra data structure: the Trie Log (more detail about BONSAI and trie logs here: https://consensys.io/blog/bonsai-tries-guide)
Copy link
Contributor

@joaniefromtheblock joaniefromtheblock Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed/ rewritten or added Ito an introductory section


`sudo /usr/local/bin/besu/bin/besu --config-file=besu-config.toml storage x-trie-log prune`

## Subcommand Troubleshooting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Subcommand Troubleshooting
## Troubleshoot

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
@siladu
Copy link
Contributor Author

siladu commented Feb 1, 2024

@joaniefromtheblock @non-fungible-nelson Thanks for the reviews. I've implemented basically all of your suggestions including removing the Why section. Responded to a couple of comments too.

Have moved "What" to the top as an intro instead of it's own section.

Happy for Step-by-step to be moved again, I just wanted it at the top for the initial announcement because some people don't read very far down in my experience :)

Feel free to continue editing yourselves if you prefer, I am happy to review.

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
@joaniefromtheblock
Copy link
Contributor

@joaniefromtheblock @non-fungible-nelson Thanks for the reviews. I've implemented basically all of your suggestions including removing the Why section. Responded to a couple of comments too.

Have moved "What" to the top as an intro instead of it's own section.

Happy for Step-by-step to be moved again, I just wanted it at the top for the initial announcement because some people don't read very far down in my experience :)

Feel free to continue editing yourselves if you prefer, I am happy to review.

Thanks @siladu . I'm reviewing this PR now. I'll commit directly to the PR so it aligns more with our tech writing guidelines. Thank you so much for this content and all the work you have done ! It's really really appreciated

@joaniefromtheblock
Copy link
Contributor

Opened another PR @siladu

#1538

@joaniefromtheblock
Copy link
Contributor

Closing in favor of #1538

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants