Skip to content

perf(test): reuse one Postgres server for integration databases - #1002

Merged
mforce merged 3 commits into
mainfrom
perf/863-shared-postgres-spike
Sep 30, 2026
Merged

mforce merged 3 commits into
mainfrom
perf/863-shared-postgres-spike

Conversation

@mforce

@mforce mforce commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Change

  • Start one pinned Postgres Testcontainer per integration test process. Clone a migrated template into a distinct database for each factory; hand virgin databases to migration and startup-disabled tests.
  • Preserve each race's actors in one database and the dedicated one-slot app pool test.
  • Scope the first-run advisory-lock assertion to its database and add a held-lock positive control. The diagnosis and all configurations are in docs/plans/863-integration-collection-split/02-shared-postgres-spike.md.

Measurement

  • Local baseline, three full suites: 388.7, 388.6, 384.4 s; 128 Postgres containers, 138 total.
  • One-server path, three full suites: 344.1, 343.8, 346.7 s; one Postgres container, 11 total. Median wall improvement: 44.5 s (11.5%). The final staged source passed a further full run in 337.6 s.
  • CI integration Test steps on the code commit, three attempts: 535, 487, 424 s (median 487). The final documentation-only head added a 360 s pass on the same test code. The four prior fix(test): repair demo seed false pass and measure collection floor #1000 steps were 605, 606, 390, 596 s (median about 601). The ranges overlap, so CI supports a likely gain without a precise saving estimate. All four new runs passed 1,873 tests and created 11 containers.
  • The DemoSeed class split was measured separately: B-only 393.5, 368.6, 387.3 s; A+B 352.7, 347.5, 350.9 s. It did not lower the suite wall, so this PR leaves the class together.

Correctness and checks

  • Real-Postgres probe: the worker's exact (271, 1) advisory key conflicts in the same database and succeeds in another, in both directions. The first-run lock query sees a same-database held key; a temporary mutation made its zero-lock assertion fail Expected: 0; Actual: 1. The restored test passes and retains a positive control.
  • The server defaulted to 100 connections; the sampled peak was 39 clients across 13 active databases. Twenty parallel template clones completed without failure. The virgin-database, leader-lease, one-slot-pool, and intermediate-migration focused tests passed.
  • Full Release integration suite: 1,873 passed on final code. The tracked-file Postgres image-pin guard passed after the final documentation edit. dotnet build passed with zero warnings.

Refs #863.

@mforce
mforce merged commit 1953cde into main Sep 30, 2026
16 checks passed
@mforce
mforce deleted the perf/863-shared-postgres-spike branch September 30, 2026 14:11
mforce added a commit that referenced this pull request 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.
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