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: performance improvement #5

Merged
merged 9 commits into from
Jul 5, 2023

Conversation

pythonberg1997
Copy link
Contributor

@pythonberg1997 pythonberg1997 commented Jun 14, 2023

Description

This pr is to improve the performance of greenfield.

Changes

Notable changes:

  • add prefetch to speed up block
  • add signature cache
  • add block transaction numbers limit
  • modify db

proxy/app_conn.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
@forcodedancing
Copy link
Collaborator

Not sure whether we need to introduce 3 new ABCI methods.

abci/client/client.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
proxy/app_conn.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
abci/client/client.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
state/execution.go Outdated Show resolved Hide resolved
@pythonberg1997 pythonberg1997 force-pushed the prefetch branch 3 times, most recently from dcfdf94 to b7d17d4 Compare June 27, 2023 09:20
@pythonberg1997 pythonberg1997 changed the title feat: add prefetch to speed up block feat: performance improvement Jul 3, 2023
@pythonberg1997 pythonberg1997 marked this pull request as ready for review July 3, 2023 07:34
mempool/v0/reactor.go Outdated Show resolved Hide resolved
@@ -132,7 +143,7 @@ func (memR *Reactor) GetChannels() []*p2p.ChannelDescriptor {
return []*p2p.ChannelDescriptor{
{
ID: mempool.MempoolChannel,
Priority: 5,
Priority: 1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why change the priority here? There are other channels, e.g., syncing, p2p.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When there're too many txs in mempool, it may affect the vote and proposal's transport. So we set mempool's priority to minimum.

@@ -108,7 +114,7 @@ func (blockExec *BlockExecutor) CreateProposalBlock(
// Fetch a limited amount of valid txs
maxDataBytes := types.MaxDataBytes(maxBytes, evSize, state.Validators.Size())

txs := blockExec.mempool.ReapMaxBytesMaxGas(maxDataBytes, maxGas)
txs := blockExec.mempool.ReapMaxTxsMaxBytesMaxGas(2400, maxDataBytes, maxGas)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change 2400 to a const.

Copy link
Collaborator

Choose a reason for hiding this comment

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

or even config?

startTime := time.Now().UnixNano()
interruptCh := make(chan struct{})
// do pre execute for cache
var wg sync.WaitGroup
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need a wait group here? It seems that one interruptCh is fine.

@pythonberg1997 pythonberg1997 merged commit 460c09a into bnb-chain:develop Jul 5, 2023
@pythonberg1997 pythonberg1997 deleted the prefetch branch July 17, 2023 07:17
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.

5 participants