Skip to content

Conversation

@ElFantasma
Copy link
Contributor

Currently all our GenServers run on the same thread. Many of those are a single process running forever with the application, and may benefit to be run on their own dedicated thread.

This PR moves to their own threads the DiscoveryServer, PeerTableServer and Initiator.

It also improves PeerConnection logging as it moves many debug lines to trace

@ElFantasma ElFantasma requested a review from a team as a code owner October 17, 2025 16:41
@github-actions github-actions bot added the L1 Ethereum client label Oct 17, 2025
@github-actions
Copy link

github-actions bot commented Oct 17, 2025

Lines of code report

Total lines added: 22
Total lines removed: 0
Total lines changed: 22

Detailed view
+---------------------------------------------------+-------+------+
| File                                              | Lines | Diff |
+---------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/discv4/peer_table.rs | 916   | +10  |
+---------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/discv4/server.rs     | 483   | +3   |
+---------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/initiator.rs    | 107   | +6   |
+---------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/utils.rs        | 100   | +3   |
+---------------------------------------------------+-------+------+

@ElFantasma
Copy link
Contributor Author

ElFantasma commented Oct 17, 2025

Tested on a server on Sepolia with debug_assertions:

2025-10-17T19:50:00.289123Z  INFO ethrex_p2p::network: P2P Snap Sync:
elapsed: 04h 22m 02s 15ms
100 peers.
Current step: Requesting Bytecodes
Current Header Hash: 36e1caefc5e0ce899d7cced9cb3bcf9318657e55601fc870e3c63b3f22eb8215
---
headers progress: 100.00% (total: 9432306, downloaded: 9432324, remaining: 0)
account leaves download: 128745427, elapsed: 00h 00m 55s 00ms
account leaves insertion: 100.00%, elapsed: 00h 10m 04s 00ms
storage leaves download: 651428966, elapsed: 00h 09m 32s 00ms, initially accounts with storage 13565519, healed accounts 9960
storage leaves insertion: 13565519, 00h 46m 02s 02ms
healing: global accounts healed 13719 global storage slots healed 88720, elapsed: 00h 01m 03s 00ms, current throttle \x1b[32mPeers\x1b[0m
bytecodes progress: downloaded: 9764178, elapsed: 00h 14m 21s 00ms)
2025-10-17T19:50:00.916254Z  INFO ethrex_rpc::engine::payload: Received new payload block_hash=0xf349…a3b2 block_number=9433297
2025-10-17T19:50:00.917383Z  WARN ethrex_rpc::engine::payload: Snap sync in progress, skipping new payload validation
2025-10-17T19:50:07.055194Z  INFO ethrex_p2p::sync: Sync cycle finished, time elapsed: 15722 secs

@Arkenan
Copy link
Collaborator

Arkenan commented Oct 20, 2025

This PR may solve #4938

Copy link
Collaborator

@MegaRedHand MegaRedHand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@github-project-automation github-project-automation bot moved this to In Review in ethrex_l1 Oct 20, 2025
@jrchatruc jrchatruc added this pull request to the merge queue Oct 20, 2025
@jrchatruc jrchatruc removed this pull request from the merge queue due to a manual request Oct 20, 2025
@jrchatruc jrchatruc added this pull request to the merge queue Oct 20, 2025
Merged via the queue into main with commit de0802e Oct 20, 2025
43 checks passed
@jrchatruc jrchatruc deleted the start_on_thread branch October 20, 2025 23:35
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l1 Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants