Skip to content

Fix product page production capacity at 3 tasks - #2327

Merged
theseanything merged 1 commit into
mainfrom
product-page-fixed-capacity
Oct 19, 2026
Merged

theseanything merged 1 commit into
mainfrom
product-page-fixed-capacity

Conversation

@theseanything

@theseanything theseanything commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

Trello card: https://trello.com/c/PrXP6eBv/879-enable-alerts-for-product-page-slos

Fixes the slow product page requests that breach the 1000ms latency SLO.

Cause: autoscaling keeps scaling production between 3 and 6 tasks every few minutes. Each scale-in stops warm tasks and keeps new cold ones, and a cold task's first page renders take 1.4–3s.

Evidence (last 4 weeks):

  • 3,156 requests took over 1000ms. 98% of them came from tasks under an hour old.
  • The median task lived only 12 minutes.
  • There were no slow requests at weekends, when scaling didn't trigger.

Why it flaps: the alarms use p95 response time over 10 second periods. With our low traffic, a single slow request is enough to trigger a scale-out.

Fix: set max_capacity to match min_capacity (3), as dev and staging already do. The scaling policies can then no longer change the task count.

This is a good enough fix for now:

  • Production can no longer scale out for traffic spikes. Current load is well within what 3 tasks can handle.
  • New tasks will still be slow for a few requests after each deploy, but far less often.

Autoscaling on p95 response time over 10 second periods was flapping
between 3 and 6 tasks every few minutes. Product page traffic is low
enough that a single slow request breaches the threshold, and each
scale-in stopped the warm tasks and kept the newly started cold ones,
whose first requests are slow to render. That caused most of the slow
requests we see.

Setting max_capacity equal to min_capacity matches dev and staging and
stops the scaling policies from changing the task count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@theseanything
theseanything marked this pull request as ready for review October 19, 2026 10:28
Copilot AI balanced review requested due to automatic review settings October 19, 2026 10:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The setting implements the intended capacity limit, with the loss of automatic scale-out explicitly acknowledged.

No open issues 🎉

What changed in this PR

Constrains production product-page autoscaling to three tasks to reduce cold-start latency caused by scaling churn.

Changes:

  • Reduces max_capacity from 9 to 3, matching min_capacity and preventing automatic scale-out.
File Description
infra/​deployments/​forms/​tfvars/​production.tfvars Sets production product-page maximum capacity to three tasks.

Review effort: Balanced

@theseanything
theseanything requested a review from a team October 19, 2026 10:30

@DavidBiddle DavidBiddle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good and the change is well reasoned. I think the tradeoff of not being able to autoscale is acceptable given the current low traffic and the current use cases of this app.

@theseanything
theseanything added this pull request to the merge queue Oct 19, 2026
Merged via the queue into main with commit f56a197 Oct 19, 2026
25 checks passed
@theseanything
theseanything deleted the product-page-fixed-capacity branch October 19, 2026 10:47
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.

3 participants