Skip to content

prober: mesh_dns-tier probes cost ~180 ms at the median (liveness tier 9 ms, resolver server-side p50 1 ms) — ~170 ms of fixed client-side cost per probe, same on both DNS targets #735

Closed

Description

@bpalermo

Observation (first visible after #733 fixed the histogram buckets; talos-main rev206, new prober pods, 2026-09-06 15:01Z, [5m])

p50 p99 distribution
tier="liveness" (no DNS) 9.05 ms 317 ms mass at 0.005–0.01
tier="mesh_dns", echo.aether-test.aether.internal:18081 175 ms 703 ms 0% ≤ 10 ms, 1% ≤ 25 ms, 21% ≤ 100 ms, 73% ≤ 250 ms, 97% ≤ 500 ms
tier="mesh_dns", echo.aether-test.svc.cluster.local:18081 191 ms 717 ms same shape
mesh-dns resolver, server side (aether_mesh_dns_query_duration_seconds) 1.0 ms 56 ms —

Both DNS targets cost the same although one is answered authoritatively by the node-local resolver (1 ms) and the other is forwarded to kube-dns, and NO mesh_dns probe completes in under 10 ms while the liveness probe's median is 9 ms. So ~170 ms per probe is a fixed client-side cost that is not the DNS server and is not the HTTP hop the liveness tier exercises.

Candidates (in the order I would test them)

  1. Go resolver A+AAAA behaviour. Go issues A and AAAA in parallel and waits for both; if the AAAA for these names is answered slowly (forwarded upstream? NoData vs NXDOMAIN?) or the resolver retries once, the wait is bounded by the AAAA path, not the A. With attempts:3 timeout:1 (fix(agent): bound the DNS retransmit budget and stop hiding resolution stalls as timeouts (#726) #728) a lost AAAA would cost ~1 s, not 170 ms, so this would have to be a slow-but-answered AAAA. Test: dig A vs dig AAAA vs getent ahosts timings from a pod in aether-test (a one-shot Job whose logs are readable; kubectl exec is denied here).
  2. The mesh_dns tier's HTTP client dials a fresh connection per probe (to force resolution) while the liveness tier reuses one; a new downstream connection through the node proxy may pay on-demand cluster lookup / a new upstream connection with the mTLS handshake to echo's node proxy. Test: curl -w '%{time_namelookup} %{time_connect} %{time_starttransfer}' against both targets from the same Job, and the proxy's access-log duration vs upstream_service_time for the prober's requests (_stream:{service.name="aether-proxy"}, dotted fields).
  3. Search-list expansion. ndots:2 with 3- and 4-dot names should try the absolute name first; verify no extra queries with the dig +search trace and the resolver's aether_mesh_dns_queries_total{result} split during a burst of probes.

Why it matters

The mesh_dns tier IS the availability SLI's happy path; a 20× latency floor over the same HTTP hop is either a prober artefact (then the SLI's timeout budget of 2 s is closer to the floor than intended) or a real per-connection cost every DNS-resolving client in the mesh pays. Either way it was invisible until #733 and should be attributed before the next soak grades latency.

Refs #733 (buckets), #728 (resolver options), #726 (the roll hole), #674 (forward pool).

Activity

  1. bpalermo commented on Sep 6, 2026

    @bpalermo
    OwnerAuthor

    Phase 1 — attributed. It is not DNS, and it is not one thing: ~150 ms is the prober being CFS-throttled, ~29 ms is a real per-connection mesh cost.

    Measured 2026-09-06 15:45–16:00Z on talos-main (rev206, prober pods ~1 h old), from four independent vantage points: the prober's own histogram, the source/destination Envoy access logs, a one-shot nicolaka/netshoot Job in aether-test labelled aether.io/managed with the prober's config.aether.io/upstreams annotation (same node, main-worker-01, since deleted), and the kubelet cAdvisor endpoint.

    Attribution table (medians)

    layer measured how
    mesh-dns resolver, server side, mesh name A 0 ms (3 ms worst of 20) dig +stats A echo.aether-test.aether.internal ×20 from the Job
    mesh-dns resolver, server side, mesh name AAAA 0 ms, flags: qr aa, ANSWER: 0 ×20 — already an authoritative NODATA, RFC 4074 §4.2 behaviour is correct, never forwarded
    kube-dns forward path (svc.cluster.local, A and AAAA) 0–3 ms (one 7 ms) ×20 each
    full client-side resolution 0 ms getent ahosts ×10 on each name
    fresh TCP connect + HTTP to the local egress listener (/-/-/live direct_response, no DNS, no upstream) 1.8 ms (p90 2.8) curl ×20
    warm-connection version of the same 0.9 ms curl, one connection
    the mesh hop, as the source proxy itself times it 29 ms (p90 42, p99 62); upstream_service_time 27 ms access log, reporter:"source", n=24,129, last 15 min
    ... of which the destination proxy + the echo app 3 ms (upstream_service_time 1 ms) access log, reporter:"destination", n=24,121
    unmeshed control: curl doing the whole thing (DNS + fresh conn + mesh hop) 101 ms (mesh name) / 41 ms (kube name), heavy tail curl ×20 each, on a node under load
    the prober's own number 179 ms (mesh) / 196 ms (kube) aether_probe_request_duration_seconds, [10m]

    Source-proxy duration is 29 ms for both DNS targets (mesh 29, kube 29, n=24k/22k) and 28–30 ms on all five nodes. So the two targets cost the same because DNS was never the cost.

    179 − 29 = ~150 ms is spent outside the proxy and outside DNS, i.e. inside the prober process.

    Where the 150 ms goes: the prober is CPU-throttled ~85% of the time

    charts/prober/values.yaml sets limits.cpu: 50m. kubectl top: 44–48 m on every one of the five pods — pinned at the quota. The kubelet's cAdvisor endpoint (/api/v1/nodes/<node>/proxy/metrics/cadvisor; cAdvisor is not scraped into Prometheus on this cluster, which is why this never showed up):

    node pod CFS periods throttled periods % throttled throttled seconds (pod life ≈ 4,000 s)
    main-worker-01 prober-2w6fx 40,070 34,621 86.4 % 3,916 s
    main-worker-02 prober-hvxnx 39,581 35,685 90.2 % 2,285 s
    main-worker-03 prober-ffc5r 39,813 32,240 81.0 % 2,882 s
    main-worker-04 prober-pc8gf 40,223 32,971 82.0 % 1,055 s
    main-worker-05 prober-2c48t 40,477 33,438 82.6 % 1,922 s

    A 50 m limit is a 5 ms budget per 100 ms CFS period. Once it is gone the runnable goroutine sleeps to the next period boundary, so probe latency is quantised in ~100 ms steps — which is exactly the distribution in the issue (0 % ≤ 10 ms, 21 % ≤ 100 ms, 73 % ≤ 250 ms) and exactly a median of ~1.75 periods.

    This also explains the "control": the liveness tier's 9.05 ms p50 / 317 ms p99 is a local direct_response that an unthrottled curl in the same netns and the same pod network measures at 0.9 ms warm / 1.8 ms fresh. A local reply cannot take 317 ms on any network; that is a scheduler queue. So candidate 2's premise ("the liveness tier is the same hop, cheaper") was wrong in a second way: liveness is also inflated ~10×, just less.

    Why the mesh_dns tier is the one that burns the quota

    The liveness route is DirectResponseAction{Status: 200} → content-length: 0 → Go's transport sets hasBody=false, hands back http.NoBody and returns the connection to the idle pool immediately. Every liveness probe after the first reuses one connection: no resolve, no dial, ~nothing.

    The mesh_dns tier resolves and dials every probe (by design — that is the SLI). Confirmed live rather than assumed: aether_mesh_dns_queries_total shows qtype=a,result=answered at 25.09/s and qtype=aaaa,result=nodata at 25.10/s = 5 probes/s × 5 nodes, one A and one AAAA per probe, so Go really is resolving on each one.

    Pyroscope, {k8s_container_name="prober"}, process_cpu, last 30 min:

    • net.(*Resolver).tryOneName — 21.45 %
    • http.(*Transport).dialConn — 17.65 % (→ net.internetSocket 13.90 %, net.(*netFD).dial 9.71 %)

    ~39 % of the prober's entire CPU budget is resolve + dial. That is what saturates 50 m, and the throttling it causes then lands on every tier, including liveness.

    One real prober defect found alongside it: probe() does resp.Body.Close() without draining, so Go's transport can never return a connection carrying a body to the idle pool. The mesh_dns tier wants a fresh connection, so it is harmless there — but it means the tier's fresh connection is an accident rather than a decision, and the (currently unconfigured) reachability tier, which is documented as reusing the fixed egress, would silently open a new connection per probe too.

    The other 29 ms is real, and is the thing the issue's "why it matters" paragraph predicted

    connection_pool_per_downstream_connection: true on every node-proxy service cluster (agent/internal/xds/proxy/egress.go:213, NewServiceCluster) — deliberately, so the node proxy never reuses one source pod's upstream connection, and its client certificate, for a different source. Consequence, measured on w01 over 5 minutes:

    n = 2028 requests
      downstream connections = 1981   (one per probe, as expected)
      upstream connections   = 1869   (one per probe — no pooling across downstream connections)
    

    So each mesh_dns probe pays a fresh cross-node TCP + mTLS handshake to the destination pod's inbound listener: source upstream_service_time 28 ms against a destination-side total of 3 ms → ~25 ms of handshake + network per new client connection. It is uniform across all clusters (aether-test/echo 29 ms, uds-echo 22 ms, uds-cr-echo 22 ms) and across nodes, including nodes that host an echo replica locally.

    This is not a bug and I am not touching the proxy for it — it is the price of the per-source-identity model. But it is worth stating plainly: a mesh client that does not reuse its connections pays a full mTLS handshake per request. Two follow-ups worth their own issues: (a) 25 ms is high for a handshake on a LAN and deserves a look at the destination inbound's accept path; (b) the SLI's happy path is currently a connection-establishment benchmark, so any future latency objective must be stated per-connection, not per-request.

    Verdict on the issue's three candidates

    1. Go resolver A+AAAA — ruled out. AAAA of a mesh name is answered locally, authoritatively, as NODATA in 0 ms; the kube name's AAAA forwards and returns in 0–3 ms.
    2. Fresh connection per probe — half right. It is real and now proven (1,869 upstream conns / 2,028 requests), but it costs 29 ms, not 170.
    3. Search-list expansion — ruled out. options ndots:2; both names carry 3 and 4 dots so the absolute name is tried first, and the query counters show exactly one A + one AAAA per probe.

    The remaining ~150 ms was none of the three: it is the prober's own 50 m CPU limit. Fix in Phase 2 (chart resources + make the tier's fresh connection deliberate).

  2. bpalermo commented on Sep 6, 2026

    @bpalermo
    OwnerAuthor

    Phase 2 — PR #738

    Fix is two lines of intent:

    • charts/prober 0.2.0 → 0.3.0: requests.cpu: 100m, no CPU limit. A limit is a CFS quota, and the workload that publishes the latency SLI must not measure its own scheduling. Rate-bounded and open-loop, so it cannot run away; the memory limit (and therefore GOMEMLIMIT) stays.
    • prober: the mesh_dns tier gets its own DisableKeepAlives transport so "resolve on every probe" is stated rather than an accident of a body that was never drained; and probe() now drains the body before closing it, after the clock stops, so the keep-alive tiers actually keep alive (the reachability tier was silently connect-per-probe too).

    Tests: TestTierClients, TestProbeConnectionReuse (1 connection over 4 probes for a keep-alive tier, 4 for mesh_dns, against a body-answering server — verified to fail with the old bare Close()), TestDrainBody.

    The 29 ms mesh hop is not touched. It is connection_pool_per_downstream_connection: true doing what it is there for; 2,028 requests over 5 min on w01 opened 1,869 upstream connections, so ~25 ms of it is a fresh mTLS handshake per client connection. Written up in the PR with two suggested follow-ups.

    Expected after deploy: mesh_dns p50 ~30–35 ms (from 179/196), liveness p50 ~1–2 ms (from 9.05), p99 317 ms → low tens, throttled CFS periods 81–90% → ~0%. PromQL in the PR body. Debug Job deleted.

  3. bpalermo commented on Sep 6, 2026

    @bpalermo
    OwnerAuthor

    Validated on talos-main (prober chart 0.3.0-f81a16c deployed 16:25Z 2026-09-06; read at 16:35Z on the new pods, [5m])

    tier before (rev206) after (#738)
    mesh_dns p50 / p99 183 / 710 ms 42 / 221 ms
    liveness p50 / p99 9 / 317 ms 3 / 20 ms
    prober CPU (kubectl top) 44–48 m, pinned under the 50 m limit 52–67 m, unthrottled

    The mesh_dns median is now within ~13 ms of the 29 ms the source proxy measures for the hop — the rest is DNS + a fresh TCP connect + the prober's own scheduling, no longer a 100 ms quantum. The residual real cost is the per-client-connection mTLS handshake (~25 ms) from connection_pool_per_downstream_connection: true, documented above as a deliberate per-source-identity trade; not changed here.

    Grading note carried into the soak skill: every pre-0.3.0 prober latency figure (and part of its timeout counts) included the prober's own CFS throttle; compare latency only against post-16:25Z baselines.

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