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

feat: active pbss #1881

Merged
merged 2 commits into from
Sep 26, 2023
Merged

feat: active pbss #1881

merged 2 commits into from
Sep 26, 2023

Conversation

joeylichang
Copy link
Contributor

@joeylichang joeylichang commented Sep 19, 2023

Description

ETH proposed Path-based state scheme (PBSS) and released it in v1.1.2. PBSS has obvious advantages in inline prune, disk IO, and disk capacity, it can improve the performance of the import block and reduce disk costs. This PR is to activate PBSS on BSC. PBSS design can be found in Ethereum Path-Based Storage Model and Newly Inline State Prune.

Rationale

Performance

Prior to this PR, our team did a quick performance test based on the released BSC v1.2.11. Following is the 13 days comparison of BSC v1.2.11 + PBSS node(172.22.43.76) and a BSC v1.2.11 node(172.22.42.157)

Hardware: 16core, 64G, 3000 IOPS 125M/S SSD.

Head Blcok

BSC v1.2.11 + PBSS catches up to 1200w+ block.
BSC v1.2.11 catches up to 730w+ block.
image

Import Block Cost

image

Chain validation

image

Chain execution

image

Chain commit

image

ETHDB size

BSC v1.2.11 + PBSS node no trie nodes history, only store the latest world state.
image

Example

  • --state.scheme : Scheme to use for storing ethereum state ('hash' or 'path')", default is hash.
  • --history.state : Number of recent blocks to retain state history for (default = 90,000 blocks, 0 = entire chain).
  • --history.transactions : Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain),

Changes

Notable changes:

@@ -541,6 +545,8 @@ func traverseState(ctx *cli.Context) error {
defer stack.Close()

chaindb := utils.MakeChainDatabase(ctx, stack, true, false)
triedb := trie.NewDatabase(chaindb, nil)
Copy link
Collaborator

Choose a reason for hiding this comment

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

defer chaindb.Close() before new triedb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

cmd/geth/snapshot.go Outdated Show resolved Hide resolved
core/rawdb/ancient_utils.go Outdated Show resolved Hide resolved
core/rawdb/ancient_utils.go Outdated Show resolved Hide resolved
core/state/pruner/pruner.go Outdated Show resolved Hide resolved
core/state/snapshot/generate.go Outdated Show resolved Hide resolved
core/state/database.go Show resolved Hide resolved
log.Warn("The flag --txlookuplimit is deprecated and will be removed, please use --history.transactions")
cfg.TransactionHistory = ctx.Uint64(TxLookupLimitFlag.Name)
}
if ctx.String(GCModeFlag.Name) == "archive" && cfg.TransactionHistory != 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

	if ctx.String(GCModeFlag.Name) == "archive" && ctx.Uint64(TxLookupLimitFlag.Name) != 0 {
		ctx.Set(TxLookupLimitFlag.Name, "0")
		log.Warn("Disable transaction unindexing for archive node")
	}
	if ctx.IsSet(LightServeFlag.Name) && ctx.Uint64(TxLookupLimitFlag.Name) != 0 {
		log.Warn("LES server cannot serve old transaction status and cannot connect below les/4 protocol version if transaction lookup index is limited")
	}

then should these lines need to be deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the latest commit has deleted this part.

trie/triedb/pathdb/disklayer.go Outdated Show resolved Hide resolved
trie/triedb/pathdb/journal.go Outdated Show resolved Hide resolved
trie/triedb/pathdb/layertree.go Outdated Show resolved Hide resolved
trie/triedb/pathdb/nodebuffer.go Outdated Show resolved Hide resolved
* all: activate pbss

* core/rawdb: fix compilation error

* cma, core, eth, les, trie: address comments

* cmd, core, eth, trie: polish code

* core, cmd, eth: address comments

* cmd, core, eth, les, light, tests: address comment

* cmd/utils: shorten log message

* trie/triedb/pathdb: limit node buffer size to 1gb

* cmd/utils: fix opening non-existing db

* cmd/utils: rename flag name

* cmd, core: group chain history flags and fix tests

* core, eth, trie: fix memory leak in snapshot generation

* cmd, eth, internal: deprecate flags

* all: enable state tests for pathdb, fixes

* cmd, core: polish code

* trie/triedb/pathdb: limit the node buffer size to 256mb

---------

Co-authored-by: Martin Holst Swende <[email protected]>
Co-authored-by: Péter Szilágyi <[email protected]>
core/blockchain.go Outdated Show resolved Hide resolved
fix: lint error

fix: ut error

fix: code review comments
@joeylichang joeylichang merged commit 528d97b into develop Sep 26, 2023
5 checks passed
This was referenced Oct 18, 2023
@joeylichang joeylichang deleted the pbss_active branch November 7, 2023 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r4r ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants