waku-org / js-waku

JavaScript implementation of Waku v2
https://js.waku.org
Apache License 2.0
162 stars 41 forks source link

feat: add libp2p option for max ping connections #1987

Closed adklempner closed 2 months ago

adklempner commented 2 months ago

Problem

When a peer is connected to js-waku, it often exceeds the default number of incoming streams for libp2p's ping protocol. This causes the multiplexer to drop the entire connection, effectively losing the peer.

Solution

Add an option to overwrite the maximum number of inbound connections for the ping protocol when creating a waku node, and set the default to 10. ## Notes

Contribution checklist:

github-actions[bot] commented 2 months ago

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 180.81 KB (+0.01% 🔺) 3.7 s (+0.01% 🔺) 12.4 s (-34.04% 🔽) 16 s
Waku Simple Light Node 181.19 KB (+0.18% 🔺) 3.7 s (+0.18% 🔺) 23.6 s (+22.11% 🔺) 27.2 s
ECIES encryption 23.08 KB (0%) 462 ms (0%) 3.4 s (-33.89% 🔽) 3.9 s
Symmetric encryption 22.55 KB (0%) 452 ms (0%) 6.1 s (+180.61% 🔺) 6.6 s
DNS discovery 72.42 KB (0%) 1.5 s (0%) 8.9 s (+43.8% 🔺) 10.4 s
Peer Exchange discovery 74.1 KB (0%) 1.5 s (0%) 10.9 s (-0.94% 🔽) 12.3 s
Local Peer Cache Discovery 67.64 KB (0%) 1.4 s (0%) 12.5 s (+43.1% 🔺) 13.9 s
Privacy preserving protocols 38.87 KB (0%) 778 ms (0%) 7.9 s (+17.46% 🔺) 8.7 s
Waku Filter 111.51 KB (0%) 2.3 s (0%) 19.5 s (+1.8% 🔺) 21.8 s
Waku LightPush 110.11 KB (0%) 2.3 s (0%) 11.8 s (-29.17% 🔽) 14 s
History retrieval protocols 110.72 KB (0%) 2.3 s (0%) 16.3 s (-6.01% 🔽) 18.5 s
Deterministic Message Hashing 7.29 KB (0%) 146 ms (0%) 1.7 s (-34.4% 🔽) 1.8 s
danisharora099 commented 2 months ago

@adklempner what is the default value?

adklempner commented 2 months ago

@adklempner what is the default value?

The default set by js-libp2p is 2