[GH-ISSUE #2950] [Relay] chosen home relay server is random #6500

Open
opened 2026-08-05 01:08:38 -04:00 by saavagebueno · 0 comments
Owner

Originally created by @mohamed-essam on GitHub (Nov 25, 2024).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/2950

Describe the problem

chosen home Relay server is random and not based on latency.

To Reproduce

Steps to reproduce the behavior:

  1. Deploy multiple relay servers (new relay) to different geographic regions.
  2. Run client in same region as one of relay servers.
  3. Observe chosen home relay server.

In my case specifically:

  1. Deploy relay servers to AWS regions:
    a. us-east-1
    b. eu-central-1
    c. ap-south-1
  2. Run client in us-east-1

Expected behavior

Expected client to chose home relay server to be closest server in latency.

Are you using NetBird Cloud?

Self-hosted

NetBird version

0.33.0

NetBird status -dA output:

N/A

Do you face any (non-mobile) client issues?

N/A

Screenshots

N/A

Additional context

I noticed in the code in relay/client/picker.go in processConnResults() it takes the first item with a successful connection from the resultChan chan, this is highly dependent on Golang scheduling and channel ordering rather than latency.

Might be relevant: tested client has only 1 core (so only 1 thread can run at a time, which would highly affect the ordering to be only based on the Go scheduling), another client which has 8 cores chose the nearest relay server consistently.

Originally created by @mohamed-essam on GitHub (Nov 25, 2024). Original GitHub issue: https://github.com/netbirdio/netbird/issues/2950 **Describe the problem** chosen home Relay server is random and not based on latency. **To Reproduce** Steps to reproduce the behavior: 1. Deploy multiple relay servers (new relay) to different geographic regions. 2. Run client in same region as one of relay servers. 3. Observe chosen home relay server. In my case specifically: 1. Deploy relay servers to AWS regions: a. us-east-1 b. eu-central-1 c. ap-south-1 2. Run client in us-east-1 **Expected behavior** Expected client to chose home relay server to be closest server in latency. **Are you using NetBird Cloud?** Self-hosted **NetBird version** 0.33.0 **NetBird status -dA output:** N/A **Do you face any (non-mobile) client issues?** N/A **Screenshots** N/A **Additional context** I noticed in the code in `relay/client/picker.go` in `processConnResults()` it takes the first item with a successful connection from the `resultChan chan`, this is highly dependent on Golang scheduling and channel ordering rather than latency. Might be relevant: tested client has only 1 core (so only 1 thread can run at a time, which would highly affect the ordering to be only based on the Go scheduling), another client which has 8 cores chose the nearest relay server consistently.
saavagebueno added the clientwaiting-feedback labels 2026-08-05 01:08:38 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#6500