Skip to content

proxy readiness probe re-execs the whole agent binary every 2s: >=31% of supervisor CPU is Go package init #673

Closed

Description

@bpalermo

Summary

The proxy pod's readiness probe re-executes the entire agent binary every 2 seconds, per pod, forever — just to check whether a marker file exists. Continuous profiling of the running fleet shows ≥31% of all supervisor CPU is Go process-startup overhead, and essentially none of it is the readiness check itself.

From the proxy pod spec:

readinessProbe:
  exec:
    command:
      - /opt/aether/supervisor
      - proxy-supervisor
      - --readiness-check
      - --ready-marker=/var/run/aether-proxy/ready
  periodSeconds: 2

Measurement

Pyroscope, {service_name="aether-proxy", process_executable_name="supervisor"}, 2026-09-04 07:05–07:30Z, during a soak with zero proxy rolls and zero container restarts in the window — so this is steady-state cost, not startup noise:

frame % of supervisor CPU
runtime.main 20.27%
runtime.doInit1 (package init) 19.75%
SchemeBuilder.AddToScheme 14.81%
do_mem_abort / do_page_fault (cold page-in) 13.73% / 13.41%
scheme.init 11.32%
gcBgMarkStartWorkers 10.84%
Scheme.AddKnownTypes 8.87%
apiutil.init 8.19%
Scheme.AddKnownTypeWithName 7.03%
protobuf filedesc/filetype Build ~4–5%
cobra.(*Command).ExecuteContext 0.52%

That last row is the point: the work the probe actually exists to do is ~0.5pp. Everything above it is Go runtime boot, controller-runtime scheme registration, protobuf descriptor-registry construction, and cold page faults — paid ~3,750 times per 25 minutes (5 pods × 750 execs), at roughly 6.7ms per exec in main() alone, ~10ms including per-process GC worker spin-up.

Conservative total: runtime.main (20.27%) + gcBgMarkStartWorkers (10.84%) = ≥31% of supervisor CPU is pure process-launch waste, and doInit1 at 19.75% of that 20.27% means almost all of the probe's main() is package init.

Absolute cost is modest — the supervisor is ~0.083 fleet cores, so the waste is ~0.026 cores (~0.5% of one core per node) — but it is the dominant term in the supervisor's budget, it is entirely avoidable, and it scales with pod count.

The fix constraint that matters

Guarding --readiness-check early inside main() will NOT fix this. The expensive work is package-level init() — scheme.init, apiutil.init, the protobuf registry — which the Go runtime executes before main() is entered, regardless of arguments. Options that actually work:

  1. Replace the exec probe with httpGet or tcpSocket against something the supervisor already serves. Cheapest by far, and removes the exec entirely. Preferred if a suitable endpoint exists or can be added.
  2. A separate minimal binary for the readiness check (a few KB, no controller-runtime, no protobuf registry), installed alongside the supervisor by the same init container.
  3. A build-tag split so the readiness path links none of the heavy packages — fiddly, and easy to regress silently when someone adds an import.

Option 1 also eliminates the per-probe fork/exec and page-fault cost, which options 2 and 3 only reduce.

Relationship to other issues

This is the same shape as #646 (the admin probe burning ~40% of supervisor CPU on JSON decode). #647 removed the JSON decode but left the process-launch cost, which is now the larger term.

It also supersedes the premise of #649: that issue predicted writeState/onLiveEpoch would be the top Go frame at ~5% after #647. Measured at max_node_depth=400 with a 0.201% cutoff, writeState, onLiveEpoch, flock, mkdir, Rename and adminProbe are all absent — the prediction is wrong by at least 25×. #649 was pointing at the supervisor's cost from the wrong direction; this is where it actually is.

Note for anyone re-measuring

The supervisor's frames roll up under service_name="aether-proxy" since the workload-identity naming change. k8s_container_name only yields ["authz","proxy"] and cannot separate them. The label that works is process_executable_name="supervisor".

Activity

  1. bpalermo commented on Sep 5, 2026

    @bpalermo
    OwnerAuthor

    Production validation — 8h soak 2026-09-05, rev192 / chart 0.92.0 / a3cde6c

    This issue was auto-closed by its PR merge on 2026-09-04T21:33Z, before the build was deployed. Recording the production evidence here so the closure is backed by a measurement.

    Behavioural (8h under churn, T0 01:05:51Z → 09:05:51Z, 31 rolls incl. 6 proxy rolls and one agent+proxy+svc-3 TRIPLE):

    • 0 container restarts on every aether-proxy pod across all 6 proxy generations (kubectl get pods -n aether-system -o json → restartCount 0 for both proxy and authz on the current generation; the 03:32Z and 06:22Z checkpoints recorded 0 for the intervening generations).
    • Probe spec is still the small binary: readiness=["/opt/aether/proxy-ready","--ready-marker=/var/run/aether-proxy/ready"].
    • Handoffs stayed uniform — 08:05:51Z roll: w03 starting envoy 08:05:57.767 → pod ready 08:06:15.825 = 18.06s; w05 08:06:22.088 → 08:06:40.208 = 18.12s. TRIPLE (06:05:51Z): 19.50 / 18.09 / 20.97 / 18.87 / 19.27s.
    • Readiness-marker flap is unchanged by design and still sub-second: gen-7 saw w03 pod not ready 08:22:16.819 → pod ready 08:22:17.446 = 0.627s and w05 08:21:41.249 → 08:21:41.778 = 0.529s, both coincident with a CDS update removing clusters after the 08:20:51Z svc-1 roll. No restart, no SLI impact.
    • Liveness tier 0 errors / 714,703 over the window; mesh_dns dns_* all zero.

    Profiling (Pyroscope process_cpu:cpu:nanoseconds, 07:08:30–07:33:30Z):

    • supervisor 125.8 → 19.70 core-s/25min (6.4x); runtime.main, doInit1, doInit, SchemeBuilder.AddToScheme, scheme.init, apiutil.init, AddKnownTypes, do_mem_abort, do_page_fault all absent below 0.254%.
    • the new proxy-ready series costs 0.75 core-s (kernel clone/fork frames only) — 52x cheaper than the binary it replaced.
    • Net −105 core-s/25min = −0.070 fleet cores, ~1.7% of the 4.19-core proxy fleet.

    Caveat on completeness: Kubernetes events have a ~1h TTL on this cluster and aether-system had none left at grade time, so the flap enumeration above is from supervisor logs of the current generation plus the checkpoint readings, not an 8h event census.

    Verdict: holds in production. Staying closed.

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