Skip to content

[R4R]prefetch state by applying the transactions within one block#704

Merged
unclezoro merged 4 commits intobnb-chain:developfrom
unclezoro:prefetch
Jan 11, 2022
Merged

[R4R]prefetch state by applying the transactions within one block#704
unclezoro merged 4 commits intobnb-chain:developfrom
unclezoro:prefetch

Conversation

@unclezoro
Copy link
Copy Markdown
Contributor

@unclezoro unclezoro commented Jan 7, 2022

Description

By improving the snapshot clean cache hit rate, we can improve the capacity of BSC further.

Rationale

According to the test, the cache hitting rate on BSC is about 94%, while the miss 6% IO will cost 32% of execution time.

We try to preload the state from DB by applying the transactions in advance. It turns out the execution time was reduced by 30%-40%

image

Example

Verified on testnet and mainnet.

Changes

No impact to users

@unclezoro unclezoro changed the title [R4R]prefetch state by apply transactions within one block [R4R]prefetch state by applying transactions within one block Jan 10, 2022
@unclezoro unclezoro changed the title [R4R]prefetch state by applying transactions within one block [R4R]prefetch state by applying the transactions within one block Jan 10, 2022
engine consensus.Engine // Consensus engine used for block rewards
}

// newStatePrefetcher initialises a new statePrefetcher.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be NewStatePrefetcher

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@unclezoro unclezoro merged commit c78ecfb into bnb-chain:develop Jan 11, 2022
unclezoro added a commit that referenced this pull request Feb 17, 2022
* prefetch state by apply transactions within one block

* resolve comments

* stop prefetch once process is done

* update comments

fix ut
keefel pushed a commit to keefel/bsc that referenced this pull request Jun 6, 2022
…b-chain#704)

* prefetch state by apply transactions within one block

* resolve comments

* stop prefetch once process is done

* update comments

fix ut
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