Skip to content

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;

@galaio galaio requested review from brilliant-lx, buddh0 and j75689 July 21, 2023 08:01
@galaio galaio force-pushed the opt-newpooledmsg branch from 4f7f008 to 8145765 Compare July 21, 2023 08:29
@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.

3 participants