Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase peer max count significantly #2754

Merged
merged 2 commits into from
Apr 24, 2019

Conversation

ignopeverell
Copy link
Contributor

I think several of our peer-related issues stem from a max count of peers that's much too low. At this point a node can easily support 250 peers on a low-spec machine and so I don't see a lot of reasons to have this limit so low. Having it much higher should help a lot in connecting and keeping peers.

@DavidBurkett
Copy link
Contributor

While I would like to see nodes accepting more peers, did you see this today: #2594 (comment) And @bladedoyle is in gitter right now talking about high cpu usage due to having too many peers.

@ignopeverell
Copy link
Contributor Author

These seem more related to too many txhashset downloads. While increasing peer counts would make that more likely, we should really just throttle those to reasonable levels. I'm actually suspecting someone is being obnoxious right now. In any case, I wouldn't want to block something that'd improve the network overall because we're being stupid in allowing any txhashset download.

@hashmap
Copy link
Contributor

hashmap commented Apr 16, 2019

I think we also should increase PEER_MIN_PREFERRED_COUNT, it's important for nat'ed users. On the other hand a peer consumes 0.7% cpu in average (see a screenshot form a medium ec2 instance) so I'm not sure about we can easily support 250 peers on a low-spec machine

Screenshot 2019-04-16 at 08 16 32

@ignopeverell
Copy link
Contributor Author

My seed is a 2 vCPUs, 2GB machine, but I agree it'd be good to do some profiling to cut some of that CPU activity. I'm not sure I understand the part about PEER_MIN_PREFERRED_COUNT though. Isn't the issue that non NAT'd nodes reject everything above 25 peers right now, refusing new peers that they could potentially accept easily?

@hashmap
Copy link
Contributor

hashmap commented Apr 16, 2019

@ignopeverell The main reason is that we propagate new headers (and the rest) to min_count peers. Also need to check the current code, we have healthy_mix check which makes (used to make?) nat'd nodes gravitate towards min_count.

@antiochp
Copy link
Member

antiochp commented Apr 16, 2019

If we do this we should do review our logic for the various bits of broadcast logic.
I suspect we broadcast to all connected peers when broadcasting some things (txs?)
Others I'm pretty sure we limit (but we may limit as a function of our peer counts).

Even if we decide to connect to 250 peers, we may not want to broadcast txs (blocks, headers) to all 250 peers.

@hashmap
Copy link
Contributor

hashmap commented Apr 16, 2019

@@ -228,7 +228,7 @@ fn comments() -> HashMap<String, String> {
#ban_window = 10800

#maximum number of peers
#peer_max_count = 25
#peer_max_count = 250
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated - but can we use const from code elsewhere to parameterize/templatize these values?
I haven't looked to closely into how painful this would be to do this but its a .rs file so should be possible?

@ignopeverell
Copy link
Contributor Author

Had a look before, but I think if we're connected to 250 we actually want to relay to 250. Alternatively, I could reduce to say 100 to start with until we have figured out CPU bottlenecks. Thoughts?

@ignopeverell ignopeverell merged commit 81a6af9 into mimblewimble:master Apr 24, 2019
@ignopeverell ignopeverell deleted the moarpeers branch April 24, 2019 22:05
@@ -228,7 +228,7 @@ fn comments() -> HashMap<String, String> {
#ban_window = 10800

#maximum number of peers
#peer_max_count = 25
#peer_max_count = 125
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this option be uncommented? Otherwise, it's not really a default but more like a suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or is the default driven by PEER_MAX_COUNT below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default is driven by PEER_MAX_COUNT. Ideally config comments that are generated should be driven by that, as @antiochp mentioned, but it's a little out of scope for this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Opened #2781

@antiochp antiochp added this to the 1.1.0 milestone Jun 5, 2019
@antiochp antiochp added the release notes To be included in release notes (of relevant milestone). label Jun 5, 2019
@nikito7
Copy link

nikito7 commented Jun 26, 2019

Just stats:

14:00:52 up 12 days, 13:42, 1 user, load average: 1.93, 2.26, 1.82

RX packets 91974348 bytes 16989604567 (15.8 GiB)
TX packets 107252270 bytes 64276425320 (59.8 GiB)

20190626 13:59:15.499 DEBUG grin_servers::grin::seed - monitor_peers: on 0.0.0.0:3414, 196 connected (176 most_work). all 4467 = 199 healthy + 5 banned + 4263 defunct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement release notes To be included in release notes (of relevant milestone).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants