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

Closed
opened 2026-08-05 01:08:09 -04:00 by saavagebueno · 3 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:09 -04:00
Author
Owner

@nazarewk commented on GitHub (Apr 28, 2025):

Hello @mohamed-essam,

We're currently reviewing our open issues and would like to verify if this problem still exists in the latest NetBird version.

Could you please confirm if the issue is still there?

We may close this issue temporarily if we don't hear back from you within 2 weeks, but feel free to reopen it with updated information.

Thanks for your contribution to improving the project!

<!-- gh-comment-id:2835669560 --> @nazarewk commented on GitHub (Apr 28, 2025): Hello @mohamed-essam, We're currently reviewing our open issues and would like to verify if this problem still exists in the [latest NetBird version](https://github.com/netbirdio/netbird/releases). Could you please confirm if the issue is still there? We may close this issue temporarily if we don't hear back from you within **2 weeks**, but feel free to reopen it with updated information. Thanks for your contribution to improving the project!
Author
Owner

@mlsmaycon commented on GitHub (Jun 1, 2025):

closing issue due to no recent feedback. Feel free to open a new one if the issue persist or reopen if this was a feature request.

<!-- gh-comment-id:2927890872 --> @mlsmaycon commented on GitHub (Jun 1, 2025): closing issue due to no recent feedback. Feel free to open a new one if the issue persist or reopen if this was a feature request.
Author
Owner

@joachimtingvold commented on GitHub (Jun 8, 2026):

Was this ever implemented in some way?

<!-- gh-comment-id:4652975726 --> @joachimtingvold commented on GitHub (Jun 8, 2026): Was this ever implemented in some way?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#6407