[GH-ISSUE #3454] How to scale netbird #7251

Closed
opened 2026-08-05 01:12:10 -04:00 by saavagebueno · 6 comments
Owner

Originally created by @Silex on GitHub (Mar 6, 2025).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/3454

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
Originally created by @Silex on GitHub (Mar 6, 2025). Original GitHub issue: https://github.com/netbirdio/netbird/issues/3454 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: ``` json { "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): ``` config 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 ```
Author
Owner

@1nerdyguy commented on GitHub (Mar 6, 2025):

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

<!-- gh-comment-id:2704494675 --> @1nerdyguy commented on GitHub (Mar 6, 2025): I believe it will use the relay that responds the fastest. So which one you're using depends each time you connect.
Author
Owner

@Silex commented on GitHub (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.

<!-- gh-comment-id:2704913597 --> @Silex commented on GitHub (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.
Author
Owner

@1nerdyguy commented on GitHub (Mar 6, 2025):

You're not the first to have this issue. https://github.com/netbirdio/netbird/issues/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 https://github.com/netbirdio/netbird/issues/2566#issuecomment-2574431104. or https://github.com/netbirdio/netbird/issues/2566#issuecomment-2374767544

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

<!-- gh-comment-id:2704920381 --> @1nerdyguy commented on GitHub (Mar 6, 2025): You're not the first to have this issue. https://github.com/netbirdio/netbird/issues/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 https://github.com/netbirdio/netbird/issues/2566#issuecomment-2574431104. or https://github.com/netbirdio/netbird/issues/2566#issuecomment-2374767544 However, the official docs haven't been updated for this. Probably just needs someone to do it and submit a PR at this point.
Author
Owner

@Silex commented on GitHub (Mar 7, 2025):

Ah great, yeah it looks straightforward thanks 👍

I already have a PR about the Azure AD documentation, maybe I'll make one about this too.

<!-- gh-comment-id:2705746953 --> @Silex commented on GitHub (Mar 7, 2025): Ah great, yeah it looks straightforward thanks 👍 I already have a PR about the Azure AD documentation, maybe I'll make one about this too.
Author
Owner

@Silex commented on GitHub (Mar 7, 2025):

@1nerdyguy: quick question, does it make sense to also scale the TURN servers or is it bound to disappear eventually?

<!-- gh-comment-id:2705845142 --> @Silex commented on GitHub (Mar 7, 2025): @1nerdyguy: quick question, does it make sense to also scale the TURN servers or is it bound to disappear eventually?
Author
Owner

@1nerdyguy commented on GitHub (Mar 7, 2025):

I believe it's bound to disappear. ICE will stick around for session negotiation, AFAIK.

<!-- gh-comment-id:2706454429 --> @1nerdyguy commented on GitHub (Mar 7, 2025): I believe it's bound to disappear. ICE will stick around for session negotiation, AFAIK.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#7251