Skip to content

proxy-supervisor: steady-state admin watchdog burns ~40% of its CPU JSON-decoding /server_info once per second #646

Closed

Description

@bpalermo

Summary

First eBPF continuous-profiling data from talos-main (2026-08-30, 2h window) shows the proxy-supervisor's steady-state CPU is dominated by its admin watchdog: (*Supervisor).Run → adminProbe accounts for ~40–45% of the supervisor's total CPU, and most of that is encoding/json decode work. The absolute cost is small (~0.8% of a core per node, ~282s CPU per 2h fleet-wide) but it is a constant, per-second background load on every node plus one admin HTTP request per second against each Envoy, forever.

Mechanism

agent/internal/proxy/hotrestart/coordination.go:

  • The watchdog loop ticks every readyPollInterval = 1s (coordination.go:161) and calls adminProbe (coordination.go:293).
  • adminProbe GETs /server_info and runs json.NewDecoder(resp.Body).Decode(&info) into a struct needing exactly two fields (state, command_line_options.restart_epoch). /server_info is a large payload (the full command_line_options object among others), and the decoder parses/skips all of it — the profile shows decodeState.value/skip as the hot frames.
  • The agent-side profile also shows http.(*Transport).dialConn (~8%), consistent with the probes not reusing connections (worth verifying whether the admin closes per-request).

Why touch it

Not because of the milli-cores — because the watchdog only needs a boolean pair (live-at-epoch, reachable) and pays for a full JSON parse of an unbounded document once a second on every node, and the same poll is a standing 1 rps load on each Envoy admin (the same admin whose unresponsiveness the watchdog is trying to detect; cheaper probes also reduce false-positive exposure under load). The 007/admin-probe-elimination work removed all agent→admin calls; the supervisor is the deliberate exception, so it should at least be as cheap as possible.

Options (cheapest first)

  1. Steady-state probe via /ready — plain-text LIVE\n, no JSON at all. Epoch verification (/server_info) is only needed while a handoff is in flight (initStartEpoch / waiting-for-LIVE-at-epoch); once the epoch is confirmed LIVE, the per-second watchdog only needs reachability + liveness, which /ready answers. Re-probe /server_info only when a new epoch launches.
  2. Decode the two fields without parsing the rest (json.Decoder token walk), if /server_info must stay.
  3. Optionally relax the steady-state interval (1s → 2–5s) — the admin-unresponsive deadline is much larger anyway.

Option 1 + keeping the 1s cadence preserves current detection latency at near-zero cost.

Evidence

  • Pyroscope process_cpu, service_name="unknown_service:supervisor", 2026-08-30 16:58–18:58Z: 282.4s total; Supervisor.Run→adminProbe 51.35s+66.40s paths with json.(*Decoder).Decode 32.25s, decodeState.value 25.15s, decodeState.skip 10.90s.
  • Zero supervisor/proxy restarts in the window (fleet stable; this is pure steady-state cost).
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