Skip to content

Envoy proxy heap growth under load: ~0.23-0.66 Mi/min, unbounded in observed window (found by 08-03 soak) #628

Closed

Description

@bpalermo

Found by the 2026-08-03 soak (rev186/0.90.0, the 034 PR 3b run) — the first soak to sample proxy RSS trajectories at 2h resolution against pod age. Full data in the run memory (project_soak_20260803_run.md).

What was measured

  • Every fresh proxy incarnation grows monotonically: 0.23–0.66 Mi/min across all 5 nodes, worst on main-worker-01 (the pod-density hot spot: 346Mi at 125min; a TRIPLE-fresh pod hit 316Mi in 9 minutes after the concurrent resync).
  • The heap-vs-cgroup discriminator says it is real Envoy heap growth: envoy_server_memory_heap_size tracks cgroup RSS within 7–18% on every node, and the gap does NOT scale with pod/volume density — ruling out cgroup accounting from the new HostToContainer kubelet-pods mount.
  • Growth rate correlates with per-node pod/service count.
  • No OOM occurred only because the soak's churn recycles the proxy every 30–90 min — steady-state production has no such protection. Limit is 512Mi; worst observation was 68% of it.

Honest scoping caveat: "new in 0.90.0" vs "always present, never measured" is UNDETERMINED — prior soaks never took these readings, and the July "aged 90–110Mi is normal" note predates several load additions.

Suggested next steps

  1. Discriminating experiment: same-cadence RSS/heap sampling on a rev185-config node (or 0.90.0 with proxy.udsWorkloads.enabled=false) vs rev186 — separates chart-version effect from newly-observed baseline behavior.
  2. If real growth: candidate mechanisms to check — per-pod pipe cluster/socket bookkeeping recycling, stats growth from the UDS clusters, connection pool accumulation under the k6 + prober + uds-client load mix.
  3. Off-hours no-load observation window to test load-dependence.

🤖 Filed from the soak grading session.

