Skip to content

Commit 6839e9d

Browse files
Improve discovery docs (#917)
* Improve discovery docs Signed-off-by: Alexandra Tran <[email protected]> * integrate reviewer feedback Signed-off-by: Alexandra Tran <[email protected]>
1 parent 5865243 commit 6839e9d

File tree

3 files changed

+64
-46
lines changed

3 files changed

+64
-46
lines changed

docs/HowTo/Find-and-Connect/Bootnodes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ description: Configuring bootnodoes
44

55
# Bootnodes
66

7-
Using Bootnodes is a method for initially discovering peers. Bootnodes are regular nodes used to
8-
discover other nodes.
7+
You can use bootnodes to initially discover peers.
8+
Bootnodes are regular nodes used to discover other nodes.
99

1010
!!! tip
1111

docs/HowTo/Find-and-Connect/Managing-Peers.md

Lines changed: 58 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,72 +2,89 @@
22
description: Managing Hyperledger Besu peers
33
---
44

5-
# Managing peers
5+
# Manage peers
66

7-
## Limiting peers
7+
Hyperledger Besu peer-to-peer (P2P) discovery happens periodically based on the number of peers in a network and the
8+
node's [peer limit](#limit-peers).
89

9-
Limiting peers reduces the bandwidth used by Hyperledger Besu. Limiting peers also reduces the CPU
10-
time and disk access used to manage and respond to peers.
10+
The frequency of discovery isn't configurable, but you can [limit remote connections](#limit-remote-connections) in
11+
public networks and [randomly prioritize connections](../../Reference/CLI/CLI-Syntax.md#random-peer-priority-enabled)
12+
in small, stable networks.
13+
14+
!!! info
15+
16+
You can use [`admin_addPeer`](../../Reference/API-Methods.md#admin_addpeer) to attempt a specific connection, but
17+
this isn't P2P discovery.
18+
19+
We recommend [using bootnodes](Bootnodes.md) to initially discover peers.
20+
21+
## Limit peers
22+
23+
You can limit peers to reduce the bandwidth, CPU time, and disk access Besu uses to manage and respond to peers.
1124

1225
To reduce the maximum number of peers, use the
1326
[`--max-peers`](../../Reference/CLI/CLI-Syntax.md#max-peers) option. The default is 25.
1427

15-
## No discovery
28+
## Limit remote connections
1629

17-
To disable P2P discovery, use the
18-
[`--discovery-enabled`](../../Reference/CLI/CLI-Syntax.md#discovery-enabled) option.
30+
Prevent eclipse attacks when using [`--sync-mode`](../../Reference/CLI/CLI-Syntax.md#sync-mode) and
31+
[`--fast-sync-min-peers`](../../Reference/CLI/CLI-Syntax.md#fast-sync-min-peers) on public networks by enabling the
32+
[remote connection limits](../../Reference/CLI/CLI-Syntax.md#remote-connections-limit-enabled).
1933

20-
With discovery disabled, peers that have already discovered or are otherwise configured to connect
21-
to the local node (for example, using
22-
[`admin_addPeer`](../../Reference/API-Methods.md#admin_addpeer)) can open connections.
23-
[Static nodes](Static-Nodes.md) can also open connections.
34+
In private and permissioned networks with only trusted peers, enabling the remote connection limits is
35+
unnecessary and might adversely affect the speed at which nodes can join the network.
36+
Limiting remote connections can cause a closed group of peers to form when the number of nodes in the network is
37+
slightly higher than [`--max-peers`](../../Reference/CLI/CLI-Syntax.md#max-peers).
38+
The nodes in this closed group are all connected to each other and can't accept more connections.
39+
40+
!!! tip
41+
42+
You can use [`--random-peer-priority-enabled`](../../Reference/CLI/CLI-Syntax.md#random-peer-priority-enabled) to
43+
help prevent closed groups of peers in small, stable networks.
2444

25-
## Monitoring peer connections
45+
## Monitor peer connections
2646

2747
JSON-RPC API methods to monitor peer connections include:
2848

29-
* [`net_peerCount`](../../Reference/API-Methods.md#net_peercount)
30-
* [`admin_peers`](../../Reference/API-Methods.md#admin_peers)
49+
* [`net_peerCount`](../../Reference/API-Methods.md#net_peercount).
50+
* [`admin_peers`](../../Reference/API-Methods.md#admin_peers).
3151
* [`debug_metrics`](../../Reference/API-Methods.md#debug_metrics).
3252

3353
Each peer entry returned by [`admin_peers`](../../Reference/API-Methods.md#admin_peers) includes a
3454
`protocols` section. Use the information in the `protocols` section to:
3555

36-
* Determine health of peers. For example, an external process could use [`admin_peers`](../../Reference/API-Methods.md#admin_peers)
37-
and [`admin_removePeer`](../../Reference/API-Methods.md#admin_removepeer) to disconnect from peers that
38-
are stalled at a single difficulty for an extended period of time.
56+
* Determine the health of peers.
57+
For example, an external process can use [`admin_peers`](../../Reference/API-Methods.md#admin_peers) and
58+
[`admin_removePeer`](../../Reference/API-Methods.md#admin_removepeer) to disconnect from peers that are stalled at a
59+
single difficulty for an extended period of time.
3960

40-
* Monitor node health. For example, if peers are reporting increasing difficulties but node
41-
is stuck at the same block number, the node may be on a different fork to most peers.
61+
* Monitor node health.
62+
For example, if peers report increasing difficulties but the node is stuck at the same block number, the node may be
63+
on a different fork to most peers.
4264

43-
* Determine which protocol level peers are communicating with. For example, to see if `"version": 65`
44-
is being used to reduce transaction sharing traffic.
65+
* Determine which protocol level peers are communicating with.
66+
For example, you can see if `"version": 65` is being used to reduce transaction sharing traffic.
4567

46-
## Node connections
68+
## List node connections
4769

48-
The default logging configuration does not list node connection and disconnection messages.
70+
The default logging configuration doesn't list node connection and disconnection messages.
71+
To enable listing them, set the [`--logging`](../../Reference/CLI/CLI-Syntax.md#logging) option to `DEBUG`.
72+
For more verbosity, set the option to `TRACE`.
4973

50-
To enable listing of node connection and disconnection messages, specify the
51-
[`--logging`](../../Reference/CLI/CLI-Syntax.md#logging) option `--logging=DEBUG`. For more
52-
verbosity, specify `--logging=TRACE`.
53-
54-
The console logs connection and disconnection events when the log level is `DEBUG` or higher. If
55-
the message `Successfully accepted connection from ...` displays, connections are getting through
56-
the firewalls.
74+
The console logs connection and disconnection events when the log level is `DEBUG` or higher.
75+
If the message `Successfully accepted connection from ...` displays, connections are getting through the firewalls.
5776

5877
!!! example "Sample log output"
5978

60-
`2018-10-16 12:37:35.479-04:00 | nioEventLoopGroup-3-1 | INFO | NettyP2PNetwork | Successfully accepted connection from 0xa979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c`
79+
```bash
80+
2018-10-16 12:37:35.479-04:00 | nioEventLoopGroup-3-1 | INFO | NettyP2PNetwork | Successfully accepted connection from 0xa979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c
81+
```
6182

62-
## Limiting remote connections
83+
## Disable discovery
6384

64-
In private and permissioned networks with a level of trust between peers, enabling the
65-
[remote connection limits](../../Reference/CLI/CLI-Syntax.md#remote-connections-limit-enabled)
66-
is unnecessary and might adversely affect the speed at which nodes can join the network.
67-
Limiting remote connections may cause a clique of nodes to form when the number of nodes in the network is slightly
68-
higher than [`--max-peers`](../../Reference/CLI/CLI-Syntax.md#max-peers).
69-
The nodes in this clique are all connected to each other and cannot accept more connections.
85+
To disable P2P discovery, set the
86+
[`--discovery-enabled`](../../Reference/CLI/CLI-Syntax.md#discovery-enabled) option to `false`.
7087

71-
In public networks, enabling the remote connections limit is necessary to prevent eclipse attacks, especially when
72-
using [`--sync-mode`](../../Reference/CLI/CLI-Syntax.md#sync-mode) and
73-
[`--fast-sync-min-peers`](../../Reference/CLI/CLI-Syntax.md#fast-sync-min-peers).
88+
With discovery disabled, peers can't open connections with the node unless they were previously discovered or manually
89+
peered (for example, using [`admin_addPeer`](../../Reference/API-Methods.md#admin_addpeer)).
90+
[Static nodes](Static-Nodes.md) can also open connections.

docs/Reference/CLI/CLI-Syntax.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2362,7 +2362,7 @@ Defaults to `false`.
23622362
```
23632363

23642364
Allows for incoming connections to be prioritized randomly. Enable in small, stable networks to prevent
2365-
impenetrable peer groups forming. The default is `false`.
2365+
closed groups of peers forming. The default is `false`.
23662366

23672367
### `remote-connections-limit-enabled`
23682368

@@ -2390,8 +2390,9 @@ impenetrable peer groups forming. The default is `false`.
23902390
remote-connections-limit-enabled=false
23912391
```
23922392

2393-
Enables or disables limiting the percentage of remote P2P connections initiated by peers. The
2394-
default is true.
2393+
Enables or disables using the [`--remote-connections-max-percentage`](#remote-connections-max-percentage) option to
2394+
limit the percentage of remote P2P connections initiated by peers.
2395+
The default is `true`.
23952396

23962397
!!! tip
23972398

0 commit comments

Comments
 (0)