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

optimization: enqueue transactions in parallel from p2p #173

Merged
merged 4 commits into from
Oct 10, 2024

Conversation

andyzhang2023
Copy link
Contributor

@andyzhang2023 andyzhang2023 commented Sep 11, 2024

Description

Enqueuing a transaction into the txpool, it costs about 80us per transaction to call txpool.Add(tx), within which the txpool.addLocked(tx) costs only 15us.
So by calling txpool.Add(tx) in parallel, we can improve the performance of txpool.Add(tx) from 12KTPS to 60KTPS:

  1. before improvement: 1s/80us = 1000000/80 = 12500
  2. after improvement: 1s/15us = 1000000/15 = 66666

It helps a lot when the traffic is heavy and a lot of transactions are accumulated in the broadcasting caches, like "p2p buffers", TCP read buffer and TCP write buffers.

@andyzhang2023 andyzhang2023 changed the base branch from main to develop September 11, 2024 02:48
@owen-reorg owen-reorg changed the title enqueue transactions in parallel from p2p optimization: enqueue transactions in parallel from p2p Oct 10, 2024
@owen-reorg owen-reorg merged commit 593869d into bnb-chain:develop Oct 10, 2024
2 checks passed
owen-reorg added a commit that referenced this pull request Oct 14, 2024
Co-authored-by: Owen <103096885+owen-reorg@users.noreply.github.com>
Co-authored-by: andyzhang2023 <andyzhang2023@gmail.com>
This was referenced Oct 14, 2024
welkin22 added a commit to welkin22/op-geth that referenced this pull request Oct 28, 2024
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