Skip to content

performance: commitTire concurrently during Commit#1948

Merged
brilliant-lx merged 1 commit intobnb-chain:developfrom
brilliant-lx:commitTrie
Oct 27, 2023
Merged

performance: commitTire concurrently during Commit#1948
brilliant-lx merged 1 commit intobnb-chain:developfrom
brilliant-lx:commitTrie

Conversation

@brilliant-lx
Copy link
Copy Markdown
Contributor

@brilliant-lx brilliant-lx commented Oct 26, 2023

Description

In StateDB::Commit(), run commmitTrie() concurrently to improve the performance.
Previous commitTrie was changed to be run serially for --pipecommit, but actually, it is ok to run it concurrently.

Rationale

It was broken after v1.3.0 due to a object concurrent access safety, to reenable it

Implementation

the safety was about: StateDB.storages

type StateDB struct {
  ...
  storages       map[common.Hash]map[common.Hash][]byte 
  ...
}

it is used to store the modified KV pair for each address on updateTrie which is called during block validation phase, the key is with Keccak hashed.

@brilliant-lx brilliant-lx changed the title performance: commitTire concurrently performance: commitTire concurrently during Commit Oct 26, 2023
@brilliant-lx
Copy link
Copy Markdown
Contributor Author

run full sync for 2 days, it is ok, so merge the PR.

@brilliant-lx brilliant-lx merged commit fd6e7bb into bnb-chain:develop Oct 27, 2023
@brilliant-lx brilliant-lx deleted the commitTrie branch October 27, 2023 00:55
whw188 pushed a commit to tylerteea/mev-bsc that referenced this pull request Dec 6, 2023
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.

3 participants