Skip to content

controller: build benchmarks without debuginfo by default - #11

Merged
adriangb merged 1 commit into
mainfrom
builds-no-debuginfo-by-default
Jun 8, 2026
Merged

controller: build benchmarks without debuginfo by default#11
adriangb merged 1 commit into
mainfrom
builds-no-debuginfo-by-default

Conversation

@adriangb

@adriangb adriangb commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Problem

Benchmark pods set CARGO_PROFILE_RELEASE_DEBUG=1 (to keep DWARF symbols for gdb dumps of hung jobs). Building with debuginfo makes rustc and the linker use dramatically more memory.

I debugged a live wide_schema run on the cluster (kubectl) end to end. The OOM is a compile-time OOM, not the benchmark:

Phase cgroup anon (real RSS) peak top process
Parallel prebuild (base + branch) up to ~25 GB 29.6 GB rustc ~8 GB
"Running wide_schema baseline" (cargo bench --bench sql compile) 28 → 62 GB (monotonic) 65.0 GB = limit single rustc → 16.8 GB
OOMKilled

The pod died in ./bench.sh run wide_schemacargo bench --bench sql, i.e. while compiling the criterion SQL bench with debuginfo at -j12. The wide_schema queries themselves use ~1 GB and never ran. wide_schema is hit hardest because its "run" step compiles a bench binary inside the monitored window, once per side.

Fix

Stop setting CARGO_PROFILE_RELEASE_DEBUG=1 by default — builds are then fast and lean (a single fast lever; without debuginfo, -j12 fits comfortably).

The behavior is still available per run: the trigger comment's shared env: block is inherited by the build processes (spawn_command doesn't clear the env), so a run can opt back in:

run benchmark <name>
env:
  CARGO_PROFILE_RELEASE_DEBUG: "1"
  CARGO_BUILD_JOBS: "1"

CARGO_BUILD_JOBS: "1" serializes codegen so peak ≈ one rustc (~16 GB) instead of 12×, staying within the 65 GiB limit. Per-side baseline:/changed: env only reaches the benchmark run (not the build), so build flags belong in the shared block — the help message is updated to say so.

Follow-ups (not in this PR)

  • The reported "Peak memory" reads the pod-wide cgroup (memory.current/memory.peak), so it includes the compiler — it currently attributes rustc's memory to the benchmark. Worth measuring the bench process RSS, or starting the monitor only after compilation.

Testing

cargo fmt --check, cargo clippy -- -D warnings, cargo test (134 lib tests) all pass.

🤖 Generated with Claude Code

Pods set CARGO_PROFILE_RELEASE_DEBUG=1 to keep DWARF symbols for gdb dumps
of hung jobs. That makes rustc and the linker use far more memory. On a live
wide_schema run I watched a single rustc climb to ~16 GB and the pod cgroup
reach its 65 GiB limit and OOM-kill — during compilation, before any
benchmark query executed. (The wide_schema queries themselves use ~1 GB.)
The wide_schema "run" step compiles via `cargo bench --bench sql`, so the
heavy compile lands inside the monitored window and is repeated per side.

Drop the default so builds are fast and lean. The behavior is still
available per-run: the trigger comment's shared `env:` block is inherited by
the build processes (spawn_command inherits the pod env), so a run can opt
back in with:

  run benchmark <name>
  env:
    CARGO_PROFILE_RELEASE_DEBUG: "1"
    CARGO_BUILD_JOBS: "1"

(Per-side baseline:/changed: env only reaches the benchmark run, not the
build, so build flags belong in the shared block.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@adriangb
adriangb merged commit 12d69ea into main Jun 8, 2026
3 checks passed
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.

1 participant