Repository navigation
fix(prober): stop the mesh_dns SLI measuring the prober's own CPU quota (#735) - #738
Merged
Merged
Conversation
…ta (#735) The mesh_dns tier reported a p50 of 179 ms (kube target 196 ms) with nothing under 10 ms, against a mesh-DNS resolver whose server-side p50 is 1 ms and a liveness tier at 9 ms. Both DNS targets cost the same although one is answered authoritatively on-node and the other is forwarded to kube-dns, so DNS was never the variable. Attribution on talos-main (rev206, 2026-09-06, medians): mesh-dns resolver, A and AAAA, either name 0-3 ms fresh conn + HTTP to the local egress direct_response 1.8 ms the mesh hop as the SOURCE PROXY times it 29 ms (n=24,129) of which the destination proxy + echo app 3 ms (n=24,121) the prober's own number 179 ms The ~150 ms between the proxy's 29 ms and the prober's 179 ms is the prober being CFS-throttled by its own chart. `limits.cpu: 50m` is a 5 ms budget per 100 ms period; the container was throttled in 81-90% of ALL periods on every one of the five nodes (cAdvisor, read off the kubelet - it is not scraped into Prometheus, which is why this stayed invisible), so probe latency came out quantised in ~100 ms steps. The same throttle inflates the liveness tier: an unthrottled client measures that local direct_response at 0.9 ms warm / 1.8 ms fresh, not 9 ms p50 / 317 ms p99. The CPU goes where the tier's design puts it: mesh_dns resolves and dials on every probe, and Pyroscope puts 21.5% of the process in net.(*Resolver).tryOneName and 17.7% in http.(*Transport).dialConn. So: - charts/prober: request 100m and NO cpu limit. A limit is a quota, and the one workload that must never measure its own scheduling is the one that publishes the latency SLI. The prober is open-loop and rate-bounded, so it cannot run away; the memory limit stays (it feeds GOMEMLIMIT). - prober: give the mesh_dns tier its own DisableKeepAlives transport. It must resolve on every probe - that IS the SLI (#574) - and Go resolves only when it dials. That was true before only by accident: probe() closed resp.Body without draining it, which is itself enough to make Go destroy the connection. Stating it means the tier survives an upstream that answers with no body, and it stops silently applying to tiers that want reuse (the liveness tier escaped only because a direct_response carries no body; the reachability tier, documented as reusing the fixed egress, did not). - prober: drain the body before closing it, so the keep-alive tiers actually keep alive. Draining happens after the clock stops, so the SLI still measures time-to-response-headers. Not changed, but now measured and worth stating: 25 of the mesh hop's 29 ms is a fresh upstream mTLS handshake, because the node proxy's clusters set connection_pool_per_downstream_connection (deliberately - one source pod's upstream connection, and its client certificate, must never be reused for another source). Over 5 minutes on one node: 2,028 requests, 1,981 downstream connections, 1,869 upstream connections. A mesh client that does not reuse its connections pays a full handshake per request; that is the price of the per-source-identity model, not a defect, and the proxy is untouched here. Expected after deploy: mesh_dns p50 ~30-35 ms (the proxy-observed hop plus DNS plus a dial), liveness p50 ~1-2 ms, throttled periods ~0%. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #735.
The attribution
tier="mesh_dns"reported p50 179 ms (aether.internaltarget) / 196 ms (svc.cluster.localtarget) with 0% under 10 ms, against a mesh-DNS resolver whose server-side p50 is 1 ms and atier="liveness"p50 of 9 ms. Both DNS targets cost the same although one is answered authoritatively by the node-local resolver and the other is forwarded to kube-dns — so DNS was never the variable.Measured on talos-main (rev206, 2026-09-06 15:45–16:00Z) from four independent vantage points — the prober's histogram, the source/destination Envoy access logs, a one-shot meshed
netshootJob onmain-worker-01(since deleted), and the kubelet's cAdvisor endpoint. Medians:AandAAAA, mesh nameaa,ANSWER: 0for AAAA — already a correct authoritative NODATA)dig +stats×20AandAAAAdig +stats×20getent ahosts×10direct_responseupstream_service_time27 msreporter:"source", n=24,129upstream_service_time1 ms)reporter:"destination", n=24,121aether_probe_request_duration_secondsSource-proxy
durationis 29 ms for both DNS targets and 28–30 ms on all five nodes.179 − 29 = ~150 ms is outside the proxy and outside DNS. It is the prober being CFS-throttled by its own chart.
limits.cpu: 50mis a 5 ms budget per 100 ms period, and off the kubelet's cAdvisor endpoint (cAdvisor is not scraped into Prometheus here, which is why this stayed invisible until #733 fixed the buckets):kubectl top: 44–48 m on every pod — pinned at the quota. Once the quota is gone the runnable goroutine sleeps to the next period boundary, so probe latency comes out quantised in ~100 ms steps: exactly the 0% ≤ 10 ms / 21% ≤ 100 ms / 73% ≤ 250 ms distribution in the issue, exactly a median of ~1.75 periods.The same throttle inflates the control: the liveness tier's 9 ms p50 / 317 ms p99 is a local
direct_responsethat an unthrottled client in the same pod network measures at 0.9 ms warm / 1.8 ms fresh. A local reply cannot take 317 ms on any network.The CPU goes where the tier's design puts it.
aether_mesh_dns_queries_totalconfirms the tier really does resolve every probe (qtype=a,result=answered25.09/s andqtype=aaaa,result=nodata25.10/s = 5/s × 5 nodes, one A and one AAAA each), and Pyroscope{k8s_container_name="prober"}puts 21.5% of the whole process innet.(*Resolver).tryOneNameand 17.7% inhttp.(*Transport).dialConn(→internetSocket13.9%,netFD.dial9.7%).All three candidates on the issue are answered: (1) AAAA is fine — answered locally, authoritatively, NODATA, in 0 ms; (2) the fresh connection per probe is real but costs 29 ms, not 170; (3) no search-list expansion —
ndots:2, both names carry 3 and 4 dots, one A + one AAAA per probe.The change
charts/prober/values.yaml(chart 0.2.0 → 0.3.0) —requests.cpu: 100mand no CPU limit. A limit is a quota, and the one workload that must never measure its own scheduling is the one that publishes the latency SLI. The prober is open-loop and rate-bounded (probe.rate× targets) so it cannot run away; the memory limit stays (it also feedsGOMEMLIMIT). The values comment says to re-addlimits.cpuonly with a quota that cannot bind (≥ 1), never a fraction of a core.prober/internal/prober/prober.goDisableKeepAlivestransport. It must resolve on every probe — that IS the SLI (P1: mesh DNS resolution broken for managed pods on rev 175 (masked by DNS-bypassing prober) #574) — and Go resolves only when it dials. That held before only by accident:probe()closedresp.Bodywithout draining it, which is itself enough to make Go destroy the connection. Stating it means the tier survives an upstream that answers with no body (as the livenessdirect_responsedoes) and it no longer leaks onto tiers that want reuse.direct_responsecarries no body; the (currently unconfigured) reachability tier, documented as reusing the fixed egress, would have silently connected per probe. The drain happens after the clock stops, so the metric still means time-to-response-headers.Tests —
TestTierClientspins which transport each tier uses;TestProbeConnectionReuseasserts on the wire that a keep-alive tier opens 1 connection over 4 probes and the mesh_dns tier opens 4, against a server that answers with a body (verified to fail with the old bareClose());TestDrainBodypins the EOF postcondition Go's pooling depends on.Not changed: the other 29 ms
connection_pool_per_downstream_connection: trueon every node-proxy service cluster (agent/internal/xds/proxy/egress.go:213), deliberately, so one source pod's upstream connection and its client certificate are never reused for another source. Measured on w01 over 5 minutes: 2,028 requests, 1,981 downstream connections, 1,869 upstream connections — no pooling across downstream connections. So each new client connection pays a fresh cross-node TCP + mTLS handshake: sourceupstream_service_time28 ms against a destination-side total of 3 ms, i.e. ~25 ms of handshake per new connection, uniform across clusters (echo29 ms,uds-echo22 ms,uds-cr-echo22 ms) and across nodes including those hosting a local replica.That is the price of the per-source-identity model, not a defect, and the proxy is untouched here. Two follow-ups worth their own issues: 25 ms is high for a LAN handshake and the destination inbound's accept path deserves a look; and any future latency objective on this SLI must be stated per-connection, not per-request, because the happy path is a connection-establishment benchmark by design.
Expected after deploy
mesh_dnsp50, both targetslivenessp50livenessp99Refs #733 (buckets), #728 (resolver options), #574 (the blind spot the tier closes).
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr