Skip to content

Commit bef1d1c

Browse files
committed
packages/replication-server: increase maxIncomingPendingConnections significantly, increase other connection limits 2-4x
1 parent 66959d8 commit bef1d1c

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

packages/replication-server/src/libp2p.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ export const options: Libp2pOptions<ServiceMap> = {
5858
connectionManager: {
5959
minConnections: MIN_CONNECTIONS,
6060
maxConnections: MAX_CONNECTIONS,
61+
inboundConnectionThreshold: 999_999_999, // per-second, per-host rate limit (default: 5)
62+
maxIncomingPendingConnections: 512, // default: 10
6163
},
6264

6365
peerDiscovery: bootstrapList.length > 0 ? [bootstrap({ list: bootstrapList })] : [],
@@ -68,16 +70,16 @@ export const options: Libp2pOptions<ServiceMap> = {
6870
services: {
6971
identify: identifyService({
7072
protocolPrefix: "canvas",
71-
maxInboundStreams: 256,
72-
maxOutboundStreams: 64,
73-
maxPushIncomingStreams: 64,
74-
maxPushOutgoingStreams: 32,
73+
maxInboundStreams: 512,
74+
maxOutboundStreams: 256,
75+
maxPushIncomingStreams: 512,
76+
maxPushOutgoingStreams: 256,
7577
}),
7678

7779
ping: pingService({
7880
protocolPrefix: "canvas",
79-
maxInboundStreams: 256,
80-
maxOutboundStreams: 64,
81+
maxInboundStreams: 512,
82+
maxOutboundStreams: 256,
8183
timeout: 20 * second,
8284
runOnTransientConnection: false,
8385
}),
@@ -88,8 +90,8 @@ export const options: Libp2pOptions<ServiceMap> = {
8890
fallbackToFloodsub: false,
8991
allowPublishToZeroPeers: true,
9092
globalSignaturePolicy: "StrictNoSign",
91-
maxInboundStreams: 256,
92-
maxOutboundStreams: 64,
93+
maxInboundStreams: 512,
94+
maxOutboundStreams: 256,
9395
directPeers: bootstrapList.map(multiaddr).map((addr) => {
9496
const id = addr.getPeerId()
9597
assert(id !== null)
@@ -104,10 +106,10 @@ export const options: Libp2pOptions<ServiceMap> = {
104106
publishThreshold: -999_999_999, // default is -50
105107
graylistThreshold: -999_999_999, // default is -80
106108
},
107-
D: 99, // up from 6 - optimal degree of topic mesh
108-
Dlo: 99, //
109-
Dhi: 99, // up from 15 - upper bound of topic mesh peers
110-
Dout: 50, // up from 2 - number of outbound connections to maintain in topic mesh
109+
D: 512, // up from 6 - optimal degree of topic mesh
110+
Dlo: 512, //
111+
Dhi: 512, // up from 15 - upper bound of topic mesh peers
112+
Dout: 256, // up from 2 - number of outbound connections to maintain in topic mesh
111113
}),
112114

113115
fetch: fetchService({

0 commit comments

Comments
 (0)