paradigmxyz / reth

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

Expose budgets for p2p via cli #11637

Open emhane opened 1 week ago

emhane commented 1 week ago

Describe the feature

Default values for budget of in-/egress traffic to process, before yielding thread, may not be safe for all hw setups. This, since another task handles sending of the messages than that which processes them. Responses stay in memory until the thread is yielded, unless the machine has enough cores to send them before task for processing messages yields the thread. (Ref https://github.com/paradigmxyz/reth/issues/8115)

To investigate this, we can expose budgets for batch processing p2p traffic, via cli. This will help find the right defaults, which I suspect will be 1 in most cases to cater for machines meeting only min requirements on RAM and number of cores. Asides helping to set defaults, this can be used to custom fit batch processing p2p messages for each specific machine for likely big perf gains. For example, it may make sense to process certain types of messages faster than others, so the budget for processing those can be set bigger.

The following constants need to be exposed via cli.

https://github.com/paradigmxyz/reth/blob/01f382b739b6db371d5a1a762f99ee1c6366c64e/crates/net/network/src/budget.rs#L1-L43

Additional context

No response

stevencartavia commented 1 week ago

šŸ™‹šŸ½ā€ā™‚ļø

Benjtalkshow commented 1 week ago

@emhane Can this issue be assigned to me? i will carefully implement the feature. thanks

0xdevcollins commented 1 week ago

@emhane, can I be assigned this issue, I'll tackle it as soon as possible

emhane commented 1 week ago

Steven was first. many more issues in the repo though @Benjtalkshow and @devcollinss . recommended to start with anything with label good-first-issue.