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

How to scale netbird #3454

Open
Silex opened this issue Mar 6, 2025 · 3 comments
Open

How to scale netbird #3454

Silex opened this issue Mar 6, 2025 · 3 comments

Comments

@Silex
Copy link
Contributor

Silex commented Mar 6, 2025

Hello,

In a self hosted netbird I have 25 peers and already my CPU sometimes is at 50% because of the TURN/relay connexions.

How can I scale netbird, e.g have multiple relay servers?

Also, how do I know wether my relaying is currently happening through TURN or relay?

For example this relayed connexion:

{
  "fqdn": "axis-accc8ede87b2.netbird.selfhosted",
  "netbirdIp": "100.70.14.71",
  "publicKey": "123456UrZuTzecBWOZNSfVwnLPkd5oNaFX5PRL8sJyg=",
  "status": "Connected",
  "lastStatusUpdate": "2025-03-06T16:22:52.4087872+01:00",
  "connectionType": "Relayed",
  "iceCandidateType": {
    "local": "",
    "remote": ""
  },
  "iceCandidateEndpoint": {
    "local": "",
    "remote": ""
  },
  "relayAddress": "rels://netbird.domain.com:443",
  "lastWireguardHandshake": "2025-03-06T16:30:59.1114675+01:00",
  "transferReceived": 2213324,
  "transferSent": 105412,
  "latency": 0,
  "quantumResistance": false,
  "networks": null
}

Can I assume it's using the relay server because of the relayAddress ? How would a TURN relaying look like?

For the record here's how this client is connected (windows):

OS: windows/amd64
Daemon version: 0.37.1
CLI version: 0.37.1
Management: Connected to https://netbird.domain.com:443
Signal: Connected to https://netbird.domain.com:443
Relays:
  [stun:netbird.domain.com:3478] is Available
  [turn:netbird.domain.com:3478?transport=udp] is Available
  [rels://netbird.domain.com:443] is Available
Nameservers:
FQDN: stvs-pv-laptop1.netbird.stvs
NetBird IP: 100.70.63.243/16
Interface type: Userspace
Quantum resistance: false
Networks: -
Peers count: 18/24 Connected
@1nerdyguy
Copy link

I believe it will use the relay that responds the fastest. So which one you're using depends each time you connect.

@Silex
Copy link
Contributor Author

Silex commented Mar 6, 2025

Well, in self hosted mode there's only one relay... the one of your netbird server (the relay container).

I can't find documentation about how to spawn multiple relay servers, I guess I could load-balance it through traefik but that does not seem the correct way to do it.

@1nerdyguy
Copy link

You're not the first to have this issue. #3383

Basically, right now it's 100% capable to deploy numerous relays. You basicaly spin them up and have to manually edit the management.json on the management server, as outlined here #2566 (comment). or #2566 (comment)

However, the official docs haven't been updated for this. Probably just needs someone to do it and submit a PR at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants