Skip to content

ML_DERP_REGION hardcoded to 9 (Dallas) — high relay latency for deployments outside North America #19

Description

@snowpaper

Summary

ML_DERP_REGION is hardcoded to 9 (Dallas) in microlink_internal.h. Every deployment outside North America that depends on relayed traffic (CGNAT peers, i.e. most cellular clients) pays intercontinental RTT on every relayed byte. Real Tailscale clients pick the home DERP region by measured STUN latency; microlink takes the compile-time constant.

Measured impact (deployment in Southeast Asia)

  • Via region 9 (Dallas): ~750 ms relay RTT → with a ~14 KB effective TCP window, ~9 KB/s throughput. A 645 KB transfer = ~71 s of pure transfer, ~4 min end-to-end.
  • Recompiled with region 3 (Singapore): ~230 ms RTT, same transfer completes in ~25 s — ~10x.

Notes for a proper fix

  • The constant feeds Hostinfo.NetInfo.PreferredDERP at all four report sites in ml_coord.c, and the control plane republishes it as the node's HomeDERP — so peers re-route automatically once it changes; no asymmetric-relay problem.
  • The runtime DERP node is already picked from the live DERPMap by region id (ml_derp.c); the hardcoded hostnames are only fallbacks.
  • Suggested fix: STUN-probe a few regions from the DERPMap at startup and pick the lowest-latency one (what the official client does). Interim cheaper fix: make the region a Kconfig option instead of a #define, so users don't have to patch a header.

Happy to provide the measurements or test a patch on hardware (ESP32-S3, ESP-IDF v5.3).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions