Repository navigation
feat(proxy): overload manager with health-gateway bypass - #138
Merged
Merged
Conversation
Third layer of the memory-incident defense, after leak prevention (#135/#136) and containment (#137's 1Gi limit): graceful degradation before the limit's OOM kill. A fixed_heap monitor (default 768Mi = 75% of the 1Gi container limit; heap excludes stats/code//dev/shm) drives a shedding ladder: 0.80 shrink_heap 0.90 disable_http_keepalive (sheds idle downstream conns; their per-downstream upstream pools then idle out via the 30s timeout) 0.85-0.95 reduce_timeouts (scales HTTP downstream idle toward 2s - the dynamic version of #136) 0.95 stop_accepting_requests (503s new streams, which client routes retry on a DIFFERENT endpoint - the overloaded node sheds load to other replicas) 0.98 stop_accepting_connections The agent-generated health-gateway listener sets bypass_overload_manager: delegated liveness must report APP truth, not proxy state. Without the bypass an overloaded proxy would 503 the agent's liveness probes and flap every local pod's registry health cluster-wide on transient overload; shedding belongs to the data-plane listeners (503+retry, client active HC), not the liveness channel. The gateway is a node-local UDS with a handful of agent connections, so the exemption frees no meaningful memory. Inert in normal operation: steady-state heap sits far below the first rung. Rendered bootstrap validated with `envoy --mode validate` against the pinned image digest (configuration OK). Gated by proxy.overload.enabled (default true). Co-Authored-By: Claude Opus 4.8 <[email protected]>
…heap The fixed_heap monitor measures tcmalloc heap, but the OOM killer enforces the cgroup limit on the whole container working set — the supervisor process, kernel socket buffers (charged to the cgroup, and correlated with exactly the overload scenario) and thread stacks are all invisible to a heap monitor, which forced a ~75% heap budget of guesswork and a values knob that had to be bumped in lockstep with the memory limit. The cgroup_memory monitor reads memory.current / memory.max directly, so the thresholds sit against the real kill line and the knob disappears (optional maxMemoryBytes only to engage the ladder below the cgroup limit). Verified end-to-end against the pinned Envoy image: listed in the binary's compiled-in resource monitors, --mode validate OK, and a live run under docker --memory=256m reports pressure tracking the limit with zero failed_updates. Co-Authored-By: Claude Opus 4.8 <[email protected]>
bpalermo
added a commit
that referenced
this pull request
Jun 11, 2026
… 512Mi (#139) * fix(proxy): overload manager back to fixed_heap — cgroup_memory is fatal in privileged pods Deploying #138 (rev 64) took the entire data plane down for ~13 minutes: every proxy aborted at bootstrap with "No supported cgroup memory implementation found" and crash-looped until the overload manager was disabled via values (rev 65). Root cause: the cgroup_memory monitor reads /sys/fs/cgroup/memory.{current,max}. That works under docker — private cgroup namespace, the container sees its own leaf cgroup, which is where the pre-merge validation passed — but the aether-proxy DaemonSet is a PRIVILEGED pod and gets the HOST cgroup namespace: /sys/fs/cgroup is the host root cgroup, which has no memory.max. Envoy treats the failed probe as a fatal bootstrap error. The outage was cluster-wide rather than canaried because the supervisors watch the bootstrap config (fsnotify) and hot-restarted every node into the poisoned ConfigMap at once, bypassing the DaemonSet rollout safety entirely. A follow-up hardening (supervisor pre-validates new bootstrap config with `envoy --mode validate` on the node before hot-restarting, keeping the old config serving on failure) is planned separately — node- local validation WOULD have caught this, unlike the docker-side check. fixed_heap is tcmalloc-internal (no cgroup access), so its validation is environment-independent. The 768Mi = 75%-of-limit budget and its rationale are restored, and the ConfigMap now documents exactly why cgroup_memory must not be reintroduced while the proxy is privileged. Co-Authored-By: Claude Opus 4.8 <[email protected]> * feat(proxy): default proxy memory limit 512Mi Steady-state proxy RSS measured 67-148Mi post-#136 (e2e 2026-06-11), so 512Mi keeps ~3.5x headroom while halving the node memory reservation (request == limit, Guaranteed) and engaging the overload ladder earlier on a real leak. Heap budget scales with it: 384Mi = 75% of the limit (top rung 0.98x384 ~= 376Mi + non-heap extras stays under the cgroup kill line). Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
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.
Third layer of the memory-incident defense: prevention (#135/#136) → containment (#137's 1Gi limit) → graceful degradation (this PR). Today, hitting the limit means a kernel OOM SIGKILL — abrupt epoch loss and a node blip. This engages a shedding ladder well before that.
Monitor:
cgroup_memory(updated fromfixed_heapafter review discussion)The monitor reads
memory.current / memory.maxfrom the container's own cgroup (v2 — talos), so pressure is measured against the real kill line: it sees everything the OOM killer sees (tcmalloc heap, the supervisor process sharing the container, kernel socket buffers — which are charged to the cgroup and correlate with exactly the overload scenario). No heap-to-RSS ratio guesswork, no values knob to bump in lockstep with the memory limit; optionalproxy.overload.maxMemoryBytesonly to engage the ladder below the cgroup limit.Empirically verified against the pinned Envoy image (1.38 digest): listed in the binary's compiled-in resource monitors,
--mode validateOK on the rendered bootstrap, and a live run underdocker --memory=256mreportscgroup_memory.pressuretracking the limit withfailed_updates: 0.The ladder
shrink_heapdisable_http_keepalivereduce_timeouts(HTTP downstream idle scaled toward 2s)stop_accepting_requestsstop_accepting_connectionsHealth-gateway
bypass_overload_managerDelegated liveness must report app truth, not proxy state. Without the bypass, an overloaded proxy 503s the agent's liveness probes → the agent marks every local pod unhealthy → registry health flaps cluster-wide on transient overload, plus a slow re-promotion round on recovery. Shedding belongs to the data-plane listeners (503+retry, client active HC against the inbound listener), not the liveness channel. The gateway is a node-local UDS with a handful of agent connections, so the exemption frees no meaningful memory.
Trade accepted: under prolonged overload, eds-mode endpoints stay in rotation and each request pays one failed attempt + retry, instead of leaving rotation entirely — strictly better than health-flapping the registry on brief overload.
Notes
/server_infowatchdogs keep working.CONTAINERmode needs a cpu quota (we intentionally set none — throttling a data plane is worse),HOSTmode would shed on co-tenant noise.Testing
TestHealthGatewayBypassesOverloadManager; chart lint + template tests; full suite 38/38.configuration OK) + live cgroup-pressure smoke test.overload.envoy.resource_monitors.cgroup_memory.pressurereflects RSS/1Gi,failed_updates0, alloverload_actions.*.active0 in steady state.🤖 Generated with Claude Code