Activity

  1. added
    alert
    on Aug 3, 2026
  2. bpalermo commented on Aug 8, 2026

    @bpalermo
    OwnerAuthor

    5-day natural experiment (2026-08-03 → 08-08): the growth is load-dependent, not a steady-state leak.

    The cluster ran untouched since the soak — no churn recycling the proxies (envoy_server_uptime confirms one continuous incarnation per node, no OOM, no restart), with only background traffic (prober + uds-client ~2rps; no k6). Heap trajectories over the whole window (envoy_server_memory_heap_size, 6h resolution):

    node trajectory
    worker-01 294 → 306 Mi over ~3 days (~0.003 Mi/min — 100× slower than under soak load), then flat at 306 for the final ~2.5 days
    worker-02 flat 148
    worker-03 flat 162
    worker-04 flat 130
    worker-05 flat 172

    This answers suggested-next-step 3 (off-hours no-load observation) with far more data than planned:

    • Not unbounded at idle. Four of five nodes moved zero Mi in 5.5 days; the hot-spot node plateaued.
    • The soak-time rate (0.23–0.66 Mi/min) is therefore traffic-proportional, consistent with connection-pool / stats working-set growth toward a load-determined plateau rather than a classic leak.
    • Still open: whether an 8h+ window under sustained k6-level load plateaus or keeps climbing — the soak never saw a plateau under load, and worker-01's 306Mi standing heap (60% of the 512Mi limit, vs the July "aged 90–110Mi" norm, pre-UDS-fleet) says the plateau level scales with what the node hosts. The rev185-vs-rev186 discriminator (step 1) would now be better framed as plateau-level comparison under equal load than growth-rate comparison.

    Risk re-rating: the "512Mi if unrolled" concern softens — steady-state idle does not walk into the limit. The remaining exposure is a node whose load-determined plateau sits near the limit; worker-01 is the canary and argues for the #629 spreading regardless.

  3. bpalermo commented on Aug 9, 2026

    @bpalermo
    OwnerAuthor

    Under-load heap: ramp-then-plateau confirmed (2026-08-09 soak, 0.91.0 rev 187)

    The load-dependence question is answered: heap growth under sustained load is a fast initial ramp to a stable per-node plateau, not unbounded growth. The 08-03 read ("not plateaued, 512Mi risk if unrolled") was drawn without a within-process two-point measurement; with one, it plateaus.

    The within-process slope (the measurement that was missing)

    Same five pods, identical startTimes, 0 restarts, no proxy roll between the two reads — the only clean slope this soak's churn schedule permits.

    Point 1 03:05:29Z, point 2 04:03:41Z, real gap 58m12s (0.970h):

    node RSS 03:05 → 04:03 RSS slope heap slope
    main-worker-01 330 → 334Mi +4.1 Mi/h +4.1 MiB/h (276.0→280.0)
    main-worker-02 189 → 213Mi +24.7 Mi/h +22.7 (158.0→180.0)
    main-worker-03 189 → 182Mi −7.2 Mi/h +4.1 (160.0→164.0)
    main-worker-04 187 → 216Mi +29.9 Mi/h +28.9 (156.0→184.0)
    main-worker-05 201 → 198Mi −3.1 Mi/h +2.1 (170.0→172.0)

    worker-01: first hour 0→330Mi (~330 Mi/h), second hour +4Mi (~4 Mi/h) — an ~80× collapse in growth rate. worker-03/05 flat, RSS slightly negative (allocator reclaim while heap barely moved). worker-02/04 were still mid-ramp at 2h age (+25 to +30 Mi/h); extrapolated, they would need ~10h to approach 512Mi, and both in fact plateaued lower by end of run.

    worker-01's plateau is structural, reached in under 16 minutes, and reproducible

    The churn schedule rolls the proxy at offsets 45/120/270/330/420, which gave four independent worker-01 Envoy generations. Its heap plateau:

    generation born age at read heap
    00:49:57Z 1h15m 276.0 MiB
    00:49:57Z 1h59m 280.0 MiB
    05:04:42Z 16 min 278.0 MiB
    07:05:41Z 1h13m 284.0 MiB

    276 / 280 / 278 / 284 MiB across four fresh processes — and the third shows the plateau is reached in under 16 minutes, not accumulated over hours. This is born-hot and proportional to the node's local configuration, not decay-toward-fleet and not a leak. The T0 baseline (158.0 MiB at 8h age) was low only because it predated the k6 load.

    Fleet plateau at end of run (pods ~1h13m, under load): w03 132.0, w02 156.0, w05 164.0, w04 180.0 MiB — RSS 159/186/194/209Mi. worker-01 285/325Mi is ~1.7× the fleet median, down from ~3.6× at the unloaded T0 baseline.

    Peak RSS observed all run: worker-01 338Mi of the 512Mi limit (66%). No proxy OOMKill; 0 restarts across aether-system for the entire 8 hours.

    Also worth recording: non-heap overhead (RSS − heap) is a uniform 29–31Mi on the fleet but 54Mi on worker-01, ~75% higher.

    Methodological caveat for anyone re-running this

    A T0→checkpoint heap delta is meaningless here. The churn schedule rolls the proxy every ≤150 minutes, so any such delta spans a process restart. Every "slope" above is within a single process generation with the real elapsed gap stated. The longest uninterrupted proxy window this schedule allows is 150 minutes.

    What remains

    Enough is answered to close the load-dependence and plateau question. What this soak structurally cannot answer is whether the plateau holds beyond ~2.5h under load, because no proxy process survives longer than 150 min under the churn schedule. If that matters for the 512Mi sizing decision, the remaining experiment is the churn-exempt-node run: exclude one node's proxy from the churn schedule and let it run the full 8h under load, reading heap hourly. Given four independent generations all landing at 276–284 MiB within 16 minutes, my expectation is that it stays flat — but that is an extrapolation, not a measurement, and it is the one datum still missing.

    Suggest keeping #628 open narrowly scoped to that experiment, or closing it and filing the churn-exempt run as a small follow-up.

  4. bpalermo commented on Sep 4, 2026

    @bpalermo
    OwnerAuthor

    The "worker-01 is special" model is dead — CPU evidence from 2026-09-04

    Every profiling report since 08-09 has been framed around main-worker-01 as the fleet's hot node. Per-node CPU from the 09-04 soak's dedicated profiling pass says that is no longer true, and it matters for how this issue is read.

    Pyroscope, {service_name="aether-proxy"}, process_cpu:cpu:nanoseconds, 07:05–07:30Z (25 min, steady state, no rolls in window):

    node CPU-seconds share of fleet proxy CPU
    main-worker-01 900.65 16.39% ← lowest
    main-worker-03 922.15 16.78%
    main-worker-05 1108.00 20.17%
    main-worker-04 1248.75 22.73%
    main-worker-02 1316.45 23.95% ← highest

    Spread is 1.46× top-to-bottom, and worker-01 is at the bottom of it. The load sits on w02 and w04.

    This is consistent with what #629 closed on: the k6 errors followed the tenants to w02/w04 after the spread topology landed. What is new is that the proxy CPU has followed too, so there is no longer any residual sense in which worker-01 is the busy node. It hosts the o11y stack, which is a different resource (memory, and its own cgroups), not proxy CPU.

    What this changes for this issue

    #628 is the ramp-then-plateau RSS observation, originally recorded as a worker-01 property (276/280/278/284MiB across four proxy generations). If proxy RSS still ramps-and-plateaus on worker-01 while worker-01 is now the least CPU-loaded node in the fleet, then the ramp is clearly not load-driven — which strengthens the original "born-hot, not a leak" conclusion rather than weakening it.

    It also means any future report claiming "elevated on worker-01" needs to say elevated relative to what, because the node's position in the fleet has inverted since the model was formed.

  5. bpalermo commented on Sep 6, 2026

    @bpalermo
    OwnerAuthor

    Soak 2026-09-06, rev203 — six proxy generations sampled at a matched ~T+32 min age. Born-hot and flat; ramp-then-plateau holds.

    Samples are churn.sh's own queued #628 RSS reads, 1800 s after each proxy roll (MiB):

    generation born w01 w02 w03 w04 w05 fleet
    01:30:20Z 183 265 192 249 243 1132
    02:30:20Z 188 253 198 236 242 1117
    04:30:20Z 192 246 217 263 228 1146
    05:06:20Z 190 245 205 248 282 1170
    05:54:20Z (TRIPLE) 180 242 197 258 279 1156
    06:30:20Z 185 267 202 261 275 1190

    Every node stays inside a ±20 MiB band across six generations spanning 5 h, and the TRIPLE-born generation is not elevated — so nothing accumulates across the night, and concurrent agent+proxy churn does not produce a hotter proxy.

    Same-generation long read (06:30:20Z gen): 07:02:08Z → 09:08:52Z, gap 2h06m44s, fleet 1190 → 1267 MiB (+77, +6.5%); per node +9/+16/+18/+20/+14. So the plateau is not perfectly flat — a slow ~6% residual creep past T+32 min — but well short of a leak, and the last ~35 min of that gap contained a k6 load-generation handover, so the endpoint is not strictly like-for-like.

  6. bpalermo commented on Sep 6, 2026

    @bpalermo
    OwnerAuthor

    Dedicated ramp read, 2026-09-06 (rev203 / chart 0.92.5-0e73334)

    One-hour profiling soak, no churn driver, steady 728.5 rq/s throughout. I rolled
    ds/aether-proxy at 11:17:02Z between two 15-minute windows and sampled kubectl top at
    0/5/10/15 min in each (container_memory_working_set_bytes is absent on this cluster).

    Fresh generation (born 11:17:02–11:18:40Z), 11:23:01 → 11:38:03Z, pod age ≈5 → 20 min:

    node 0 min 5 10 15 rate
    w02 225 Mi 235 242 249 1.60 Mi/min
    w04 218 230 237 241 1.53
    w05 213 222 228 235 1.47
    w03 163 173 180 183 1.33
    w01 147 154 158 159 0.80

    Aged generation (4 h 30 m → 4 h 45 m old), 11:00:49 → 11:16:45Z, same pods, same load:

    node start mid end rate
    w02 263 Mi 269 274 0.69 Mi/min
    w04 256 262 267 0.69
    w05 258 264 268 0.63
    w03 208 212 216 0.50
    w01 190 192 194 0.25

    Three things follow.

    1. Born-hot dominates. 82–91 % of the 4 h 45 m RSS is already there at 21 minutes
    (w02 249/274 = 91 %, w01 159/194 = 82 %). The first 20 minutes buy ~85 % of the footprint.

    2. But it does not plateau. The 08-09 read ("plateau < 16 min") is too strong. At four and a
    half hours
    the aged generation was still climbing at 0.25–0.69 Mi/min — which is exactly this
    issue's original 0.23–0.66 Mi/min band. It is ramp-then-decelerate, and the tail is still positive
    at 4.5 h. Whether it ever reaches zero is not answerable from a 1-hour window; the longest observation
    here is 4 h 45 m and the derivative was still > 0.

    3. There is no CPU born-hot penalty — this is a memory-only phenomenon. At identical load the
    fresh generation burned 3.454 fleet cores vs the aged generation's 3.592 (Pyroscope
    process_cpu:cpu:nanoseconds, 900 s windows, −3.8 %). Every Envoy hot-path frame is flat or slightly
    down on the fresh pods. The only frames that rise are the TLS ones — SSL_do_handshake +2.0 %,
    do_tls_write +2.7 %, BIO_write +4.3 % absolute — which is just an empty session-resumption cache,
    worth about 0.02 cores.

    Per-node RSS ordering (w02 > w04 > w05 > w03 > w01) is identical across both generations, and so is
    the per-node CPU ranking — a full generation replacement did not move it by one place. It tracks
    tenant placement, which the roll did not change.

    Bookkeeping for anyone reading a future profile of this build: mergeInjectedEventsAndRunCb no longer
    appears in the Envoy call graph at all (top 160 of 4392 nodes, 0.31 % cutoff). It was inlined away in
    the rev197+ bzlmod snapshot and its cost now sits in the createFileEvent lambda unchanged
    (17.94 % / 18.34 %, vs 18.61 % for mergeInjected on 09-05). Its absence is not a regression.

  7. bpalermo commented on Sep 6, 2026

    @bpalermo
    OwnerAuthor

    Closing: decelerating creep, bounded in practice, no mechanism worth chasing

    What the evidence says, across every read since this was filed:

    read finding
    08-03 soak (filed) +0.23–0.66 Mi/min, unbounded in the observed window
    08-09 soak, 4 generations on w01 ramp-then-plateau: 276 / 280 / 278 / 284 MiB, generation to generation flat
    09-06 profiling soak, generation born under steady 728 rq/s born-hot is memory-only (the fresh generation is 3.8% CPU-cheaper); 82–91% of the 4h45m RSS lands within 21 min; the tail decelerates 1.6 → 0.25–0.69 Mi/min and is still positive at 4.5 h

    So the original observation was right and "plateau < 16 min" was too strong: it is a slowly decaying tail, not a flat line, and not a leak with a constant slope. Aged fleet RSS sits at ~200–280 MiB per proxy against the 512 MiB limit, every soak rolls proxies on the churn cadence, and every deploy rolls them; no proxy has ever approached the limit in 12 soaks.

    Recommendation

    1. Keep the 512 MiB proxy limit; do not raise it and do not add a restart-on-RSS policy — the creep is bounded and the hot restart already costs nothing (09-06: 0 prober deltas across a fleet roll).
    2. Keep the existing AetherProxyRSS-class alert as the guard, at the current threshold.
    3. The one unmeasured case is a proxy left unrolled for days under prober-only load. If that ever matters (a cluster with no deploys for a week), measure it then: one node, 24 h, kubectl top every 30 min; reopen only if the slope stops decaying.

    Refs: 08-09 run record, the 09-06 profiling comment above.

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

    alert

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions