Skip to content

ci(backend): experiment: backend test shards on ubuntu-26.04 - #129378

Draft
sentry-junior[bot] wants to merge 10 commits into
ci/add-xdist-worker-backend-testsfrom
ci/xdist-exp-ubuntu-26.04
Draft

sentry-junior[bot] wants to merge 10 commits into
ci/add-xdist-worker-backend-testsfrom
ci/xdist-exp-ubuntu-26.04

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Experiment stacked on #129338 (4 xdist workers). Not for merge.

Changes only the backend test job's runner from ubuntu-24.04 to ubuntu-26.04 (GA since 2026-09-17, kernel 7.0 vs 6.17). Everything else matches #129338 at 226e1191.

Question: is the same 4-vCPU / 16 GB x64 runner faster on the newer image (kernel, systemd, Docker)? The ARM experiment is #129372.

How it'll be measured: full suite (Trigger: Override Selective Testing), run at the same time as a re-run of #129338 on ubuntu-24.04. The comparison is grouped by CPU model, because runner CPU types change shard times by up to 1.9×.

Note: the venv cache key (getsentry/action-setup-venv) doesn't include the OS version, so this run may restore a venv built on 24.04. The wheels are manylinux and 26.04's glibc is newer, so that should be fine.

via @joshuarli.

--

View Session [Sentry]

joshuarli and others added 10 commits October 30, 2026 11:32
Bump XDIST_WORKERS to 4 on pull requests and master to speed up backend test shards.
Sample cpu/mem every 5s per shard and upload resource-usage artifacts with a headroom verdict for one more xdist worker.
…y-spy

Break each resource sample down into CPU-seconds per docker container,
xdist worker, pytest controller, and other host process, plus user/system/
iowait/steal split. Fix PSI parsing, which read the always-zero full line.

Sample the pytest controller and its xdist workers with py-spy and upload
the collapsed stacks with the resource artifact.

Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
…-process CPU

- Rewrite the shard's test modules, conftests and testutils once in a
  background process instead of in each xdist worker.
- Run the throwaway test postgres with fsync, synchronous_commit and
  full_page_writes off.
- Recover CPU of processes that exit between samples from their cgroup's
  cpu.stat, and record reaped children's CPU by parent.
- Turn py-spy profiling off by default; it costs ~0.4 cores.

Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
…Ms, count postgres connections

Prewarmed pycs were compiled with relative paths while pytest uses the
absolute spec origin and doesn't fix co_filename, so tracebacks changed.

sentry-shared-kafka's healthcheck starts a JVM every 5s, about 0.25 cores
during tests. Once everything that waits on Kafka is up, answer that exact
command with a TCP probe.

Log postgres connections and autovacuum runs to name the ~0.3 cores of
short-lived postgres process CPU.

Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
…d clickhouse activity

Autovacuum ran ~190 vacuums/analyzes per shard during tests, a likely source
of the ~0.3 cores of short-lived postgres process CPU. Move the service
diagnostics to a script and add ClickHouse query/part CPU breakdowns to
explain its ~0.4 cores.

Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
… postgres experiments

Same commit as the 4-worker runs except XDIST_WORKERS, to see whether the
fourth worker still pays off after the CPU fixes. Will be set back to 4.

autovacuum=off didn't change postgres CPU (exited backends are closed test
connections, not autovacuum), so it and the connection logging go.
Same-shard runtimes differ up to 1.9x between runs with identical CPU-seconds
ratios, so record each runner's CPU model.

Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
The 3-worker control on the same commit was ~9% slower in total test time
(7057s vs 6397-6535s across 30 shards) and its slowest shard 24-48s slower,
so keep 4. The ClickHouse query breakdown has answered its question.

Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
@sentry-junior sentry-junior Bot added the Trigger: Override Selective Testing Run the full test suite; necessary in cases where selected tests are flaky due to reshuffling label Oct 30, 2026
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 30, 2026
@sentry-junior

sentry-junior Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Result: ubuntu-26.04 isn't meaningfully faster than ubuntu-24.04 on x64. Run 41135687071 was green on all 30 shards and ran the full suite. The baseline is #129338 on ubuntu-24.04, re-run at the same time (41124537028 attempt 4). Attempt 3 is shown as a second baseline.

Mean test-step time per shard, by runner CPU type:

CPU 26.04 24.04 (attempt 4) 24.04 (attempt 3)
AMD EPYC 7763 242s (n=15) 240s (n=10) 244s (n=19)
AMD EPYC 9V74 189s (n=9) 200s (n=8) 191s (n=3)
AMD EPYC 9V45 150s (n=3) 165s (n=7) 148s (n=6)
  • Totals: the test step summed to 6,364s, against 6,191s and 6,470s for the two baselines. The slowest shard was 287s, against 254s and 309s. Median setup was 122s, against 118s and 123s.
  • What drives the differences: which CPUs each run got. On the same CPU type, 26.04 is within about 2% of 24.04, which is inside run-to-run noise.
  • For comparison, ARM in ci(backend): experiment: backend test shards on ubuntu-26.04-arm #129372: 154s mean on every shard, and a 4,635s total.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Trigger: Override Selective Testing Run the full test suite; necessary in cases where selected tests are flaky due to reshuffling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant