Repository navigation
config(listen): D0b — scale prod listen on CPU 55%, socket guards 16 req / 35 ws per pod - #22934
Merged
Merged
Conversation
…req / 35 ws per pod Listen scaled only on sockets (22 ws/pod) and upgrade rate (10/pod), so pods sat at about 45% mean of their 1-CPU request off-peak while the 10-19 incident (mean 0.56-0.65, hot pods at the 2-core limit) produced no scale-out signal at all. CPU becomes the primary metric at 55%, which with the HPA's 10% tolerance acts above ~60% mean. Both socket metrics stay as guards, raised 22->35 ws and 10->16 req per pod so they bind on connection surges rather than ordinary load. minReplicas stays 40; the lead lowers the floor separately. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
… 55% and a post-roll watch Grok review: the HPA test accepted any CPU target under 60 and any guard value, so a guard could be raised until it never binds. It now pins CPU 55, guards 16/35 and min/max 40/60. listen_pusher_pipeline.mdx and listen_loop.py still described the retune as CPU 70% gated before rollout; they now name 55% and a 24h lag watch after the roll and before the floor drops. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Summary
D0b from
plan-d-realtime-gateway.md§1/§5 andcost-gap-plan-2026-10-20.mdlever #6. Prod listen now scales on CPU. Before this, only socket metrics drove scaling (22 ws/pod and 10 upgrades/pod). This is a config-only change toprod_omi_backend_listen_values.yaml:targetCPUUtilizationPercentageactiveConnectionsPerPod(ws guard)requestsPerPod(LB-request guard)minReplicas/maxReplicasWhy 55% and not the plan's 70%. The HPA takes the maximum across its metrics and ignores ratios within 10% of target. A target T therefore only scales out once mean CPU exceeds about 1.1×T. During the 2026-10-19 incident (15:10–17:25Z), mean listen CPU per pod peaked at 0.56–0.65 of the 1-CPU request (10-minute means) while the hottest pods saturated. At 70%, and also at 60%, the HPA would never have acted. At 55% it acts above about 0.60, which would have fired in the 16–17Z window. The plan's figure of about 17 pods at p50 assumes about 90% utilization; per-pod CPU is too uneven for that.
Why both socket guards rise together. Raising them is for the later floor drop, not for this roll. Live HPA right now: 14.8 ws/pod (target 22) and 8.8 on
backend_listen_requests_per_pod(target 10) at 40 pods. That second metric is every LB response code over a 3-minute window divided by replicas (prod adapter, no101filter), so 8.8 means about 117 LB requests a minute in total, not concurrent upgrades. At the old targets the guards would hold about 36 and 27 pods. That is below the floor of 40 today, but it would pin listen near 36 once the floor drops, so CPU could never take over. At 16 and 35 they bind near 22 and 17 pods at today's peak, so they act only on connection or request surges. With the old guards, CPU would still have scaled out at the incident mean (ceil(40 × 0.65 / 0.55) = 48), because the HPA takes the max. Neither guard was dropped. The guards cap the per-pod average; they do not cap the hot pod.Evidence (ro-prod tier, Cloud Monitoring aggregates only:
kubernetes_io:container_cpu_request_utilizationfor the backend-listen container, kube-state-metrics HPA status, and akubectl get hpastatus read of the metric values only):Expected pod count by hour (UTC)
Computed from the last 24h as mean CPU × replicas ÷ 0.55, rounded up. From N ready pods the HPA moves only when the recommendation leaves ±10% of N. From 40, scale-up needs a recommendation of at least 45. Scale-down then runs at 1 pod per 120s after a 600s window, so 46 → 40 takes about 20 minutes.
prod_omi_backend_listen_cronjob.yaml(which patches the floor to 10 at 01Z and 30 at 11Z) is still not applied. Todaykubectl get cronjob -Aunder ro-prod returns none.Rollout and watch
Ship this in an off-peak listen roll that the lead schedules, not together with the STT-routing fix roll, so the two listen changes stay separately attributable. Watch for 24h:
histogram_quantile(0.99, sum by (le) (rate(omi_listen_event_loop_lag_seconds_bucket[5m])))< 50 ms. This is the D0b gate inbackend/docs/listen_pusher_pipeline.mdx. It lives in the in-cluster Prometheus, not GMP.connection_lostper 10m.kube_horizontalpodautoscaler_status_desired_replicasshould track the table above. Hottest-pod CPU should stay below the 2-core limit, and liveness/readiness probe timeouts should not reappear.Known limit: a mean-CPU target does not rebalance a single hot pod; the long-lived sockets stay where they are. That hot pod existed before this change. D0a, or the edge gateway, is the fix for it.
Review
Grok: no blockers. Every should-fix is addressed in the second commit:
backend_listen_requests_per_pod;Lane / contract
Lane pusher-d0b (10-20 swarm P5 Part B); owner sign-offs for edits to other lanes' files: none
Product invariants affected
none
Verification
backend/test.shontest_backend_listen_helm_defaults.py: 10 passed. Layer: unit plus a localhelm templaterender.test_prod_listen_hpa_scales_on_cpu_with_socket_guardsrenders the prod chart. It asserts a CPU Utilization metric below 60% and pins the reviewed values: CPU 55, guards 16 and 35, floor and ceiling 40 and 60. Thelisten_pusher_pipeline.mdxandlisten_loop.pytext that called the D0b gate "CPU 70%, before the retune" now describes 55% and a 24h watch after the roll and before the floor drop.Rollback
Revert this PR (
targetCPUUtilizationPercentageback to commented out, guards back to 22 and 10) and roll listen. For an immediate effect without a roll, an operator can patch the HPA metrics. The HPA re-evaluates on its next 15s sync. Scale-down still honors the 600s window plus 1 pod per 120s, so 46 → 40 takes about 20 minutes. A chart-only listen upgrade that keeps the running image does not change the pod template, so it updates the HPA without dropping websockets.Failure-Class: none
🤖 Generated with Claude Code