-
Notifications
You must be signed in to change notification settings - Fork 33
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
Update stream limits and connection limits #53
Changes from 9 commits
92882b2
3fe2dd4
b226ef8
d415745
41cd3a9
70229dc
565ae77
817a5be
e27b667
13c0675
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,16 +17,22 @@ import { BOOTSTRAP_NODE, CHAT_TOPIC, CIRCUIT_RELAY_CODE } from './constants' | |
import * as filters from "@libp2p/websockets/filters" | ||
|
||
// @ts-ignore | ||
import { circuitRelayTransport, circuitRelayServer } from 'libp2p/circuit-relay' | ||
import { circuitRelayTransport } from 'libp2p/circuit-relay' | ||
|
||
|
||
export async function startLibp2p() { | ||
// localStorage.debug = 'libp2p*,-*:trace' | ||
// application-specific data lives in the datastore | ||
|
||
// libp2p is the networking layer that underpins Helia | ||
const libp2p = await createLibp2p({ | ||
dht: kadDHT({protocolPrefix: "/universal-connectivity", maxInboundStreams: 100, maxOutboundStreams: 100, clientMode: true}), | ||
// set the inbound and outbound stream limits to these values | ||
// because we were seeing a lot of the default limits being hit | ||
dht: kadDHT({ | ||
protocolPrefix: "/universal-connectivity", | ||
maxInboundStreams: 5000, | ||
maxOutboundStreams: 5000, | ||
clientMode: true | ||
}), | ||
transports: [webTransport(), webSockets({ | ||
filter: filters.all, | ||
}), webRTC({ | ||
|
@@ -45,8 +51,8 @@ export async function startLibp2p() { | |
}),], | ||
connectionEncryption: [noise()], | ||
connectionManager: { | ||
maxConnections: 200, | ||
minConnections: 1, | ||
maxConnections: 10, | ||
minConnections: 50, | ||
}, | ||
streamMuxers: [yamux()], | ||
peerDiscovery: [ | ||
|
@@ -64,12 +70,15 @@ export async function startLibp2p() { | |
ignoreDuplicatePublishError: true, | ||
}), | ||
identify: { | ||
maxPushOutgoingStreams: 100, | ||
maxInboundStreams: 100, | ||
maxOutboundStreams: 100, | ||
// these are set because we were seeing a lot of identify and identify push | ||
// stream limits being hit | ||
maxPushOutgoingStreams: 1000, | ||
maxPushIncomingStreams: 1000, | ||
maxInboundStreams: 1000, | ||
maxOutboundStreams: 1000, | ||
Comment on lines
+69
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am concerned by this. These limits are per connection, this means you're allowing 1000 identify streams to be open at the same time on each connection. If you're seeing errors it sounds like something's not cleaning up the streams. Maybe related: libp2p/js-libp2p#1424 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do what you have to to appease the demo gods though - this is more of a note to self to investigate. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah the upper bounds here are crazy, but we were hitting the limits quite often so set it arbitrarily high |
||
}, | ||
autonat: { | ||
startupDelay: 60 * 60 *24 * 1000, | ||
startupDelay: 60 * 60 * 24 * 1000, | ||
}, | ||
}) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minConnections
needs to be less thanmaxConnections
.Is there a reason you're overriding this? If not I'd just remove the whole
connectionManager
block.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed, I'm not sure why it was added. @maschad any idea?