Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds optional jitter to our initial reconnection to our persistent peers. Currently we will attempt reconnections to all peers simultaneously, which results in large amount of contention as the number of channels a node has grows. We resolve this by adding a randomized delay between 0 and 30 seconds for all persistent peers. This spreads out the load and contention to resources such as the database, read/write pools, and memory allocations. On my node, this allows to start up with about 80% of the memory burst compared to the all-at-once approach. This also has a second-order effect in better distributing messages sent at constant intervals, such as pings. This reduces the concurrent jobs submitted to the read and write pools at any given time, resulting in better reuse of read/write buffers and fewer bursty allocation and garbage collection cycles.
- Loading branch information
1 parent
4de7d0c
commit e0c4b24
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters