Skip to content

perf(test): serialize the five full-seed integration classes - #1003

Merged
mforce merged 5 commits into
mainfrom
docs/863-demo-seed-profile
Oct 1, 2026
Merged

mforce merged 5 commits into
mainfrom
docs/863-demo-seed-profile

Conversation

@mforce

@mforce mforce commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Why

03-demo-seed-profile.md identified the demo seed as CPU-bound on repeated EF change detection, and found that under full-suite contention this cost multiplies: four in-process test classes and SeedCommandTests's three subprocess seeds all run the full seeder, and left to xUnit's default parallelism they overlap and compete for the same CPU-bound work, stretching a 16.4-second isolated seed to 120-190 seconds.

Scope

  • 03-demo-seed-profile.md: the original diagnosis (phase, SQL, audit, boot, CPU, and suite-load measurements).
  • 04-seed-serialization.md: tests the hypothesis that serializing the five full-seed classes against each other, while every other class still runs in parallel, removes that self-contention.
  • DemoSeedCollection: a bare [CollectionDefinition] with no shared fixture, applied to DemoSeedTests, DemoSeedBootTests, DemoSeedDisabledOwnerTests, DemoSeedAttributionTests, and SeedCommandTests. Each class keeps its own factory and its own migrated Postgres database; this changes execution order only.

Verification

  • Three load-verified clean baseline runs (342.0-345.6 s) versus three load-verified clean runs with the five-class collection (317.6-321.0 s): a non-overlapping median saving of 23.8 seconds (6.9%). An intermediate four-class configuration (322.3-326.2 s) is recorded in the doc to show SeedCommandTests's smaller additional contribution.
  • All fourteen local full-suite runs across every configuration (clean and contaminated) passed 1,873 tests.
  • The tracked-file image-pin guard passed.
  • CI evidence: two CI runs of this PR's test code passed 1,873 tests with VSTest times of 361.9 s and 505.7 s, a 143.8 s spread on identical code. That brackets rather than beats the three post-perf(test): reuse one Postgres server for integration databases #1002 baseline runs in 02-shared-postgres-spike.md (385.7-483.3 s), so CI evidence is inconclusive on its own; see 04-seed-serialization.md's T4 for detail.

Refs #863, a broader issue about the integration suite's wall-clock floor. This PR records the profile, tests one hypothesis from it, and ships the change that hypothesis supports; the parent issue stays open for the rest of its scope.

DemoDataSeeder's daily-entry loops are CPU-bound on EF change detection
(docs/plans/863-integration-collection-split/03-demo-seed-profile.md).
Four in-process test classes and SeedCommandTests's three subprocess
seeds all run the full seeder, and under xUnit's default parallelism
they overlap and contend for the same CPU-bound work, stretching a
16.4-second isolated seed to 120-190 seconds.

Putting all five classes in one xUnit collection with no shared
fixture serializes them against each other while every other class
still runs in parallel. Three load-verified clean runs beat three
load-verified clean baseline runs by a non-overlapping median 23.8
seconds (6.9%). Each class keeps its own factory and its own migrated
Postgres database; the collection carries no ICollectionFixture, so
this changes ordering only. See
docs/plans/863-integration-collection-split/04-seed-serialization.md
for the full measurement, including a four-class intermediate
configuration and the host-contamination controls.
@mforce mforce changed the title docs(ci): profile demo seed cost perf(test): serialize the five full-seed integration classes Sep 30, 2026
One CI run of this PR's code passed with a VSTest time below all
three post-#1002 baselines in 02-shared-postgres-spike.md, consistent
with the local win but not a controlled comparison on its own.
The docs-only follow-up commit re-triggered CI, giving a second run of
the new test code: 505.7 s VSTest, versus 361.9 s on the first run.
The two runs bracket the prior baseline range rather than sitting
below it, so CI evidence is inconclusive, not corroborating. Correcting
the earlier overstatement.
The prior comment called this a spike with "the hypothesis under
test," which reads as a leftover experiment once merged and invites
deletion by a reader who assumes the contention it removes is
already gone. Restate it as a measured result, and add the rule for
which future classes belong here.
@mforce
mforce merged commit ad258d8 into main Oct 1, 2026
16 checks passed
@mforce
mforce deleted the docs/863-demo-seed-profile branch October 1, 2026 01:10
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