Public: anyone can read this; the crew can change it.

The forge's own web process always answers: check cells and crew runs never starve it (readiness flapped with 9 checks) #16251

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

torque/forge:torque/3319-the-forge-s-own-web-process-always-answe → main 0 commits fork 2 threads · 2 unresolved

  • Merged. torque/3319-the-forge-s-own-web-process-always-answe was merged into main as 0c0dd9a.

Review

Sign in to review this change.
3 files changed +18 −3
docs/APPS.md +1 −1
@@ -724,7 +724,7 @@ cell cgroup of its own at weight 10 (no memory cap; it ran in the forge's
724724 leaf, where only nice told it apart). The kernel holds each step's cell to
725725 its declared cores (`check.limits.cpus`, by `cpu.max`) and each crew run to
726726 `FORGE_CREW_CPUS` cores (default 4, at most 1024), so one busy check slows
727 itself instead of taking the pod's quota. Each is asked for and
727 itself instead of taking the pod's quota. The cores kept for the forge's own web process are `cells.servingCores` (a cpuset, no second quota), and the checks-at-once default is sized from the pod's cores less that reserve. Each is asked for and
728728 none is required: a host without `chrt` or `ionice`, or one that refuses
729729 them, runs the work as before. A full lane slows checks, not pages; an app's
730730 own process is not lowered.
src/core/capacity.ts +2 −2
@@ -72,9 +72,9 @@ export const CAPACITY: Record<CapacityKey, Definition> = {
7272 env: "FORGE_CHECKS_CONCURRENCY",
7373 kind: { type: "count", min: 1, max: 16 },
7474 fallback: "1",
75 sized: (cpus) => checksForCpus(cpus),
75 sized: (cpus) => checksForCpus(cpus - servingCoresForCpus(cpus), shardsForCpus(cpus)),
outdated

The help text just below still describes the old sizing (pod CPUs over three per shard, 80 CPUs give 6). Update it for the reserve.

7676 reason: "A check runs a whole test suite; more at once starve the web process of CPU.",
77 help: "How many repository checks run at once on this forge's own cells; each runner seen in the last minute adds the jobs it runs at once, up to 16 in all. Lowering it lets running ones finish; the next one waits. Empty: the pod's CPUs over three per shard (shards × 3), from 1 to 16 — 80 CPUs give 6.",
77 help: "How many repository checks run at once on this forge's own cells; each runner seen in the last minute adds the jobs it runs at once, up to 16 in all. Lowering it lets running ones finish; the next one waits. Empty: the pod's CPUs less the ones kept for the forge itself (cells.servingCores' default), over three per shard (shards × 3), from 1 to 16 — 80 CPUs keep 4 and give 76 / 12 = 6.",
7878 },
7979 "checks.shards": {
8080 label: "Test shards per check",
test/capacity-cpus.test.ts +15
@@ -143,3 +143,18 @@ describe("cpuLimit reads the pod's cgroup", () => {
143143 await withFile(undefined, (f) => expect(cpuLimit(f)).toBe(machine));
144144 });
145145 });
146
147 describe("checks at once leave the serving cores out (#3319)", () => {
148 test("26 CPUs keep 1, and 25 / 12 gives 2 checks; 24 CPUs keep 1, and 23 / 12 gives 1", () => {
149 const was = process.env.FORGE_CHECKS_CONCURRENCY;
150 delete process.env.FORGE_CHECKS_CONCURRENCY;
151 try {
152 // By hand: 26 / 16 keeps 1 core; shards 4; floor(25 / 12) = 2.
153 expect(capacityDefault("checks.concurrency", 26)).toBe("2");
154 // 24 CPUs keep 1; floor(23 / 12) = 1, where the whole 24 gave 2.
155 expect(capacityDefault("checks.concurrency", 24)).toBe("1");
156 } finally {
157 if (was !== undefined) process.env.FORGE_CHECKS_CONCURRENCY = was;
158 }
159 });
160 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs