Skip to content

Broker-stack performance under load: queue reads 8-28s, fleet gh +5s vs direct, DERP-only tailnet path (490-873ms) #13894

Backlog

Description

@dezren39

Measurements (2026-11-23 ~18:00 CST, BROKER-HEALTH-PERF lane; laptop load avg 5.0/10.3/15.3 rising to 22.75 — heavily loaded; sandbox load ~4.95)

Path Median Range Note
fleet secrets get (warm local broker) 6ms — the fast path is genuinely fast
fleet secrets get (local broker refreshing) >120s (hang) — no prompt fallback; separate issue filed
fleet gh api rate_limit 6.25s 5.26–10.19s vs direct gh below
gh api rate_limit via shim (→ fleet gh) 4.25s 3.07–5.43s
gh-orig api rate_limit (direct, no fleet) 1.43s 1.28–8.03s fleet gh tiering adds ~+4.8s median
laptop exec, trivial echo (broker path) 2.33s 2.10–2.50s plus intermittent multi-second broker waits (one call noted an 11s broker/tunnel wait)
laptop exec via repaired SSH fallback 1.74s warm 8.08s cold ControlMaster persist makes warm fallback fast
fleet queue list (scoped, 1 row) 8–28s 8.04–27.94s slowest hot path
secrets broker cold refresh ~160–220s — 242 per-secret bws spawns
tailscale ping sandbox→laptop 490–873ms — DERP-relayed (den); "direct connection not established"

Causes identified

  1. DERP hairpin: the sandbox↔laptop tailnet path has no direct connection; all traffic relays via DERP (Denver) at ~0.5–0.9s RTT. Every broker/queue round trip pays it, and connection churn multiplies it. Investigate why direct fails (NAT/UDP) — a direct path would cut most round trips several-fold.
  2. Laptop load: at load 22+, the laptop-side daemons (queue broker, laptop-agent) queue behind lane work. Queue reads suffer most (8–28s). Consider scheduling/ionice protection for the broker daemons, or moving the queue broker read path off the loaded host.
  3. fleet gh tiering overhead: ~+4.8s median over direct gh for a trivial read — the local-daemon → laptop → in-process cascade appears to pay a failed-tier timeout on the happy path. Profile and short-circuit: a healthy local tier should answer in well under 1s.
  4. Session-broker restarts drop in-flight execs ("connection dropped, not repooled"): heal/init-ensure churn was one driver (fixed locally 2026-11-23: heal flock + young-broker grace + init-ensure threshold), but any broker restart still breaks pooled connections. Longer term: client-side retry/repool on broker restart.

Ask

Profile (1) and (3) first — both are structural and load-independent. (2) needs a placement/scheduling decision. (4) is a client-resilience fix in the fleet binary.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-24T00:17:23Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": null,
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": null,
    "auth_subject": "archer",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Activity

  1. developing-today commented on Nov 24, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 24, 2026

    @dezren39
    MemberAuthor

    Correction + update (2026-11-24T00:18Z, same lane)

    Re-measured on a healthy stack (secrets broker serving, 242 secrets):

    • fleet gh api rate_limit: median 1.50s (1.24–7.26s, n=3) — the 6.25s median in the issue body was measured during the secrets-broker wedge, when 22 fleet clients were piled up behind the refreshing broker. On a healthy stack, fleet gh's overhead over direct gh (1.43s median) is small. Cause (3) in the body is downgraded accordingly: the tiering cascade is not the happy-path problem; the wedge was.
    • The CONNECT layer is still intermittently flapping: at 00:17Z fleet queue list failed fast (0.24–0.39s, "proxy closed during CONNECT", rc=3) while laptop-ssh echo succeeded but took 5.7–7.4s. Success/failure arrives in bursts. This keeps causes (1) DERP-only path and (2) laptop load as the live suspects, plus session-broker connection pooling behavior under CONNECT failures ("connection dropped, not repooled" in broker logs).
    • Laptop load at last successful read: 22.75 avg — the queue broker and laptop-agent are competing with the full lane fleet on the laptop.
  3. dezren39 commented on Nov 24, 2026

    @dezren39
    MemberAuthor

    Tailnet hairpin: causal answer + direct-path verdict (TAILNET-DIRECT lane, 2026-11-24)

    Question: why does sandbox↔laptop traffic relay through DERP at 490–873 ms instead of going direct, and can a direct path be won?

    Verdict: a direct path is not possible from inside either endpoint. The wall is the sandbox host's egress design. The laptop is blameless.

    Evidence (measured 2026-11-24 ~03:08–03:12 UTC)

    Sandbox node hatch-archer (100.101.151.76), tailscale netcheck against its own tailscaled:

    * UDP: false
    * IPv4: (no addr found)
    * MappingVariesByDestIP: (unknown)
    * Nearest DERP: unknown (no response to latency probes)
    
    • tailscaled runs --tun=userspace-networking; its only internet egress is the host HTTP proxy (netcheck's own log line: tshttpproxy: using proxy "http://…@hatch-egress-proxy:3128"). DERP is reached over TCP through that proxy.
    • Its only advertised endpoint is 198.19.0.2:48695 — 198.19.0.0/15 is the RFC 2544 benchmarking range, a synthetic address inside the sandbox host's egress plumbing, not a routable public endpoint a peer could send UDP to.
    • Its home DERP is bom (Mumbai). Home-DERP choice is latency-derived; from inside the sandbox the probes traverse the egress proxy, whose exit geography/measurement lands on bom.
    • tailscale ping sandbox→laptop: via DERP(ord) in 653ms / 871ms / 1.081s — direct connection not established; peer CurAddr empty, Relay: ord.

    Laptop amd-6 (100.99.113.103), tailscale netcheck:

    * UDP: true
    * IPv4: yes, 67.144.128.109:45362
    * MappingVariesByDestIP: false
    * PortMapping: UPnP, NAT-PMP
    * Nearest DERP: Chicago (ord: 34.5ms)
    
    • Advertises a real public endpoint (67.144.128.109:41641, NAT-PMP via the TP-LINK router), endpoint-independent NAT mapping — the friendly kind for hole-punching.
    • tailscale ping laptop→sandbox: via DERP(bom) in 567–661ms — direct connection not established; peer shows relay "bom".

    Note: relayed traffic goes via the destination's home DERP, so the two directions hairpin differently — sandbox→laptop via ord, laptop→sandbox via bom. (This corrects the earlier "Denver" label in this issue's table: measured today, the relays are ord/bom.)

    Causal chain

    1. A direct WireGuard path needs UDP hole-punching: disco over UDP plus a STUN-discovered public endpoint on both sides.
    2. The sandbox cannot send or receive UDP to the internet at all (netcheck UDP: false, no STUN address, DERP probes unanswered) — its tailscaled reaches the internet only as TCP through the host proxy.
    3. The endpoint it advertises is unroutable, so the laptop has nothing to aim UDP at even though the laptop itself is fully direct-capable.
    4. Therefore every packet relays, and each direction additionally pays the sandbox's proxied TCP leg to DERP — which is why even the Chicago-relayed direction costs 650 ms+ while the laptop sits 34.5 ms from that same DERP.

    Levers considered — none available

    • Peer relay: still requires UDP reachability between the nodes; the sandbox has none.
    • A nearer home DERP: Tailscale has no supported knob to pin a node's DERP home, and it would not fix the dominant cost (the proxied sandbox↔DERP leg). Attempting to game selection would mean disturbing tailscaled/the heal stack, which is load-bearing — not attempted.
    • Direct UDP egress from the sandbox: would require the sandbox host to offer UDP egress (or UDP-ASSOCIATE); it offers an HTTP CONNECT proxy only. That decision belongs to the sandbox host's egress design, outside both endpoints.

    No change was made; before/after RTT is therefore unchanged (sandbox→laptop 653 ms–1.08 s via ord; laptop→sandbox 567–661 ms via bom). The 490–873 ms band in this issue's table stands as structural until the sandbox's egress offers UDP.

  4. developing-today-fleet commented on Nov 24, 2026

    @developing-today-fleet
    Contributor

    Tailnet UDP follow-up — the "structural" verdict is corrected (TAILNET-UDP lane, 2026-11-24)

    Drew's pointer (2026-11-23 21:37 CST): aside from the tailscale userspace setup, this sandbox does have UDP access available if requested. He is right that the no-UDP state is default-off, not structural. The earlier verdict on this issue ("direct path structurally impossible; netcheck UDP:false is dispositive") is corrected in that degree. What follows is what the evidence does and does not yet prove.

    Evidence

    1. Default state: UDP is denied at the syscall layer for every process in the sandbox cell. A raw STUN binding request (RFC 5389) from a plain Python process to public STUN/DNS IPs (74.125.250.129:19302, 8.8.8.8:53, others) fails instantly with EPERM (Operation not permitted) — not a timeout. Same for UDP to the cell gateway resolver. Name resolution still works because the cell resolver returns synthetic (fake-IP) answers without raw UDP from the process. The production tailscaled (v1.104.7) reports UDP: false, no IPv4 address, no DERP latency response — reproduced today, and reproduced on two throwaway tailscaled instances with separate state dirs/sockets/WireGuard port, including a fresh instance started after the approval batches below. Binding UDP sockets works; sending is what is denied. The cell has no CAP_NET_ADMIN/CAP_NET_RAW, so kernel-TUN experiments are also out from inside.

    2. A request mechanism exists and is already load-bearing in this estate. Direct egress attempts surface as per-endpoint approval cards in the platform permission system ({host, port}; "Always allow" makes them durable). The estate already carries durable per-binary network_rule allows for this exact tailscaled binary covering DERP servers on TCP 80/443 — that is how today's DERP-over-TCP relay path was built. During this lane, first-touch tailscale netcheck runs raised card batches in lockstep (2 requested 03:39:58Z, 5 at 03:43:01Z, 5 at 03:45:22Z, all decided "Site always allowed"), and later runs raised none once endpoints were covered. Those approvals did not flip netcheck's UDP state — they appear to cover the TCP/HTTP probe endpoints, not STUN.

    3. A UDP flow can be the subject of a card. A probe attempt from an agent process produced a pending card (approval c4ed0fd5, requested 2026-11-24T03:48:05Z) whose purpose reads "verify outbound UDP network access by contacting Google Public DNS at 8.8.8.8", scope 8.8.8.8 port 53. As of this writing that card is still pending — so whether approving a UDP-endpoint card actually unlocks the flow is the one link in the chain not yet proven. The retest is under a minute once it is decided: repeat the in-process UDP query to 8.8.8.8:53 and look for a reply instead of EPERM.

    4. The detached daemon does not reliably surface its own cards. The production/throwaway tailscaled processes (setsid-detached) attempting STUN (UDP 3478 to DERP) and disco (UDP to the laptop's endpoint) raised no correlatable pending cards, and after every approval batch the results were unchanged: tailscale ping 100.99.113.103 at 03:46Z — all pongs via DERP(ord), 554–884 ms, "direct connection not established".

    What was NOT done

    • Production tailscaled, its state, and its config were never modified by this lane. No production change has been made.
    • The throwaway node was never joined to the tailnet (joining needs Drew's device approval or an auth key; moot until UDP unlocks). It has been shut down; only the production daemon remains.
    • Note: the heal stack bounced the channel once at 03:53:44Z during this lane (tailscaled + relay + secrets broker restarted by laptop-channel-heal; cause not isolated — it coincided with a platform SIGTERM of the lane's own shell). All legs were restored by the heal stack within ~7 seconds and verified healthy afterward (secrets broker serving:true, 257 secrets; production tailscaled up; laptop peer present via ord).

    Staged plan (no step taken yet)

    1. Drew decides the pending UDP card (8.8.8.8:53) with "Always allow"; lane retests in-process UDP. If a reply comes back, the card→grant→UDP chain is proven.
    2. Run a throwaway tailscaled attached to a foreground agent session (not setsid-detached) so its first-touch attempts surface as cards; approve the DERP STUN endpoints (UDP 3478) it asks for. Re-run its netcheck — expect UDP: true with a mapped public endpoint from STUN.
    3. Same treatment for the laptop's public endpoint on UDP 41641 (via tailscale ping from the attached instance once joined, or from production once step 2's rules exist — the rules are keyed to the tailscaled binary, so production inherits them; no config change and no restart should be needed, and there is nothing to roll back: the change is additive allows only).
    4. Verify production: tailscale status shows a direct CurAddr for the laptop peer and tailscale ping reports a direct path; record before/after RTT here (baseline: 554–884 ms via DERP(ord), earlier samples up to ~1.08 s).
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions