Repository navigation
fix(ingest): stop rolling the EC2 fleet on every merge and right-size hosts - #1716
Conversation
… hosts Every prd deploy stamped the merged commit into ingest's task definition as COMMIT_SHA. The image is content-hashed and usually unchanged, but the new env value still registered a revision and forced a rollout, and with host networking each rollout launches two fresh c7gd hosts and drains the old ones. That was ~15 rollouts a day. - Ingest now reports INGEST_COMMIT_SHA, the last commit touching apps/ingest, resolved in deploy-prd-instance.yml (blobless full-history checkout). It leaves PRD_LOCKSTEP_REVISION_SERVICES; the skew rule's SQL is updated. - US prd ingest moves to c7gd.medium with 1 vCPU / 1.5 GiB tasks, as EU runs. Over 14 days the c7gd.large tasks peaked at 25% CPU and 6% memory. - Preview ingest uses the same smaller size.
Maple review🟢 Confidence 9/10 · safe to merge Ingest now stamps the last commit touching
Before merge
What was checked
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…oot volume c7gd.medium was the floor only because the WAL needs local NVMe. A preview carries almost no traffic, so it now runs a burstable t4g.small with a 4 GiB WAL in a root-volume directory. WAL placement and cap come from the instance type (WAL_STORAGE), so a c7gd host still refuses to join the cluster when its instance store does not mount.
Maple review🟢 Confidence 10/10 · safe to merge Stops the ingest EC2 fleet from rolling on merges that leave
Before merge
What was checked
|
|
Merged with 3 steps from "Before merge" still open. If they are done, tick them on the review comment; if not, now is the time.
|
Why
AWS spend roughly doubled in October (about $17/day to $33-38/day). Two causes in this PR:
COMMIT_SHA; the image tag is identical. A new env value still registers a revision and forces a rollout, and with host networking plusdistinctInstanceeach rollout launches two fresh c7gd hosts, drains the old ones, then scales in. On 2026-10-22 that happened ~15 times. The churn also inflates AWS Config item counts.What
deploy-prd-instance.ymlresolvesINGEST_COMMIT_SHA= last commit touchingapps/ingest(the image context), using a blobless full-history checkout.apps/ingest/alchemy.run.tsstamps that as the gateway'sCOMMIT_SHA, falling back toCOMMIT_SHA/GITHUB_SHA(previews, local). A merge that does not touchapps/ingestleaves the task definition, and the hosts, alone.PRD_LOCKSTEP_REVISION_SERVICES: it no longer reports the deployed commit. The "Prod revision skew" rule (2a6e9529…, currently disabled) already had its SQL updated to dropingest.c7gd.large+ 2048/3072 →c7gd.medium+ 1024/1536, the size EU runs. Scaling stays 2-6 at 60% CPU, so a burst adds hosts. The 48 GiB WAL cap already fits the medium's 59 GB NVMe.SMALL_INGEST) runs on a t4g.small, with a 4 GiB WAL in a directory on the 30 GB gp3 root volume. c7gd was the floor only because the WAL needs local NVMe. WAL placement and cap now come from the instance type (WAL_STORAGEinapps/ingest/alchemy.run.ts). A c7gd host still mounts its instance store before it joins the cluster, so a host whose NVMe fails never gets a task.apps/ingestsees 1-4 commits a day).Expected effect
Verification
vitest run src/env.test.ts src/profile.test.tsinpackages/infra: 31 passed.tsrs -p tsconfig.alchemy.jsonandpackages/infratypecheck: 0 errors. oxfmt clean.bash -n; the current ECS AL2023 arm64 AMI ships a 30 GB gp3 root.previewlabel on this PR would boot one (adds ~$3/day while labelled).apps/ingestshould leave the task definition revision unchanged (aws ecs describe-services --cluster maple-ingest --services maple-ingest-ec2).🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.