From 932b51dcf6e15b8d4f8449176035ca69051a73d9 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 14 Oct 2026 07:59:53 +0000 Subject: [PATCH 1/3] NR4: the 128-lane burst after the Lambda quota went to 1,500 The quota stopped lanes being lost: 128 of 128 got a runner, against 105 of 128 at the old quota of 10. The burst still arrives in waves: the first scale-up pass launched 61, the rest came with the job_retry re-check about four minutes in and over the next 13 minutes, with the fleet never past 68 busy runners. Records the measurements, what to look for in the scale-up logs, and the lanes workaround. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BLimCmjynaJv5BjifMSfws --- .../IMPLEMENTATION-STATUS.md | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/work/epics/nimbus-runners-baseline/IMPLEMENTATION-STATUS.md b/work/epics/nimbus-runners-baseline/IMPLEMENTATION-STATUS.md index f7701ef..4bf3c8f 100644 --- a/work/epics/nimbus-runners-baseline/IMPLEMENTATION-STATUS.md +++ b/work/epics/nimbus-runners-baseline/IMPLEMENTATION-STATUS.md @@ -16,9 +16,9 @@ As-built ≠ intent. This file records what actually shipped, and every place th | Measure | Target | Measured | |---|---|---| | p50 launch-to-job-start | < 60 s | ≈ 55–60 s. Queue-to-start is 87 s p50 over 15 lanes (2026-09-30), which includes the 10 s webhook delay, the queued check and CreateFleet | -| 100-job burst, worst wait for a runner | < 3 min | 50-job burst: 50/50 passed. orun-cloud cold 51-lane run: 51/51 passed, 47 started within 90 s of `plan` (p50 74 s), worst 245 s | +| 100-job burst, worst wait for a runner | < 3 min | 50-job burst: 50/50 passed. orun-cloud cold 51-lane run: 51/51 passed, 47 started within 90 s of `plan` (p50 74 s), worst 245 s. **Not met at 128 lanes (2026-10-14):** every lane got a runner, but only 61 within 3 min, and the worst waited 17 min (below) | | Spot vCPU quota `L-34B43A08` | ≥ 200 | 200 ✅ | -| Lambda concurrency `L-B99A9384` | 1,000 | 10; increase to 1,500 pending. The redelivery sweeper (#19, #21, #23) covers bursts until then | +| Lambda concurrency `L-B99A9384` | 1,000 | 1,500 ✅ (2026-10-14). No lane is lost to a throttled webhook any more; the burst still arrives in waves (below) | | orun-cloud monthly run-rate on the fleet | ≤ $55 at the 30-day volume | | ## Departures from the design @@ -69,3 +69,29 @@ The trial ran with `max-parallel: 5`. At 8, 3 of 17 webhook deliveries were thro - The first run was flattered by about 48 idle runners that the sweeper had launched by redelivering the same deliveries three minutes running. #23 now checks the job is still queued and backs off per job. - The cold run: 51/51 passed, `plan` to first step at p50 74 s and p90 88 s, worst 245 s. Lane run time p50 94 s, 87.9 runner-minutes, workflow 6.1 min, about $0.12 against $0.67 at hosted rates. - **Cutover.** The markers were removed and #1732 merged with a `ci.yml`-only diff: `run` lanes on `[self-hosted, linux, x64, nimbus]` with no `max-parallel`. `plan`, `deps-cache`, `work-sync` and `run-local` stay hosted. To break glass, set `runs-on` back to `ubuntu-latest`. + +### The burst after the Lambda quota (2026-10-14) + +[sourceplane/orun-cloud#1869](https://github.com/sourceplane/orun-cloud/pull/1869) ran orun-cloud's widest pull-request fan-out, a full verify of 128 lanes, once the account's Lambda concurrency was 1,500. It is compared with the last full verify at the old quota of 10, on 2026-10-05 ([#1826](https://github.com/sourceplane/orun-cloud/pull/1826), [run 37269666394](https://github.com/sourceplane/orun-cloud/actions/runs/37269666394)). + +| 128 lanes, from `plan` finishing | 2026-10-05, quota 10 | 2026-10-14, quota 1,500 ([run 38523921655](https://github.com/sourceplane/orun-cloud/actions/runs/38523921655)) | +|---|---|---| +| Lanes that got a runner | 105; 23 sat queued for 69 min until the run was cancelled | 128 | +| Started within 90 s / 3 min / 5 min | 47 / 48 / 48 | 61 / 61 / 99 | +| Queue to start, p50 / p90 / worst | 5.3 / 16.6 / 18.0 min | 4.2 / 7.4 / 17.2 min | +| Most lanes running at once | 48 | 61 (68 across the fleet, other pull requests included) | +| Lane run time, p50 / p90 | 92 / 209 s | 92 / 217 s | +| `plan` to the last lane finishing | — (lanes lost) | 21.6 min | +| Runner-minutes (GitHub job time) | — | 266.6 | + +The quota fixed the lost lanes. It did not fix the waves: + +- **The first scale-up pass launches 40 to 60 runners, not 128.** 61 lanes started 71–83 s after they were queued. Nothing else started until 06:53, about four minutes in, when 38 arrived together (the `job_retry` re-check, 120 s delay, plus boot). The last 29 trickled in over the next 13 minutes. A second burst later that morning, 56 lanes, had 50 running within 3 min, and its last lane waited 6.6 min. The 2026-10-05 run shows the same shape: 47, then a trickle. +- **Neither cap was reached.** At most 68 runners were busy across the fleet (`runners_maximum_count` is 100, the spot quota is 200 vCPU, 100 instances). At 06:53, 11 of the run's lanes were running and 67 were queued; from 06:59 to 07:02, 3 to 5 were running and 10 were still queued. +- **Probably not the webhook.** At 1,500 the webhook lambda has headroom for the whole burst, and the second wave came on `job_retry`'s 120 s beat, not on the sweeper's one-minute beat. The likelier loss is between SQS and a registered runner: scale-up, CreateFleet, or the JIT config. The GitHub App's delivery log would settle it. +- **It costs wall-clock.** The longest lane (`web-console-perf-budgets`, 15 min of work) waited 6m46s for a runner, so the run took 21.6 min instead of about 16.5. + +Next: read the `nimbus-runners-scale-up` logs for 2026-10-14 06:49:30–06:51:00 UTC. Look for `Some runners failed to be created`, `maximum number of runners reached`, `ThrottlingException` (SSM `PutParameter` for the JIT configs), `RequestLimitExceeded` (CreateFleet), `MaxSpotInstanceCountExceeded`, and GitHub secondary rate limits on `generate-jitconfig`. Until the cause is known, a shorter `job_retry` (`delay_in_seconds` 30–60, `max_attempts` 2–3) brings the second wave forward. The job-queued check already stops it from launching for jobs that have started. + +Packing jobs onto fewer runners with orun lanes (orun v2.76+) works around the waves, because a smaller fan-out fits inside the first pass. 56 lanes of one to three jobs, two at a time, finished the same full verify in 16.9 min on 207.6 runner-minutes. orun-cloud is not adopting lanes yet; the reasons are in #1869. + From 98d42c381b1d3afa65376af327cbf3bbd8db3553 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 14 Oct 2026 10:13:51 +0000 Subject: [PATCH 2/3] =?UTF-8?q?NR4:=20one=20scale-up=20pass=20for=20a=20wh?= =?UTF-8?q?ole=20burst=20=E2=80=94=20batches=20of=2010,=20a=20120=20s=20ti?= =?UTF-8?q?meout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A 128-lane burst got 41–61 runners at once and the rest over 17 minutes, with the fleet never past 68 busy runners (#27). The scale-up lambda works through its batch one message at a time — the queued check, CreateFleet, then a GitHub JIT config and an SSM write per runner — and at the fleet's batch of 20 it outran the module's 30 s timeout. A timed-out batch has already launched its instances but configured only some: the rest never register, yet count against runners_maximum_count until scale-down reaps them after runner_boot_time, and the batch's messages come back to a full cap. A JIT failure inside a batch that finishes is cleaned up (terminate, retry); a timeout is not. The batch goes back to the module's 10 and the timeout to 120 s (the build queue's visibility timeout follows it). job_retry stays at 120 s: a re-check shorter than a runner's ~70 s boot finds the job still queued and launches a second runner for it, so the stopgap the status file suggested is withdrawn. Fixes #27. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BLimCmjynaJv5BjifMSfws --- infra/fleet/terraform/runners.tf | 23 +++++++++++++++---- .../IMPLEMENTATION-STATUS.md | 13 ++++++++++- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/infra/fleet/terraform/runners.tf b/infra/fleet/terraform/runners.tf index fd0c9a0..edd28be 100644 --- a/infra/fleet/terraform/runners.tf +++ b/infra/fleet/terraform/runners.tf @@ -67,6 +67,9 @@ module "runners" { # short delay plus the queued check means a cancelled lane never boots. delay_webhook_event = 10 enable_job_queued_check = true + # A safety net, not the burst path. Not shorter than a runner's boot (about + # 70 s from launch to job start): a job is still queued while its runner + # boots, and an earlier re-check would launch it a second runner. job_retry = { enable = true delay_in_seconds = 120 @@ -75,12 +78,22 @@ module "runners" { # Burst: ~120 lanes land within seconds on a full verify. runners_maximum_count = local.runners_maximum_count - # No reservation: a fresh account's Lambda concurrency limit is 10, and AWS - # refuses a reservation that leaves fewer than 10 unreserved. Batches of 20 - # keep a 100-job burst to a handful of concurrent scale-up invocations. - scale_up_reserved_concurrent_executions = -1 - lambda_event_source_mapping_batch_size = 20 + # No reservation: the account's Lambda concurrency is 1,500 (2026-10-14), and + # scale-up shares it with nothing that bursts at the same time. + scale_up_reserved_concurrent_executions = -1 + # ONE SCALE-UP PASS FOR A WHOLE BURST (#27). An invocation works through its + # batch one message at a time: the queued check per job, CreateFleet, then a + # JIT config (a GitHub POST and an SSM write) per runner. At 20 messages and + # the module's 30 s timeout, batches timed out part-way: their instances were + # already launched but never configured, so they never registered, yet counted + # against runners_maximum_count until scale-down reaped them after + # runner_boot_time. A 128-lane burst got 41–61 runners at once and the rest + # over 17 minutes. The module's own batch of 10 halves the work per call, + # and 120 s (the queue's visibility timeout follows it) leaves room for a + # slow GitHub or SSM answer. + lambda_event_source_mapping_batch_size = 10 lambda_event_source_mapping_maximum_batching_window_in_seconds = 1 + runners_scale_up_lambda_timeout = 120 minimum_running_time_in_minutes = 3 runner_boot_time_in_minutes = 4 diff --git a/work/epics/nimbus-runners-baseline/IMPLEMENTATION-STATUS.md b/work/epics/nimbus-runners-baseline/IMPLEMENTATION-STATUS.md index 4bf3c8f..8b74a5f 100644 --- a/work/epics/nimbus-runners-baseline/IMPLEMENTATION-STATUS.md +++ b/work/epics/nimbus-runners-baseline/IMPLEMENTATION-STATUS.md @@ -91,7 +91,18 @@ The quota fixed the lost lanes. It did not fix the waves: - **Probably not the webhook.** At 1,500 the webhook lambda has headroom for the whole burst, and the second wave came on `job_retry`'s 120 s beat, not on the sweeper's one-minute beat. The likelier loss is between SQS and a registered runner: scale-up, CreateFleet, or the JIT config. The GitHub App's delivery log would settle it. - **It costs wall-clock.** The longest lane (`web-console-perf-budgets`, 15 min of work) waited 6m46s for a runner, so the run took 21.6 min instead of about 16.5. -Next: read the `nimbus-runners-scale-up` logs for 2026-10-14 06:49:30–06:51:00 UTC. Look for `Some runners failed to be created`, `maximum number of runners reached`, `ThrottlingException` (SSM `PutParameter` for the JIT configs), `RequestLimitExceeded` (CreateFleet), `MaxSpotInstanceCountExceeded`, and GitHub secondary rate limits on `generate-jitconfig`. Until the cause is known, a shorter `job_retry` (`delay_in_seconds` 30–60, `max_attempts` 2–3) brings the second wave forward. The job-queued check already stops it from launching for jobs that have started. +**The cause ([#27](https://github.com/sourceplane/nimbus-runners/issues/27)): the scale-up lambda timed out part-way through its batches.** +- **What one invocation does.** It works through its SQS batch one message at a time: the job-queued check per message, the runner count, one CreateFleet, then per runner a GitHub `generate-jitconfig` POST, an SSM `PutParameter` and a 25 ms pause (module v7.11.0, `scale-up.ts` and `github-runner.ts`). +- **Why it ran out of time.** The fleet raised the batch from the module's 10 to 20 and kept the module's 30 s timeout, so a full batch could outrun its lambda. +- **What a timed-out batch leaves behind.** + - Its instances are already launched but only partly configured. They never register, yet they count against `runners_maximum_count` until scale-down reaps them after `runner_boot_time_in_minutes` (4). + - Its messages return to the queue after the 30 s visibility timeout. The retries find the cap full of unconfigured instances. +- **Why it looked like waves.** A JIT failure inside a batch that completes is handled cleanly: the module terminates the unconfigured instance and retries the message. Only a timeout skips that. + +**The fix (#26):** +- `lambda_event_source_mapping_batch_size` goes back to 10. +- `runners_scale_up_lambda_timeout` goes to 120 s; the build queue's visibility timeout follows it. +- `job_retry` stays at 120 s. A re-check shorter than a runner's boot (~70 s) would find the job still queued and launch it a second runner. Packing jobs onto fewer runners with orun lanes (orun v2.76+) works around the waves, because a smaller fan-out fits inside the first pass. 56 lanes of one to three jobs, two at a time, finished the same full verify in 16.9 min on 207.6 runner-minutes. orun-cloud is not adopting lanes yet; the reasons are in #1869. From 1c1d4b90b6889559813555dc6241c77514eda70d Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 10:14:03 +0000 Subject: [PATCH 3/3] Fleet on two physical cores: m7a.large and m8a.large The runners were seven 2 vCPU / 8 GiB types picked by price-capacity- optimized. Only m7a gives "2 vCPU" as two cores; the Intel types and m5a/m6a give one core and its hyperthread. On 958 runs of 116 orun-cloud jobs (2026-10-08 to 10-14), the same job took 1.08x as long on m7i/m7i-flex, 1.16x on m6a, 1.21x on m6i, 1.27x on m5 and 1.61x on m5a as on m7a, and a third of all jobs landed on m5 or m5a. At current us-east-1 spot prices the cost per job is the same on m7a as on the old mix (sourceplane/orun-cloud#1908). The list is now m7a.large and m8a.large across the same five AZs, with the on-demand failover unchanged. runners_maximum_count stays at 100: the spot vCPU quota (L-34B43A08) is 200, so a larger cap needs that quota raised first. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BLimCmjynaJv5BjifMSfws --- README.md | 2 +- infra/fleet/terraform/local.tf | 20 +++++++++++--------- work/epics/nimbus-runners-baseline/design.md | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1a5c1ab..7f5ee61 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ GitHub ── workflow_job ──► API Gateway ──► webhook λ ──► |---|---| | **Isolation** | One ephemeral instance per job, registered with a single-use JIT config. No runner is reused. | | **Cost** | About $0.0008 per runner-minute (2 vCPU / 8 GiB spot, EBS and IPv4 included) against $0.006 on GitHub-hosted. Idle cost is about $4 a month. A monthly AWS budget alarm is part of the fleet. | -| **Burst** | 100 runners by default, across seven instance types and five availability zones, spot with on-demand fallback when a pool is empty. | +| **Burst** | 100 runners by default, on AMD `m7a`/`m8a` (two physical cores each) across five availability zones, spot with on-demand fallback when a pool is empty. | | **Start time** | A prebuilt image (`image/`) with the runner, Docker and Node baked in. No user data, no downloads at boot. | | **Missed webhooks** | GitHub never retries a failed delivery. A sweeper re-requests failed `workflow_job` deliveries for jobs that are still queued. | | **Blast radius** | Every role carries a permissions boundary; the deploy role can only touch resources under the fleet's prefix. The GitHub App key lives in SSM and never passes through Terraform state or CI. | diff --git a/infra/fleet/terraform/local.tf b/infra/fleet/terraform/local.tf index 0628bc9..14f5de5 100644 --- a/infra/fleet/terraform/local.tf +++ b/infra/fleet/terraform/local.tf @@ -30,18 +30,20 @@ locals { # budgeted burst. Lanes above the cap wait in the queue, they are not dropped. runners_maximum_count = 100 - # 2 vCPU / 8 GiB x86_64, the GitHub-hosted ubuntu-latest (private repo) shape. - # Many types across 5 AZs gives price-capacity-optimized deep spot pools for - # a 100-instance burst. No T-family: CI exhausts burst credits and unlimited + # 2 vCPU / 8 GiB x86_64, the GitHub-hosted ubuntu-latest (private repo) shape, + # as two PHYSICAL cores. AMD's 7th and 8th generations run one thread per + # core; every Intel type and m5a/m6a give "2 vCPU" as one core and its + # hyperthread. On 958 runs of 116 orun-cloud jobs (2026-10-08 to 10-14) the + # same job took, against m7a: 1.08x on m7i/m7i-flex, 1.16x on m6a, 1.21x on + # m6i, 1.27x on m5 and 1.61x on m5a, and price-capacity-optimized put a third + # of all jobs on m5/m5a. Spot cost per job is the same or lower on m7a + # (sourceplane/orun-cloud#1908). Two types across 5 AZs; a pool with no spot + # capacity fails over to on-demand. Add m7i-flex.large back only if spot + # capacity runs short. No T-family: CI exhausts burst credits and unlimited # mode bills a surcharge. instance_types = [ - "m7i-flex.large", - "m6a.large", - "m5a.large", - "m6i.large", - "m5.large", - "m7i.large", "m7a.large", + "m8a.large", ] root_volume_gb = 40 diff --git a/work/epics/nimbus-runners-baseline/design.md b/work/epics/nimbus-runners-baseline/design.md index c799835..69b5e3c 100644 --- a/work/epics/nimbus-runners-baseline/design.md +++ b/work/epics/nimbus-runners-baseline/design.md @@ -10,7 +10,7 @@ A GitHub App owned by the adopter sends `workflow_job` events to an API Gateway |---|---|---| | Runner lifecycle | Ephemeral, JIT-registered, one job per instance (`enable_ephemeral_runners`, `enable_jit_config`) | Jobs carry deploy credentials, so nothing survives between jobs. Nothing is paid between bursts. | | Capacity | Spot, `price-capacity-optimized`, seven 2 vCPU / 8 GiB x86 types across five AZs. On-demand only on `InsufficientInstanceCapacity` | Deep pools for a 100-instance burst at about 40% of the on-demand price. | -| Instance families | `m7i-flex`, `m6a`, `m5a`, `m6i`, `m5`, `m7i`, `m7a` `.large`; no T-family | Matches the private-repo `ubuntu-latest` shape. T3 runs out of CPU credits or bills unlimited-mode surcharges under CI load. | +| Instance families | `m7a`, `m8a` `.large` (until 2026-10-15: `m7i-flex`, `m6a`, `m5a`, `m6i`, `m5`, `m7i`, `m7a`); no T-family | Matches the private-repo `ubuntu-latest` shape with two physical cores: the same orun-cloud job ran 1.08–1.61× longer on the other types (sourceplane/orun-cloud#1908). T3 runs out of CPU credits or bills unlimited-mode surcharges under CI load. | | Cap | `runners_maximum_count = 100` (input `maxRunners`); scale-up concurrency 5; batch 20 | Absorbs a full orun-cloud verify. Lanes above the cap queue; they are not dropped. | | Cancelled jobs | `delay_webhook_event = 10`, `enable_job_queued_check = true` | Superseded PR runs are cancelled by the consumer's concurrency group and never boot. | | Labels | `[self-hosted, linux, x64, nimbus]` (input `runnerLabels`) | One label selects the fleet. Stage 2 adds per-job `ghr-*` labels without changing this set. |