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

Lower default connection limits (Swarm.ConnMgr) #9420

Closed
3 tasks
lidel opened this issue Nov 17, 2022 · 1 comment · Fixed by #9467
Closed
3 tasks

Lower default connection limits (Swarm.ConnMgr) #9420

lidel opened this issue Nov 17, 2022 · 1 comment · Fixed by #9467
Assignees
Labels
effort/days Estimated to take multiple days, but less than a week exp/intermediate Prior experience is likely helpful kind/maintenance Work required to avoid breaking changes or harm to project's status quo P2 Medium: Good to have, but can wait until someone steps up topic/bitswap Topic bitswap topic/config Topic config topic/connection-manager Issues related to Swarm.ConnMgr (connection manager)

Comments

@lidel
Copy link
Member

lidel commented Nov 17, 2022

The default limits defined in Swarm.ConnMgr are very old, come from the time when network was very small and DHT was not the best (<0.5), and we had no QUIC transports.

We keep hundreds of connections around:

kubo/config/init.go

Lines 97 to 103 in e34c0da

// DefaultConnMgrHighWater is the default value for the connection managers
// 'high water' mark
const DefaultConnMgrHighWater = 900
// DefaultConnMgrLowWater is the default value for the connection managers 'low
// water' mark
const DefaultConnMgrLowWater = 600

Times changed, and these are, arguably, no longer good defaults. Keeping hundreds of connections around introduces various problems such as ambient bandwidth cost due to bitswap gossip. Every peer asking all peers it is connected to if they have every CID it is tryting to fetch

Proposed change

Lower the implicit defaults for Swarm.ConnMgr.LowWater and Swarm.ConnMgr.HighWater.

What should be the new values?

Brave and IPFS Desktop both run with lowered limits:

Swarm.ConnMgr.LowWater = 20
Swarm.ConnMgr.HighWater = 40

Unless there is a good reason to keep these connections around, I would set default to the same values.

TODO

  • decide on new limits (use 20 / 40 dogfooded in IPFS Desktop in no comments)
  • change implicit defaults in config/init.go
  • create config migration for legacy nodes
    • we've recently removed defaults from user config (IPFS config: lower the ConnMgr.HighWater and LowWater limits brave/brave-browser#13525) but preexisting nodes have values hardcoded in the config
    • we should run one-time migration that inspects Swarm.ConnMgr and removes all fields from the object if they all match legacy defaults:
      {
        "GracePeriod": "20s",
        "HighWater": 900,
        "LowWater": 600,
        "Type": "basic"
      }
      This way old nodes will benefit from less chatty bitswap too.
@lidel lidel changed the title Lower default limits in Swarm.ConnMgr Lower default connection limits (Swarm.ConnMgr) Nov 17, 2022
@lidel lidel moved this to 🥞 Todo in IPFS Shipyard Team Nov 17, 2022
@lidel lidel added topic/bitswap Topic bitswap P2 Medium: Good to have, but can wait until someone steps up topic/connection-manager Issues related to Swarm.ConnMgr (connection manager) topic/config Topic config kind/maintenance Work required to avoid breaking changes or harm to project's status quo exp/intermediate Prior experience is likely helpful effort/days Estimated to take multiple days, but less than a week labels Nov 17, 2022
@BigLep
Copy link
Contributor

BigLep commented Dec 6, 2022

2022-12-06 conversation:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/days Estimated to take multiple days, but less than a week exp/intermediate Prior experience is likely helpful kind/maintenance Work required to avoid breaking changes or harm to project's status quo P2 Medium: Good to have, but can wait until someone steps up topic/bitswap Topic bitswap topic/config Topic config topic/connection-manager Issues related to Swarm.ConnMgr (connection manager)
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants