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

[R4R]Prefetch state data on mining process #803

Merged
merged 11 commits into from
Mar 28, 2022

Conversation

qinglin89
Copy link
Contributor

@qinglin89 qinglin89 commented Mar 16, 2022

Description

When miner process mining work, there would be some hard disk access wich are quite time consuming processes.

Rationale

  • Add some prefetch routines to warm up touched data slots by apply transactions concurrently to the given individual state database copy.
    mining-prefetcher-design

Changes

Notable changes:

  • Modify Prefetch inteface so that it would be compatible with mining prefetcher
  • Add PrefetchMining method for state_prefetcher just like Prefetch but a mining version

Performance

The proportion of I/O overhead in mining block cost improvement.(green line represents this version)
811648520509_ pic
The proportion of time delay in mining block process improvement.(green line represents this version)
821648520516_ pic

core/gaspool.go Outdated Show resolved Hide resolved
core/state_prefetcher.go Outdated Show resolved Hide resolved
miner/worker.go Outdated Show resolved Hide resolved
core/state_prefetcher.go Outdated Show resolved Hide resolved
@unclezoro unclezoro changed the title Prefetch state data on mining process [R4R]Prefetch state data on mining process Mar 22, 2022
core/gaspool.go Outdated Show resolved Hide resolved
core/state_prefetcher.go Outdated Show resolved Hide resolved
core/types/transaction.go Outdated Show resolved Hide resolved
core/state_prefetcher.go Outdated Show resolved Hide resolved
miner/worker.go Outdated Show resolved Hide resolved
core/gaspool.go Outdated
@@ -25,6 +25,12 @@ import (
// in a block. The zero value is a pool with zero gas available.
type GasPool uint64

// SetGas set an initial value for gaspool
Copy link
Contributor

Choose a reason for hiding this comment

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

set -> sets

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

core/gaspool.go Outdated Show resolved Hide resolved
core/state_prefetcher.go Outdated Show resolved Hide resolved
core/state_prefetcher.go Outdated Show resolved Hide resolved
core/state_prefetcher.go Show resolved Hide resolved
core/types/transaction.go Outdated Show resolved Hide resolved
core/types/transaction.go Outdated Show resolved Hide resolved
core/types/transaction.go Outdated Show resolved Hide resolved
core/types/transaction.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@unclezoro unclezoro left a comment

Choose a reason for hiding this comment

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

Will do review again after changes

Copy link
Contributor

@setunapo setunapo left a comment

Choose a reason for hiding this comment

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

LGTM

@unclezoro unclezoro merged commit cbf433a into bnb-chain:develop Mar 28, 2022
unclezoro pushed a commit that referenced this pull request Mar 29, 2022
* perf(miner):add mining prefetcher

* fix ineffassign

* fix comments

* fix comments

* fix comments: add AsMessagePrefetch to skip nonce check

* fix comment:refactor check order of method Forward

* fix comments:rename variables

* fix comments: rename

* rename

* fix comments: refactor

* update
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.

6 participants