From e8b4dec6492784d34c25bd03005dd43878a9843b Mon Sep 17 00:00:00 2001 From: Matt Nelson <85905982+non-fungible-nelson@users.noreply.github.com> Date: Thu, 28 Mar 2024 13:25:35 -0400 Subject: [PATCH] Updating bonsai historical block limit to be more clear (#1548) * updating bonsai historical block limit to be moer clear Signed-off-by: Matt Nelson <85905982+non-fungible-nelson@users.noreply.github.com> * Apply suggestions from code review Signed-off-by: Alexandra Tran Carrillo <12214231+alexandratran@users.noreply.github.com> --------- Signed-off-by: Matt Nelson <85905982+non-fungible-nelson@users.noreply.github.com> Signed-off-by: Alexandra Tran Carrillo <12214231+alexandratran@users.noreply.github.com> Co-authored-by: Alexandra Tran Carrillo <12214231+alexandratran@users.noreply.github.com> --- .../concepts/data-storage-formats.md | 32 +++++++++---------- docs/public-networks/reference/cli/options.md | 8 ++++- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/docs/public-networks/concepts/data-storage-formats.md b/docs/public-networks/concepts/data-storage-formats.md index 0c2e4917d3f..71a27eb5250 100644 --- a/docs/public-networks/concepts/data-storage-formats.md +++ b/docs/public-networks/concepts/data-storage-formats.md @@ -8,7 +8,21 @@ tags: # Data storage formats -Besu offers two formats for storing the world state, [Forest of Tries](#forest-of-tries) and [Bonsai Tries](#bonsai-tries). +Besu offers two formats for storing the world state, [Bonsai Tries](#bonsai-tries) and [Forest of Tries](#forest-of-tries). + +## Bonsai Tries + +Bonsai Tries is a data storage layout policy designed to reduce storage requirements and increase read performance. + +Bonsai stores leaf values in a trie log, separate from the branches of the trie. Bonsai stores nodes by the location of the node instead of the hash of the node. Bonsai can access the leaf from the underlying storage directly using the account key. This greatly reduces the disk space needed for storage and allows for less resource-demanding and faster read performance. Bonsai inherently prunes orphaned nodes and old branches. + +To run a node with Bonsai Tries data storage format, use the command line option [`--data-storage-format=BONSAI`](../reference/cli/options.md#data-storage-format). + +

+ +![Bonsai_tries](../../assets/images/Bonsai_tries.png) + +

## Forest of Tries @@ -43,20 +57,6 @@ Pruning is being deprecated for [Bonsai Tries](#bonsai-tries) and is currently n ::: -## Bonsai Tries - -Bonsai Tries is a data storage layout policy designed to reduce storage requirements and increase read performance. - -Bonsai stores leaf values in a trie log, separate from the branches of the trie. Bonsai stores nodes by the location of the node instead of the hash of the node. Bonsai can access the leaf from the underlying storage directly using the account key. This greatly reduces the disk space needed for storage and allows for less resource-demanding and faster read performance. Bonsai inherently prunes orphaned nodes and old branches. - -To run a node with Bonsai Tries data storage format, use the command line option [`--data-storage-format=BONSAI`](../reference/cli/options.md#data-storage-format). - -

- -![Bonsai_tries](../../assets/images/Bonsai_tries.png) - -

- ## Forest of Tries vs. Bonsai Tries ### Storage requirements @@ -67,7 +67,7 @@ Forest mode uses significantly more memory than Bonsai. With an [archive node](. Forest mode must go through all the branches by hash to read a leaf value. Bonsai can access the leaf from the underlying storage directly using the account key. Bonsai will generally read faster than forest mode, particularly if the blocks are more recent. -However, Bonsai becomes increasingly more resource-intensive the further in history you try to read data. To prevent this, you can limit how far Bonsai looks back while reconstructing data. The default limit Bonsai looks back is 512. To change the parameter, use the [`--bonsai-historical-block-limit`](../reference/cli/options.md#bonsai-historical-block-limit) option. +However, Bonsai becomes increasingly more resource-intensive the further in history you try to read data. To prevent this, you can limit how far Bonsai looks back while reconstructing data. The default limit Bonsai looks back is 512. To change the parameter, use the [`--bonsai-historical-block-limit`](../reference/cli/options.md#bonsai-historical-block-limit) option. This might directly impact [JSON-RPC API](../reference/api/index.md) queries. :::note diff --git a/docs/public-networks/reference/cli/options.md b/docs/public-networks/reference/cli/options.md index 73cb3ca074c..6970aea9313 100644 --- a/docs/public-networks/reference/cli/options.md +++ b/docs/public-networks/reference/cli/options.md @@ -356,7 +356,13 @@ bonsai-historical-block-limit=256 -When using [Bonsai Tries](../../concepts/data-storage-formats.md#bonsai-tries), the [maximum number of previous blocks](../../concepts/data-storage-formats.md#accessing-data) for which Bonsai can reconstruct a historical state. The default is 512. +When using [Bonsai Tries](../../concepts/data-storage-formats.md#bonsai-tries), the [maximum number of previous blocks](../../concepts/data-storage-formats.md#accessing-data) for which Bonsai can reconstruct a historical state. The default is 512. + +:::note + +If you plan on querying historical blocks or state using the [JSON-RPC API](../api/index.md), you might need to adjust the default value or your configured value to avoid errors. + +::: ### `bootnodes`