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

eth/protocols/handler: add packet sending condition, prevent send small packets frequently; #1776

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

galaio
Copy link
Contributor

@galaio galaio commented Jul 21, 2023

Description

eth/protocols/handler: add packet sending condition, prevent sending small packets frequently;

When profiling the p2p nodes, I found that sendPooledTransactionHashes func wastes the most CPU time.

image

After inspecting the egress packets, it only contains ~1.14 hash per msg with 2500 peers, which sends very small packets too frequently.

So if it's possible to let msg collect more data to send once?

Below is the optimised performance profile:
image

Now it contains ~13 hashes per msg with 1800 peers:
image

Rational

Here add new config params:

  1. minTxPacketSize = 1024, it's very hard to reach. When the size is reached, it will packet ~32 hashes per msg.;
  2. sendPacketTimeout = 300 * time.Millisecond, less time will cause more times sending, and large time will cause more data. I tried 500ms, it will packet > 20 hashes per msg.

Changes

Notable changes:

  • eth/protocols/handler: add packet sending condition, prevent send small packets frequently;

@zzzckck zzzckck marked this pull request as draft April 3, 2024 02:54
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.

2 participants