paradigmxyz / reth

Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust
https://reth.rs/
Apache License 2.0
3.53k stars 912 forks source link

`P2PStream`, flush once at end of egress batch #8399

Open emhane opened 1 month ago

emhane commented 1 month ago

Describe the feature

P2Pstream calls poll_flush for each queued egress message, before calling start_send for the next. Instead, poll_flush should only be called once before the loop and once after the loop. According to docs, poll_ready should be called before each call to start_send. So, this also requires modifying poll_ready, to not call poll_flush

This will increase egress throughput. The Sink implementation on the P2PStream, constraints the Sink implementation on all layers above, like EthStream.

https://github.com/paradigmxyz/reth/blob/72f2f1b850a9454789f3ebb3f6efccaee4125659/crates/net/eth-wire/src/p2pstream.rs#L619-L635

https://github.com/paradigmxyz/reth/blob/72f2f1b850a9454789f3ebb3f6efccaee4125659/crates/net/eth-wire/src/p2pstream.rs#L539-L574

Additional context

No response

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open for 21 days with no activity.