Skip to content

fix(parakeet): LB timeout + HPA scaling for GPU service - #8737

Merged
Git-on-my-level merged 5 commits into
mainfrom
fix/parakeet-lb-timeout-hpa-8736
Jul 1, 2026
Merged

Git-on-my-level merged 5 commits into
mainfrom
fix/parakeet-lb-timeout-hpa-8736

Conversation

@beastoin

@beastoin beastoin commented Jul 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add timeoutSec: 120 to parakeet-backend-config BackendConfig — fixes ~15% 504 errors caused by GCP defaulting to 30s while the HTTP client expects 120s read timeout
  • Add connectionDraining.drainingTimeoutSec: 130 — gracefully drains in-flight requests during scale-down/rollout (Codex recommendation)
  • Add terminationGracePeriodSeconds: 150 to deployment template + prod values — prevents K8s SIGKILL before 120s requests finish (Codex recommendation; default 30s was too short)
  • Set HPA maxReplicas to 2 to allow scaling under burst GPU load
  • Replace HPA behavior with GPU-safe scaling policy: fast scale-up (no stabilization, +1 pod/5min), conservative scale-down (600s stabilization, -1 pod/10min)

Changes

File Change
templates/service.yaml spec.timeoutSec: 120 + connectionDraining.drainingTimeoutSec: 130 on BackendConfig
templates/deployment.yaml Templated terminationGracePeriodSeconds from values
prod_omi_parakeet_values.yaml maxReplicas: 10→2, GPU-safe HPA behavior, terminationGracePeriodSeconds: 150

Codex consultation (3 turns)

  1. Turn 1: Confirmed timeout mismatch. Recommended connectionDraining + rollout strategy review. Validated 120s over 3600s (bounded unary request, not long-lived WS).
  2. Turn 2: Provided exact connectionDraining YAML. Helm lint passed. Rollout strategy maxSurge: 0, maxUnavailable: 1 is safe with 2 GPU nodes.
  3. Turn 3: Identified terminationGracePeriodSeconds gap (K8s default 30s < 120s request timeout). Confirmed no other timeout inconsistencies in chart.

Risks / Edge cases

  • Rollout during load: With maxSurge: 0, capacity drops from 2→1 pods during rollout. Mitigated by connectionDraining + terminationGracePeriodSeconds.
  • GPU node capacity: maxReplicas: 2 requires at least 2 schedulable GPU nodes with service=parakeet, env=prod affinity. Verify node count before deploy.
  • No explicit SIGTERM handler: uvicorn handles SIGTERM via exec-form CMD, but parakeet has no app-level shutdown hook. The 150s grace period gives uvicorn time to finish in-flight requests.

Test plan

  • helm lint passes (verified locally)
  • helm template renders BackendConfig with timeoutSec: 120 + connectionDraining.drainingTimeoutSec: 130 (verified locally)
  • helm template renders Deployment with terminationGracePeriodSeconds: 150 (verified locally)
  • helm template renders HPA with maxReplicas: 2 and correct behavior block (verified locally)
  • After deploy: gcloud compute backend-services describe shows timeoutSec: 120
  • Monitor Grafana "LB Request Rate by Response Code & Route" — 504 rate should drop
  • kubectl get hpa shows MAXPODS: 2
  • Verify scale-up triggers on sustained load, scale-down stabilizes for 10min

Fixes #8736

🤖 Generated with Claude Code

by AI for @beastoin

beastoin and others added 2 commits July 1, 2026 09:41
The parakeet-backend-config was missing timeoutSec, causing GCP to
default to 30s. The HTTP client expects 120s read timeout, so any
audio chunk requiring >30s GPU processing consistently 504s.

Fixes #8736

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- maxReplicas 10→2 to match available GPU node capacity
- scaleUp: no stabilization, +1 pod per 5min (react fast to load)
- scaleDown: 600s stabilization, -1 pod per 10min (prevent flapping)

Fixes #8736

Co-Authored-By: Claude Opus 4.6 <[email protected]>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

beastoin and others added 3 commits July 1, 2026 10:01
Add connectionDraining.drainingTimeoutSec: 130 to BackendConfig so the
LB gracefully drains existing connections during scale-down or rollout,
preventing 502s on long-running GPU transcription requests.

Fixes #8736

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add template support for terminationGracePeriodSeconds so pods wait
long enough for in-flight GPU requests to finish before SIGKILL.
Without this, K8s default 30s grace period conflicts with 120s request
timeout and 130s connection draining window.

Fixes #8736

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Set pod grace period to 150s (above 120s client timeout and 130s LB
drain window) so long-running transcription requests complete before
Kubernetes sends SIGKILL.

Fixes #8736

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@beastoin

beastoin commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

Test Detail Table (CP8)

Sequence ID Path ID Scenario ID Changed path Exact test command Test name(s) Assertion intent Result Evidence
N/A P1 S1-happy templates/service.yaml BackendConfig timeoutSec: 120 helm template prod-omi-parakeet backend/charts/parakeet -f backend/charts/parakeet/prod_omi_parakeet_values.yaml | grep -A 15 'kind: BackendConfig' Rendered BackendConfig includes timeoutSec Verify timeoutSec: 120 appears in rendered BackendConfig spec PASS Rendered output shows timeoutSec: 120 under spec
N/A P2 S2-happy templates/service.yaml BackendConfig connectionDraining.drainingTimeoutSec: 130 Same as P1 Rendered BackendConfig includes connectionDraining Verify drainingTimeoutSec: 130 appears in rendered BackendConfig PASS Rendered output shows connectionDraining.drainingTimeoutSec: 130
N/A P3 S3-happy templates/deployment.yaml terminationGracePeriodSeconds conditional helm template prod-omi-parakeet backend/charts/parakeet -f backend/charts/parakeet/prod_omi_parakeet_values.yaml | grep terminationGracePeriodSeconds Rendered Deployment includes grace period when set Verify terminationGracePeriodSeconds: 150 in rendered Deployment PASS Rendered output shows terminationGracePeriodSeconds: 150
N/A P3 S3-nohappy templates/deployment.yaml terminationGracePeriodSeconds absent helm template parakeet backend/charts/parakeet | grep terminationGracePeriodSeconds Rendered Deployment omits grace period when not set Verify no terminationGracePeriodSeconds in default render PASS Default render: no terminationGracePeriodSeconds emitted
N/A P4 S4-happy prod_omi_parakeet_values.yaml maxReplicas: 2 helm template prod-omi-parakeet backend/charts/parakeet -f backend/charts/parakeet/prod_omi_parakeet_values.yaml | grep -A 5 'maxReplicas' HPA maxReplicas is 2 Verify maxReplicas: 2 in rendered HPA PASS Rendered HPA shows maxReplicas: 2
N/A P5 S5-happy prod_omi_parakeet_values.yaml HPA behavior block Same HPA render HPA behavior has scaleUp stabilization 0 + scaleDown stabilization 600 Verify behavior block matches GPU-safe policy PASS Rendered shows correct stabilization values
N/A P6 S6-lint All chart files helm lint backend/charts/parakeet -f backend/charts/parakeet/prod_omi_parakeet_values.yaml Helm lint passes No lint errors or warnings PASS 1 chart(s) linted, 0 chart(s) failed

by AI for @beastoin

@beastoin

beastoin commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

Omi PR Workflow — Complete ✓

Checkpoint Status
CP0 — Skills discovery ✓
CP1 — Issue understood ✓
CP2 — Workspace setup ✓
CP3 — Exploration ✓
CP4 — Codex consult (3 turns) ✓
CP5 — Implementation ✓
CP6 — PR body ✓
CP7 — Review approved (PR_APPROVED_LGTM) ✓
CP8 — Tests approved (TESTS_APPROVED) ✓
CP9A — L1 live test (helm lint + template) ✓
CP9B — L2 integrated test (full manifest render) ✓
CP9C — L3 remote test (timeout chain validation) ✓

Codex Consultation Summary

  • Turn 1: Confirmed timeout mismatch. Recommended connectionDraining + rollout review. 120s > 3600s for bounded HTTP (not WebSocket).
  • Turn 2: Provided connectionDraining YAML. Helm lint passed. Rollout strategy safe with 2 GPUs.
  • Turn 3: Found terminationGracePeriodSeconds gap (K8s default 30s < 120s timeout). Added 150s grace.

Timeout Chain (verified consistent)

Client read=120s ≤ LB timeoutSec=120s < connectionDraining=130s < terminationGracePeriod=150s

Ready for merge review.

by AI for @beastoin

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @beastoin — solid infra fix. Quick review notes:

Timeout chain is correctly ordered ✓

  • LB timeoutSec: 120 < connectionDraining.drainingTimeoutSec: 130 < terminationGracePeriodSeconds: 150
  • This ensures a full-duration (120s) request completes before the LB gives up, the LB drains for longer than the max request, and K8s keeps the pod alive past both. The gap between 130→150 gives uvicorn headroom to finish in-flight work after SIGTERM.

HPA behavior rewrite looks sound ✓

  • Fast scale-up (stabilizationWindowSeconds: 0, +1 pod/5min) is right for burst GPU load.
  • Conservative scale-down (600s stabilization, -1 pod/10min) prevents thrashing on expensive GPU pods.
  • Dropping the Percent policy + selectPolicy in favor of pods-only is cleaner for a low-replica GPU service.

One operational note — maxReplicas: 10→2 is a capacity decision. The PR body already flags this: make sure there are ≥2 schedulable GPU nodes matching the service=parakeet, env=prod affinity before deploy. With maxSurge: 0, maxUnavailable: 1, a rollout drops capacity 2→1, so the connection draining + grace period are doing real work here.

No code-level blockers. The chart changes are clean, helm lint/template verified per the test plan, and CI is green. Safe to proceed once GPU node capacity is confirmed.

(review by Omi PR monitor — automated maintainer review, not a formal approval)

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parakeet GPU Helm/HPA tuning — Nik owns backend deploy, approve only

@Git-on-my-level
Git-on-my-level merged commit e7c3107 into main Jul 1, 2026
6 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/parakeet-lb-timeout-hpa-8736 branch July 1, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix parakeet internal LB timeout mismatch causing ~15% 504 failures

3 participants