fix(world-postgres): serialize graphile-worker bootstrap with advisory lock - #1966

Closed
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race
Closed

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock#1966
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Fixes the E2E Local Postgres Tests flake on main (example failing job) where the first test (addTenWorkflow) fails with:

error: duplicate key value violates unique constraint "pg_namespace_nspname_index"
❯ installSchema node_modules/.../graphile-worker/dist/migrate.js:23:5
❯ migrate node_modules/.../graphile-worker/dist/migrate.js:92:17
❯ makeWorkerUtils node_modules/.../graphile-worker/dist/workerUtils.js:12:40
❯ packages/world-postgres/dist/queue.js:212:35
❯ start packages/world-postgres/dist/queue.js:226:9

Root cause

PR #1959 removed instrumentation.ts from the workbenches, which previously pre-warmed world.start() in the Next.js dev server before any HTTP traffic arrived. Without that pre-warm, world.start() is now called lazily on the first workflow request — and in the local-postgres CI matrix, the vitest test process itself also initializes a postgres world (because WORKFLOW_TARGET_WORLD=@workflow/world-postgres is set in the test env). So two independent Node processes (the test runner and the Next.js dev server) race to install the graphile_worker schema on a fresh database.

PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe across concurrent sessions — the existence check happens at one MVCC snapshot but the pg_namespace insert happens at commit, so two sessions can both pass the check and one then fails with duplicate key value violates unique constraint "pg_namespace_nspname_index". graphile-worker's installSchema does no locking around this.

Fix

Wrap the makeWorkerUtils({pgPool}).migrate() call in packages/world-postgres/src/queue.ts with a Postgres advisory lock (pg_advisory_xact_lock) so that concurrent callers across processes are serialized on graphile-worker schema bootstrap. The lock is transaction-scoped, so it is automatically released if the bootstrapping process dies mid-flight.

Verification

  • pnpm --filter @workflow/world-postgres typecheck
  • pnpm --filter @workflow/world-postgres build
  • pnpm --filter @workflow/world-postgres test ✓ (109/109, including the real-Postgres integration tests in test/spec.test.ts that exercise the full world.start() path)

…y lock
Prevents "duplicate key value violates unique constraint
pg_namespace_nspname_index" errors when multiple processes (e.g. dev
server + test runner) call world.start() concurrently against a fresh
database. PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe
across concurrent sessions, and graphile-worker's installSchema does
not lock its bootstrap path.
CopilotAI review requested due to automatic review settings May 11, 2026 06:06
@vercel

vercelBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

changeset-botBot commented May 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8f2980

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
NameType
@workflow/world-postgresPatch
tarballsPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production120002191419
✅ 💻 Local Development158702191806
✅ 📦 Local Production158702191806
✅ 🐘 Local Postgres158702191806
✅ 🪟 Windows12900129
✅ 📋 Other7270176903
Total6817010527869

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro103026
✅ example103026
✅ express103026
✅ fastify103026
✅ hono103026
✅ nextjs-turbopack12702
✅ nextjs-webpack12702
✅ nitro103026
✅ nuxt103026
✅ sveltekit12207
✅ vite103026
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack12900
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable104025
✅ e2e-local-dev-tanstack-start-104025
✅ e2e-local-postgres-nest-stable104025
✅ e2e-local-postgres-tanstack-start-104025
✅ e2e-local-prod-nest-stable104025
✅ e2e-local-prod-tanstack-start-104025
✅ e2e-vercel-prod-tanstack-start103026

📋 View full workflow run

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.032s (-28.9% 🟢)1.006s (~)0.974s101.00x
💻 LocalNitro0.033s (-22.7% 🟢)1.006s (~)0.972s101.06x
💻 LocalNext.js (Turbopack)0.046s1.005s0.960s101.46x
🐘 PostgresExpress0.049s (-16.0% 🟢)1.012s (~)0.963s101.55x
🐘 PostgresNitro0.053s (-44.5% 🟢)1.013s (-2.9%)0.960s101.68x
🐘 PostgresNext.js (Turbopack)0.057s1.011s0.954s101.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.292s (-28.8% 🟢)2.290s (-8.7% 🟢)1.998s101.00x
▲ VercelExpress0.338s (+43.5% 🔺)2.489s (+16.5% 🔺)2.151s101.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.067s (-5.7% 🟢)2.006s (~)0.939s101.00x
💻 LocalExpress1.069s (-5.0% 🟢)2.007s (~)0.938s101.00x
🐘 PostgresExpress1.083s (-5.6% 🟢)2.008s (~)0.926s101.01x
🐘 PostgresNitro1.089s (-4.5%)2.010s (~)0.921s101.02x
💻 LocalNext.js (Turbopack)1.123s2.006s0.882s101.05x
🐘 PostgresNext.js (Turbopack)1.123s2.009s0.886s101.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.634s (-58.0% 🟢)3.924s (-33.6% 🟢)2.290s101.00x
▲ VercelExpress1.652s (-11.9% 🟢)3.842s (+0.9%)2.190s101.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.404s (-5.0%)11.022s (~)0.618s31.00x
🐘 PostgresNitro10.414s (-4.2%)11.018s (~)0.604s31.00x
💻 LocalExpress10.423s (-4.6%)11.022s (~)0.600s31.00x
🐘 PostgresExpress10.426s (-4.9%)11.019s (~)0.593s31.00x
💻 LocalNext.js (Turbopack)10.661s11.021s0.360s31.02x
🐘 PostgresNext.js (Turbopack)10.720s11.017s0.296s31.03x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.871s (-18.3% 🟢)16.522s (-17.5% 🟢)2.651s21.00x
▲ VercelNitro14.235s (-40.0% 🟢)16.109s (-35.9% 🟢)1.874s21.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express13.443s (-7.8% 🟢)14.017s (-6.7% 🟢)0.574s51.00x
💻 LocalNitro13.449s (-10.7% 🟢)14.026s (-12.5% 🟢)0.577s51.00x
💻 LocalExpress13.466s (-10.0% 🟢)14.028s (-6.7% 🟢)0.562s51.00x
🐘 PostgresNitro13.488s (-7.6% 🟢)14.016s (-6.7% 🟢)0.529s51.00x
💻 LocalNext.js (Turbopack)14.079s15.030s0.951s41.05x
🐘 PostgresNext.js (Turbopack)14.119s15.017s0.898s41.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.850s (-64.5% 🟢)24.719s (-62.9% 🟢)1.869s31.00x
▲ VercelExpress23.445s (-53.4% 🟢)25.528s (-51.4% 🟢)2.083s31.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro11.921s (-29.0% 🟢)12.147s (-28.7% 🟢)0.226s81.00x
🐘 PostgresExpress11.945s (-14.7% 🟢)12.266s (-15.9% 🟢)0.321s81.00x
🐘 PostgresNitro11.952s (-14.4% 🟢)12.143s (-15.1% 🟢)0.191s81.00x
💻 LocalExpress12.038s (-27.5% 🟢)12.649s (-25.7% 🟢)0.612s81.01x
💻 LocalNext.js (Turbopack)13.059s13.451s0.392s71.10x
🐘 PostgresNext.js (Turbopack)13.118s14.017s0.899s71.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro32.773s (-92.3% 🟢)34.865s (-91.8% 🟢)2.092s31.00x
▲ VercelExpress33.214s (-72.6% 🟢)35.758s (-71.1% 🟢)2.545s31.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.147s (-9.0% 🟢)2.007s (~)0.860s151.00x
🐘 PostgresNitro1.149s (-9.9% 🟢)2.007s (~)0.858s151.00x
💻 LocalExpress1.175s (-21.0% 🟢)2.005s (~)0.830s151.02x
💻 LocalNitro1.197s (-26.6% 🟢)2.006s (-3.3%)0.809s151.04x
🐘 PostgresNext.js (Turbopack)1.213s2.008s0.795s151.06x
💻 LocalNext.js (Turbopack)1.289s2.006s0.717s151.12x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro5.022s (+78.2% 🔺)6.611s (+53.0% 🔺)1.590s51.00x
▲ VercelExpress5.473s (+91.4% 🔺)7.608s (+64.6% 🔺)2.135s41.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.224s (-48.2% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNitro1.224s (-47.9% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNext.js (Turbopack)1.376s2.008s0.631s151.12x
💻 LocalExpress1.743s (-41.0% 🟢)2.005s (-41.9% 🟢)0.262s151.42x
💻 LocalNitro1.755s (-44.2% 🟢)2.006s (-48.4% 🟢)0.251s151.43x
💻 LocalNext.js (Turbopack)1.769s2.149s0.380s141.45x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.028s (+38.9% 🔺)6.726s (+31.6% 🔺)1.698s61.00x
▲ VercelNitro5.572s (+37.5% 🔺)7.208s (+21.7% 🔺)1.636s51.11x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.369s (-60.7% 🟢)2.007s (-50.0% 🟢)0.638s151.00x
🐘 PostgresNitro1.370s (-60.6% 🟢)2.007s (-49.9% 🟢)0.636s151.00x
🐘 PostgresNext.js (Turbopack)1.635s2.007s0.371s151.19x
💻 LocalNext.js (Turbopack)4.663s5.154s0.491s73.41x
💻 LocalNitro5.177s (-38.0% 🟢)5.679s (-37.0% 🟢)0.503s63.78x
💻 LocalExpress5.194s (-37.7% 🟢)5.513s (-38.9% 🟢)0.319s63.79x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.029s (+65.8% 🔺)8.709s (+42.1% 🔺)1.679s41.00x
▲ VercelNitro8.935s (+153.4% 🔺)10.556s (+90.7% 🔺)1.621s31.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.148s (-8.7% 🟢)2.007s (~)0.859s151.00x
🐘 PostgresExpress1.152s (-8.3% 🟢)2.007s (~)0.855s151.00x
🐘 PostgresNext.js (Turbopack)1.214s2.006s0.793s151.06x
💻 LocalNext.js (Turbopack)1.353s2.005s0.653s151.18x
💻 LocalNitro1.433s (-23.2% 🟢)2.006s (-14.3% 🟢)0.573s151.25x
💻 LocalExpress1.441s (-23.9% 🟢)2.006s (-15.1% 🟢)0.564s151.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.577s (+38.6% 🔺)5.207s (+19.7% 🔺)1.630s61.00x
▲ VercelNitro4.549s (+85.0% 🔺)6.211s (+49.0% 🔺)1.662s61.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.215s (-48.1% 🟢)2.009s (-33.3% 🟢)0.794s151.00x
🐘 PostgresNitro1.247s (-46.7% 🟢)2.009s (-33.3% 🟢)0.761s151.03x
🐘 PostgresNext.js (Turbopack)1.363s2.008s0.645s151.12x
💻 LocalNitro1.967s (-35.8% 🟢)2.469s (-36.5% 🟢)0.503s131.62x
💻 LocalExpress1.979s (-36.8% 🟢)2.392s (-36.4% 🟢)0.413s131.63x
💻 LocalNext.js (Turbopack)1.998s2.675s0.678s121.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro4.851s (+50.0% 🔺)6.263s (+23.4% 🔺)1.413s51.00x
▲ VercelExpress5.603s (+75.5% 🔺)7.182s (+49.9% 🔺)1.579s51.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.366s (-61.0% 🟢)2.008s (-49.9% 🟢)0.641s151.00x
🐘 PostgresNitro1.403s (-59.7% 🟢)2.007s (-49.9% 🟢)0.604s151.03x
🐘 PostgresNext.js (Turbopack)1.638s2.007s0.369s151.20x
💻 LocalNext.js (Turbopack)4.981s5.680s0.699s63.65x
💻 LocalNitro5.479s (-40.1% 🟢)6.214s (-38.0% 🟢)0.734s54.01x
💻 LocalExpress5.612s (-36.2% 🟢)6.214s (-33.0% 🟢)0.602s54.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.939s (+23.7% 🔺)10.418s (+27.4% 🔺)2.479s41.00x
▲ VercelNitro8.342s (+63.8% 🔺)9.730s (+42.7% 🔺)1.389s41.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.450s (-46.4% 🟢)1.006s (-1.6%)0.557s601.00x
🐘 PostgresNitro0.452s (-45.0% 🟢)1.006s (~)0.554s601.00x
💻 LocalNitro0.462s (-52.9% 🟢)1.004s (-8.2% 🟢)0.542s601.03x
💻 LocalExpress0.467s (-52.5% 🟢)1.004s (-6.7% 🟢)0.537s601.04x
🐘 PostgresNext.js (Turbopack)0.676s1.007s0.331s601.50x
💻 LocalNext.js (Turbopack)0.727s1.004s0.278s601.62x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.163s (-72.8% 🟢)7.100s (-66.7% 🟢)1.938s91.00x
▲ VercelNitro6.750s (-69.4% 🟢)8.352s (-65.2% 🟢)1.602s81.31x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.045s (-47.1% 🟢)1.523s (-32.6% 🟢)0.478s601.00x
🐘 PostgresNitro1.082s (-43.8% 🟢)1.705s (-18.8% 🟢)0.622s531.04x
💻 LocalNitro1.183s (-61.0% 🟢)2.006s (-46.6% 🟢)0.823s451.13x
💻 LocalExpress1.191s (-60.5% 🟢)2.005s (-44.1% 🟢)0.814s451.14x
🐘 PostgresNext.js (Turbopack)1.602s2.007s0.405s451.53x
💻 LocalNext.js (Turbopack)1.814s2.006s0.192s451.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.163s (-61.9% 🟢)15.281s (-58.5% 🟢)2.117s61.00x
▲ VercelNitro13.845s (-64.9% 🟢)15.606s (-62.2% 🟢)1.761s61.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.041s (-50.3% 🟢)2.477s (-46.2% 🟢)0.436s491.00x
🐘 PostgresExpress2.090s (-47.6% 🟢)2.638s (-39.6% 🟢)0.548s461.02x
💻 LocalNitro2.660s (-71.4% 🟢)3.008s (-70.0% 🟢)0.348s401.30x
💻 LocalExpress2.681s (-70.9% 🟢)3.032s (-69.7% 🟢)0.352s401.31x
🐘 PostgresNext.js (Turbopack)3.154s4.009s0.855s301.55x
💻 LocalNext.js (Turbopack)3.855s4.075s0.220s301.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express40.673s (-68.7% 🟢)42.850s (-67.6% 🟢)2.177s31.00x
▲ VercelNitro41.417s (-57.3% 🟢)43.192s (-56.1% 🟢)1.776s31.02x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.177s (-37.2% 🟢)1.007s (~)0.829s601.00x
🐘 PostgresNitro0.189s (-33.3% 🟢)1.006s (~)0.817s601.07x
🐘 PostgresNext.js (Turbopack)0.237s1.006s0.770s601.33x
💻 LocalExpress0.428s (-23.6% 🟢)1.004s (~)0.576s602.41x
💻 LocalNitro0.456s (-24.6% 🟢)1.004s (-1.7%)0.548s602.57x
💻 LocalNext.js (Turbopack)0.568s1.004s0.436s603.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.570s (+54.7% 🔺)4.071s (+21.5% 🔺)1.501s151.00x
▲ VercelExpress2.703s (+38.3% 🔺)4.438s (+22.0% 🔺)1.735s141.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.303s (-40.5% 🟢)1.007s (~)0.703s901.00x
🐘 PostgresNitro0.316s (-36.3% 🟢)1.006s (~)0.690s901.04x
🐘 PostgresNext.js (Turbopack)0.459s1.006s0.547s901.51x
💻 LocalExpress2.171s (-13.6% 🟢)2.796s (-7.1% 🟢)0.625s337.16x
💻 LocalNext.js (Turbopack)2.175s3.010s0.835s307.17x
💻 LocalNitro2.239s (-11.8% 🟢)2.944s (-2.2%)0.705s317.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro8.771s (+171.9% 🔺)10.519s (+118.2% 🔺)1.747s91.00x
▲ VercelExpress9.600s (+215.1% 🔺)12.351s (+156.9% 🔺)2.751s81.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.622s (-24.0% 🟢)1.006s (-1.1%)0.383s1201.00x
🐘 PostgresNitro0.640s (-19.0% 🟢)1.006s (~)0.365s1201.03x
🐘 PostgresNext.js (Turbopack)0.967s1.466s0.499s831.55x
💻 LocalNitro10.059s (-10.1% 🟢)10.531s (-9.7% 🟢)0.472s1216.16x
💻 LocalExpress10.208s (-8.8% 🟢)10.696s (-10.4% 🟢)0.488s1216.40x
💻 LocalNext.js (Turbopack)11.327s11.939s0.612s1118.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.654s (+205.3% 🔺)24.859s (+168.9% 🔺)2.205s61.00x
▲ VercelNitro24.155s (+212.8% 🔺)26.342s (+180.2% 🔺)2.187s51.07x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.131s (+429.4% 🔺)2.005s (+99.6% 🔺)0.012s (-2.4%)2.019s (+98.2% 🔺)0.888s101.00x
🐘 PostgresNitro1.133s (+452.4% 🔺)2.001s (+100.1% 🔺)0.001s (-13.3% 🟢)2.010s (+98.7% 🔺)0.877s101.00x
🐘 PostgresExpress1.133s (+452.7% 🔺)1.998s (+100.1% 🔺)0.001s (-31.3% 🟢)2.009s (+98.7% 🔺)0.876s101.00x
💻 LocalExpress1.134s (+469.7% 🔺)2.005s (+99.6% 🔺)0.012s (+0.8%)2.019s (+98.3% 🔺)0.885s101.00x
💻 LocalNext.js (Turbopack)1.186s2.003s0.011s2.017s0.831s101.05x
🐘 PostgresNext.js (Turbopack)1.198s2.002s0.002s2.012s0.814s101.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.433s (-36.5% 🟢)3.428s (-35.0% 🟢)2.381s (+220.8% 🔺)6.286s (-3.0%)3.853s101.00x
▲ VercelExpress2.493s (~)3.666s (-10.4% 🟢)2.778s (+189.1% 🔺)6.958s (+24.5% 🔺)4.465s101.02x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.490s (+136.5% 🔺)2.006s (+99.3% 🔺)0.004s (+0.9%)2.028s (+98.2% 🔺)0.537s301.00x
🐘 PostgresNitro1.515s (+142.7% 🔺)2.004s (+99.0% 🔺)0.004s (-6.5% 🟢)2.026s (+98.1% 🔺)0.511s301.02x
💻 LocalNitro1.527s (+82.1% 🔺)2.010s (+98.7% 🔺)0.010s (+7.8% 🔺)2.023s (+81.2% 🔺)0.496s301.02x
🐘 PostgresNext.js (Turbopack)1.693s2.010s0.004s2.027s0.334s301.14x
💻 LocalNext.js (Turbopack)1.846s2.009s0.011s2.201s0.355s281.24x
💻 LocalExpress1.926s (+154.4% 🔺)2.012s (+95.5% 🔺)0.010s (+4.5%)2.424s (+133.1% 🔺)0.498s251.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.501s (-77.9% 🟢)7.965s (-74.1% 🟢)0.254s (+126.5% 🔺)8.704s (-72.6% 🟢)2.203s71.00x
▲ VercelExpress6.740s (+3.6%)8.086s (+1.0%)0.308s (-24.6% 🟢)8.933s (+1.1%)2.193s71.04x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.657s (-32.2% 🟢)1.032s (-17.3% 🟢)0.000s (-17.2% 🟢)1.050s (-16.5% 🟢)0.392s581.00x
🐘 PostgresExpress0.660s (-31.3% 🟢)1.030s (-19.4% 🟢)0.000s (+19.0% 🔺)1.049s (-19.7% 🟢)0.389s581.00x
🐘 PostgresNext.js (Turbopack)0.794s1.072s0.000s1.079s0.285s561.21x
💻 LocalNitro1.361s (+11.3% 🔺)2.015s (~)0.000s (+133.3% 🔺)2.017s (~)0.656s302.07x
💻 LocalExpress1.361s (+11.2% 🔺)2.016s (~)0.001s (+60.0% 🔺)2.018s (~)0.657s302.07x
💻 LocalNext.js (Turbopack)1.480s2.014s0.000s2.017s0.537s302.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.891s (+27.5% 🔺)5.190s (+18.2% 🔺)0.000s (+254.5% 🔺)5.758s (+19.7% 🔺)1.868s111.00x
▲ VercelExpress4.219s (+12.8% 🔺)5.581s (+9.4% 🔺)0.002s (+1000.0% 🔺)6.074s (+9.8% 🔺)1.855s111.08x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.232s (-30.5% 🟢)1.998s (-8.3% 🟢)0.000s (+Infinity% 🔺)2.015s (-8.4% 🟢)0.783s301.00x
🐘 PostgresNitro1.273s (-28.9% 🟢)2.029s (-5.3% 🟢)0.000s (-6.7% 🟢)2.045s (-6.0% 🟢)0.771s301.03x
🐘 PostgresNext.js (Turbopack)1.610s2.110s0.000s2.145s0.534s281.31x
💻 LocalNext.js (Turbopack)2.878s3.416s0.000s3.424s0.545s182.34x
💻 LocalNitro3.083s (-9.0% 🟢)3.905s (-3.2%)0.000s (-64.8% 🟢)3.907s (-3.2%)0.824s162.50x
💻 LocalExpress3.168s (-8.6% 🟢)3.966s (-1.7%)0.001s (-6.3% 🟢)3.968s (-1.7%)0.800s162.57x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express6.633s (+44.6% 🔺)8.145s (+35.3% 🔺)0.001s (+Infinity% 🔺)8.706s (+34.8% 🔺)2.073s71.00x
▲ VercelNitro7.121s (+73.9% 🔺)8.227s (+53.1% 🔺)0.000s (-47.6% 🟢)8.712s (+50.4% 🔺)1.591s71.07x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Express | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro12/21
🐘 PostgresExpress16/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres15/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: success
  • Vercel: failure

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a flaky race during @workflow/world-postgres startup where concurrent processes can both attempt graphile-worker schema installation on a fresh database, triggering duplicate key value violates unique constraint "pg_namespace_nspname_index".

Changes:

  • Serialize graphile-worker bootstrap (makeWorkerUtils + migrate) using a Postgres advisory lock in packages/world-postgres/src/queue.ts.
  • Update unit test pool mocks to include pool.connect() to match the new startup path.
  • Add a changeset documenting the patch release.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

FileDescription
packages/world-postgres/src/queue.tsAdds transaction-scoped advisory lock wrapper around graphile-worker bootstrap to avoid concurrent schema install races.
packages/world-postgres/src/queue.test.tsUpdates pool mock to include connect() for the new locking code path.
packages/world-postgres/src/reenqueue.test.tsUpdates pool mock to include connect() for the new locking code path.
.changeset/fix-world-postgres-graphile-bootstrap-race.mdDeclares a patch release and describes the race/lock fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/world-postgres/src/queue.ts Outdated
Comment threadpackages/world-postgres/src/queue.ts Outdated
- Release the locked connection before makeWorkerUtils() so the
bootstrap can't deadlock against the same pool when maxPoolSize is
small (Copilot review #1). Achieved by replicating graphile-worker's
installSchema DDL ourselves under the lock; once the schema exists
graphile-worker's own installSchema is a no-op.
- Add a unit test that asserts the lock-ordering: pool.connect -> BEGIN
-> pg_advisory_xact_lock -> CREATE SCHEMA -> COMMIT -> release ->
makeWorkerUtils (Copilot review #2).

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not convinced we should duplicate migration code in the queue file and use a lock for this

"@workflow/world-postgres": patch
---

Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()` callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS` and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()`callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS`and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.
Ensure concurrent `world.start()`calls don't race on `CREATE SCHEMA IF NOT EXISTS`by using a lock. Fixes `duplicate key value violates unique constraint "pg_namespace_nspname_index"` errors.

@TooTallNate

Copy link
Copy Markdown
MemberAuthor

Closing in favor of #2019 — Peter's approach pre-bootstraps the graphile_worker schema in workflow-postgres-setup (the CLI that CI already runs once before any consumer process), which eliminates the race window entirely without touching the production hot path. Cleaner fix; 23 lines vs 135 here.

See #2019 (review) for the full comparison.

@TooTallNate
TooTallNate deleted the fix-world-postgres-graphile-bootstrap-race branch May 19, 2026 16:47
Sign up for freeto 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.

3 participants

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock - #1966

Closed
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race
Closed

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock#1966
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Fixes the E2E Local Postgres Tests flake on main (example failing job) where the first test (addTenWorkflow) fails with:

error: duplicate key value violates unique constraint "pg_namespace_nspname_index"
❯ installSchema node_modules/.../graphile-worker/dist/migrate.js:23:5
❯ migrate node_modules/.../graphile-worker/dist/migrate.js:92:17
❯ makeWorkerUtils node_modules/.../graphile-worker/dist/workerUtils.js:12:40
❯ packages/world-postgres/dist/queue.js:212:35
❯ start packages/world-postgres/dist/queue.js:226:9

Root cause

PR #1959 removed instrumentation.ts from the workbenches, which previously pre-warmed world.start() in the Next.js dev server before any HTTP traffic arrived. Without that pre-warm, world.start() is now called lazily on the first workflow request — and in the local-postgres CI matrix, the vitest test process itself also initializes a postgres world (because WORKFLOW_TARGET_WORLD=@workflow/world-postgres is set in the test env). So two independent Node processes (the test runner and the Next.js dev server) race to install the graphile_worker schema on a fresh database.

PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe across concurrent sessions — the existence check happens at one MVCC snapshot but the pg_namespace insert happens at commit, so two sessions can both pass the check and one then fails with duplicate key value violates unique constraint "pg_namespace_nspname_index". graphile-worker's installSchema does no locking around this.

Fix

Wrap the makeWorkerUtils({pgPool}).migrate() call in packages/world-postgres/src/queue.ts with a Postgres advisory lock (pg_advisory_xact_lock) so that concurrent callers across processes are serialized on graphile-worker schema bootstrap. The lock is transaction-scoped, so it is automatically released if the bootstrapping process dies mid-flight.

Verification

  • pnpm --filter @workflow/world-postgres typecheck
  • pnpm --filter @workflow/world-postgres build
  • pnpm --filter @workflow/world-postgres test ✓ (109/109, including the real-Postgres integration tests in test/spec.test.ts that exercise the full world.start() path)

…y lock
Prevents "duplicate key value violates unique constraint
pg_namespace_nspname_index" errors when multiple processes (e.g. dev
server + test runner) call world.start() concurrently against a fresh
database. PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe
across concurrent sessions, and graphile-worker's installSchema does
not lock its bootstrap path.
CopilotAI review requested due to automatic review settings May 11, 2026 06:06
@vercel

vercelBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

changeset-botBot commented May 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8f2980

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
NameType
@workflow/world-postgresPatch
tarballsPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production120002191419
✅ 💻 Local Development158702191806
✅ 📦 Local Production158702191806
✅ 🐘 Local Postgres158702191806
✅ 🪟 Windows12900129
✅ 📋 Other7270176903
Total6817010527869

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro103026
✅ example103026
✅ express103026
✅ fastify103026
✅ hono103026
✅ nextjs-turbopack12702
✅ nextjs-webpack12702
✅ nitro103026
✅ nuxt103026
✅ sveltekit12207
✅ vite103026
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack12900
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable104025
✅ e2e-local-dev-tanstack-start-104025
✅ e2e-local-postgres-nest-stable104025
✅ e2e-local-postgres-tanstack-start-104025
✅ e2e-local-prod-nest-stable104025
✅ e2e-local-prod-tanstack-start-104025
✅ e2e-vercel-prod-tanstack-start103026

📋 View full workflow run

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.032s (-28.9% 🟢)1.006s (~)0.974s101.00x
💻 LocalNitro0.033s (-22.7% 🟢)1.006s (~)0.972s101.06x
💻 LocalNext.js (Turbopack)0.046s1.005s0.960s101.46x
🐘 PostgresExpress0.049s (-16.0% 🟢)1.012s (~)0.963s101.55x
🐘 PostgresNitro0.053s (-44.5% 🟢)1.013s (-2.9%)0.960s101.68x
🐘 PostgresNext.js (Turbopack)0.057s1.011s0.954s101.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.292s (-28.8% 🟢)2.290s (-8.7% 🟢)1.998s101.00x
▲ VercelExpress0.338s (+43.5% 🔺)2.489s (+16.5% 🔺)2.151s101.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.067s (-5.7% 🟢)2.006s (~)0.939s101.00x
💻 LocalExpress1.069s (-5.0% 🟢)2.007s (~)0.938s101.00x
🐘 PostgresExpress1.083s (-5.6% 🟢)2.008s (~)0.926s101.01x
🐘 PostgresNitro1.089s (-4.5%)2.010s (~)0.921s101.02x
💻 LocalNext.js (Turbopack)1.123s2.006s0.882s101.05x
🐘 PostgresNext.js (Turbopack)1.123s2.009s0.886s101.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.634s (-58.0% 🟢)3.924s (-33.6% 🟢)2.290s101.00x
▲ VercelExpress1.652s (-11.9% 🟢)3.842s (+0.9%)2.190s101.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.404s (-5.0%)11.022s (~)0.618s31.00x
🐘 PostgresNitro10.414s (-4.2%)11.018s (~)0.604s31.00x
💻 LocalExpress10.423s (-4.6%)11.022s (~)0.600s31.00x
🐘 PostgresExpress10.426s (-4.9%)11.019s (~)0.593s31.00x
💻 LocalNext.js (Turbopack)10.661s11.021s0.360s31.02x
🐘 PostgresNext.js (Turbopack)10.720s11.017s0.296s31.03x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.871s (-18.3% 🟢)16.522s (-17.5% 🟢)2.651s21.00x
▲ VercelNitro14.235s (-40.0% 🟢)16.109s (-35.9% 🟢)1.874s21.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express13.443s (-7.8% 🟢)14.017s (-6.7% 🟢)0.574s51.00x
💻 LocalNitro13.449s (-10.7% 🟢)14.026s (-12.5% 🟢)0.577s51.00x
💻 LocalExpress13.466s (-10.0% 🟢)14.028s (-6.7% 🟢)0.562s51.00x
🐘 PostgresNitro13.488s (-7.6% 🟢)14.016s (-6.7% 🟢)0.529s51.00x
💻 LocalNext.js (Turbopack)14.079s15.030s0.951s41.05x
🐘 PostgresNext.js (Turbopack)14.119s15.017s0.898s41.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.850s (-64.5% 🟢)24.719s (-62.9% 🟢)1.869s31.00x
▲ VercelExpress23.445s (-53.4% 🟢)25.528s (-51.4% 🟢)2.083s31.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro11.921s (-29.0% 🟢)12.147s (-28.7% 🟢)0.226s81.00x
🐘 PostgresExpress11.945s (-14.7% 🟢)12.266s (-15.9% 🟢)0.321s81.00x
🐘 PostgresNitro11.952s (-14.4% 🟢)12.143s (-15.1% 🟢)0.191s81.00x
💻 LocalExpress12.038s (-27.5% 🟢)12.649s (-25.7% 🟢)0.612s81.01x
💻 LocalNext.js (Turbopack)13.059s13.451s0.392s71.10x
🐘 PostgresNext.js (Turbopack)13.118s14.017s0.899s71.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro32.773s (-92.3% 🟢)34.865s (-91.8% 🟢)2.092s31.00x
▲ VercelExpress33.214s (-72.6% 🟢)35.758s (-71.1% 🟢)2.545s31.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.147s (-9.0% 🟢)2.007s (~)0.860s151.00x
🐘 PostgresNitro1.149s (-9.9% 🟢)2.007s (~)0.858s151.00x
💻 LocalExpress1.175s (-21.0% 🟢)2.005s (~)0.830s151.02x
💻 LocalNitro1.197s (-26.6% 🟢)2.006s (-3.3%)0.809s151.04x
🐘 PostgresNext.js (Turbopack)1.213s2.008s0.795s151.06x
💻 LocalNext.js (Turbopack)1.289s2.006s0.717s151.12x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro5.022s (+78.2% 🔺)6.611s (+53.0% 🔺)1.590s51.00x
▲ VercelExpress5.473s (+91.4% 🔺)7.608s (+64.6% 🔺)2.135s41.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.224s (-48.2% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNitro1.224s (-47.9% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNext.js (Turbopack)1.376s2.008s0.631s151.12x
💻 LocalExpress1.743s (-41.0% 🟢)2.005s (-41.9% 🟢)0.262s151.42x
💻 LocalNitro1.755s (-44.2% 🟢)2.006s (-48.4% 🟢)0.251s151.43x
💻 LocalNext.js (Turbopack)1.769s2.149s0.380s141.45x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.028s (+38.9% 🔺)6.726s (+31.6% 🔺)1.698s61.00x
▲ VercelNitro5.572s (+37.5% 🔺)7.208s (+21.7% 🔺)1.636s51.11x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.369s (-60.7% 🟢)2.007s (-50.0% 🟢)0.638s151.00x
🐘 PostgresNitro1.370s (-60.6% 🟢)2.007s (-49.9% 🟢)0.636s151.00x
🐘 PostgresNext.js (Turbopack)1.635s2.007s0.371s151.19x
💻 LocalNext.js (Turbopack)4.663s5.154s0.491s73.41x
💻 LocalNitro5.177s (-38.0% 🟢)5.679s (-37.0% 🟢)0.503s63.78x
💻 LocalExpress5.194s (-37.7% 🟢)5.513s (-38.9% 🟢)0.319s63.79x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.029s (+65.8% 🔺)8.709s (+42.1% 🔺)1.679s41.00x
▲ VercelNitro8.935s (+153.4% 🔺)10.556s (+90.7% 🔺)1.621s31.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.148s (-8.7% 🟢)2.007s (~)0.859s151.00x
🐘 PostgresExpress1.152s (-8.3% 🟢)2.007s (~)0.855s151.00x
🐘 PostgresNext.js (Turbopack)1.214s2.006s0.793s151.06x
💻 LocalNext.js (Turbopack)1.353s2.005s0.653s151.18x
💻 LocalNitro1.433s (-23.2% 🟢)2.006s (-14.3% 🟢)0.573s151.25x
💻 LocalExpress1.441s (-23.9% 🟢)2.006s (-15.1% 🟢)0.564s151.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.577s (+38.6% 🔺)5.207s (+19.7% 🔺)1.630s61.00x
▲ VercelNitro4.549s (+85.0% 🔺)6.211s (+49.0% 🔺)1.662s61.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.215s (-48.1% 🟢)2.009s (-33.3% 🟢)0.794s151.00x
🐘 PostgresNitro1.247s (-46.7% 🟢)2.009s (-33.3% 🟢)0.761s151.03x
🐘 PostgresNext.js (Turbopack)1.363s2.008s0.645s151.12x
💻 LocalNitro1.967s (-35.8% 🟢)2.469s (-36.5% 🟢)0.503s131.62x
💻 LocalExpress1.979s (-36.8% 🟢)2.392s (-36.4% 🟢)0.413s131.63x
💻 LocalNext.js (Turbopack)1.998s2.675s0.678s121.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro4.851s (+50.0% 🔺)6.263s (+23.4% 🔺)1.413s51.00x
▲ VercelExpress5.603s (+75.5% 🔺)7.182s (+49.9% 🔺)1.579s51.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.366s (-61.0% 🟢)2.008s (-49.9% 🟢)0.641s151.00x
🐘 PostgresNitro1.403s (-59.7% 🟢)2.007s (-49.9% 🟢)0.604s151.03x
🐘 PostgresNext.js (Turbopack)1.638s2.007s0.369s151.20x
💻 LocalNext.js (Turbopack)4.981s5.680s0.699s63.65x
💻 LocalNitro5.479s (-40.1% 🟢)6.214s (-38.0% 🟢)0.734s54.01x
💻 LocalExpress5.612s (-36.2% 🟢)6.214s (-33.0% 🟢)0.602s54.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.939s (+23.7% 🔺)10.418s (+27.4% 🔺)2.479s41.00x
▲ VercelNitro8.342s (+63.8% 🔺)9.730s (+42.7% 🔺)1.389s41.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.450s (-46.4% 🟢)1.006s (-1.6%)0.557s601.00x
🐘 PostgresNitro0.452s (-45.0% 🟢)1.006s (~)0.554s601.00x
💻 LocalNitro0.462s (-52.9% 🟢)1.004s (-8.2% 🟢)0.542s601.03x
💻 LocalExpress0.467s (-52.5% 🟢)1.004s (-6.7% 🟢)0.537s601.04x
🐘 PostgresNext.js (Turbopack)0.676s1.007s0.331s601.50x
💻 LocalNext.js (Turbopack)0.727s1.004s0.278s601.62x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.163s (-72.8% 🟢)7.100s (-66.7% 🟢)1.938s91.00x
▲ VercelNitro6.750s (-69.4% 🟢)8.352s (-65.2% 🟢)1.602s81.31x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.045s (-47.1% 🟢)1.523s (-32.6% 🟢)0.478s601.00x
🐘 PostgresNitro1.082s (-43.8% 🟢)1.705s (-18.8% 🟢)0.622s531.04x
💻 LocalNitro1.183s (-61.0% 🟢)2.006s (-46.6% 🟢)0.823s451.13x
💻 LocalExpress1.191s (-60.5% 🟢)2.005s (-44.1% 🟢)0.814s451.14x
🐘 PostgresNext.js (Turbopack)1.602s2.007s0.405s451.53x
💻 LocalNext.js (Turbopack)1.814s2.006s0.192s451.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.163s (-61.9% 🟢)15.281s (-58.5% 🟢)2.117s61.00x
▲ VercelNitro13.845s (-64.9% 🟢)15.606s (-62.2% 🟢)1.761s61.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.041s (-50.3% 🟢)2.477s (-46.2% 🟢)0.436s491.00x
🐘 PostgresExpress2.090s (-47.6% 🟢)2.638s (-39.6% 🟢)0.548s461.02x
💻 LocalNitro2.660s (-71.4% 🟢)3.008s (-70.0% 🟢)0.348s401.30x
💻 LocalExpress2.681s (-70.9% 🟢)3.032s (-69.7% 🟢)0.352s401.31x
🐘 PostgresNext.js (Turbopack)3.154s4.009s0.855s301.55x
💻 LocalNext.js (Turbopack)3.855s4.075s0.220s301.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express40.673s (-68.7% 🟢)42.850s (-67.6% 🟢)2.177s31.00x
▲ VercelNitro41.417s (-57.3% 🟢)43.192s (-56.1% 🟢)1.776s31.02x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.177s (-37.2% 🟢)1.007s (~)0.829s601.00x
🐘 PostgresNitro0.189s (-33.3% 🟢)1.006s (~)0.817s601.07x
🐘 PostgresNext.js (Turbopack)0.237s1.006s0.770s601.33x
💻 LocalExpress0.428s (-23.6% 🟢)1.004s (~)0.576s602.41x
💻 LocalNitro0.456s (-24.6% 🟢)1.004s (-1.7%)0.548s602.57x
💻 LocalNext.js (Turbopack)0.568s1.004s0.436s603.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.570s (+54.7% 🔺)4.071s (+21.5% 🔺)1.501s151.00x
▲ VercelExpress2.703s (+38.3% 🔺)4.438s (+22.0% 🔺)1.735s141.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.303s (-40.5% 🟢)1.007s (~)0.703s901.00x
🐘 PostgresNitro0.316s (-36.3% 🟢)1.006s (~)0.690s901.04x
🐘 PostgresNext.js (Turbopack)0.459s1.006s0.547s901.51x
💻 LocalExpress2.171s (-13.6% 🟢)2.796s (-7.1% 🟢)0.625s337.16x
💻 LocalNext.js (Turbopack)2.175s3.010s0.835s307.17x
💻 LocalNitro2.239s (-11.8% 🟢)2.944s (-2.2%)0.705s317.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro8.771s (+171.9% 🔺)10.519s (+118.2% 🔺)1.747s91.00x
▲ VercelExpress9.600s (+215.1% 🔺)12.351s (+156.9% 🔺)2.751s81.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.622s (-24.0% 🟢)1.006s (-1.1%)0.383s1201.00x
🐘 PostgresNitro0.640s (-19.0% 🟢)1.006s (~)0.365s1201.03x
🐘 PostgresNext.js (Turbopack)0.967s1.466s0.499s831.55x
💻 LocalNitro10.059s (-10.1% 🟢)10.531s (-9.7% 🟢)0.472s1216.16x
💻 LocalExpress10.208s (-8.8% 🟢)10.696s (-10.4% 🟢)0.488s1216.40x
💻 LocalNext.js (Turbopack)11.327s11.939s0.612s1118.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.654s (+205.3% 🔺)24.859s (+168.9% 🔺)2.205s61.00x
▲ VercelNitro24.155s (+212.8% 🔺)26.342s (+180.2% 🔺)2.187s51.07x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.131s (+429.4% 🔺)2.005s (+99.6% 🔺)0.012s (-2.4%)2.019s (+98.2% 🔺)0.888s101.00x
🐘 PostgresNitro1.133s (+452.4% 🔺)2.001s (+100.1% 🔺)0.001s (-13.3% 🟢)2.010s (+98.7% 🔺)0.877s101.00x
🐘 PostgresExpress1.133s (+452.7% 🔺)1.998s (+100.1% 🔺)0.001s (-31.3% 🟢)2.009s (+98.7% 🔺)0.876s101.00x
💻 LocalExpress1.134s (+469.7% 🔺)2.005s (+99.6% 🔺)0.012s (+0.8%)2.019s (+98.3% 🔺)0.885s101.00x
💻 LocalNext.js (Turbopack)1.186s2.003s0.011s2.017s0.831s101.05x
🐘 PostgresNext.js (Turbopack)1.198s2.002s0.002s2.012s0.814s101.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.433s (-36.5% 🟢)3.428s (-35.0% 🟢)2.381s (+220.8% 🔺)6.286s (-3.0%)3.853s101.00x
▲ VercelExpress2.493s (~)3.666s (-10.4% 🟢)2.778s (+189.1% 🔺)6.958s (+24.5% 🔺)4.465s101.02x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.490s (+136.5% 🔺)2.006s (+99.3% 🔺)0.004s (+0.9%)2.028s (+98.2% 🔺)0.537s301.00x
🐘 PostgresNitro1.515s (+142.7% 🔺)2.004s (+99.0% 🔺)0.004s (-6.5% 🟢)2.026s (+98.1% 🔺)0.511s301.02x
💻 LocalNitro1.527s (+82.1% 🔺)2.010s (+98.7% 🔺)0.010s (+7.8% 🔺)2.023s (+81.2% 🔺)0.496s301.02x
🐘 PostgresNext.js (Turbopack)1.693s2.010s0.004s2.027s0.334s301.14x
💻 LocalNext.js (Turbopack)1.846s2.009s0.011s2.201s0.355s281.24x
💻 LocalExpress1.926s (+154.4% 🔺)2.012s (+95.5% 🔺)0.010s (+4.5%)2.424s (+133.1% 🔺)0.498s251.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.501s (-77.9% 🟢)7.965s (-74.1% 🟢)0.254s (+126.5% 🔺)8.704s (-72.6% 🟢)2.203s71.00x
▲ VercelExpress6.740s (+3.6%)8.086s (+1.0%)0.308s (-24.6% 🟢)8.933s (+1.1%)2.193s71.04x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.657s (-32.2% 🟢)1.032s (-17.3% 🟢)0.000s (-17.2% 🟢)1.050s (-16.5% 🟢)0.392s581.00x
🐘 PostgresExpress0.660s (-31.3% 🟢)1.030s (-19.4% 🟢)0.000s (+19.0% 🔺)1.049s (-19.7% 🟢)0.389s581.00x
🐘 PostgresNext.js (Turbopack)0.794s1.072s0.000s1.079s0.285s561.21x
💻 LocalNitro1.361s (+11.3% 🔺)2.015s (~)0.000s (+133.3% 🔺)2.017s (~)0.656s302.07x
💻 LocalExpress1.361s (+11.2% 🔺)2.016s (~)0.001s (+60.0% 🔺)2.018s (~)0.657s302.07x
💻 LocalNext.js (Turbopack)1.480s2.014s0.000s2.017s0.537s302.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.891s (+27.5% 🔺)5.190s (+18.2% 🔺)0.000s (+254.5% 🔺)5.758s (+19.7% 🔺)1.868s111.00x
▲ VercelExpress4.219s (+12.8% 🔺)5.581s (+9.4% 🔺)0.002s (+1000.0% 🔺)6.074s (+9.8% 🔺)1.855s111.08x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.232s (-30.5% 🟢)1.998s (-8.3% 🟢)0.000s (+Infinity% 🔺)2.015s (-8.4% 🟢)0.783s301.00x
🐘 PostgresNitro1.273s (-28.9% 🟢)2.029s (-5.3% 🟢)0.000s (-6.7% 🟢)2.045s (-6.0% 🟢)0.771s301.03x
🐘 PostgresNext.js (Turbopack)1.610s2.110s0.000s2.145s0.534s281.31x
💻 LocalNext.js (Turbopack)2.878s3.416s0.000s3.424s0.545s182.34x
💻 LocalNitro3.083s (-9.0% 🟢)3.905s (-3.2%)0.000s (-64.8% 🟢)3.907s (-3.2%)0.824s162.50x
💻 LocalExpress3.168s (-8.6% 🟢)3.966s (-1.7%)0.001s (-6.3% 🟢)3.968s (-1.7%)0.800s162.57x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express6.633s (+44.6% 🔺)8.145s (+35.3% 🔺)0.001s (+Infinity% 🔺)8.706s (+34.8% 🔺)2.073s71.00x
▲ VercelNitro7.121s (+73.9% 🔺)8.227s (+53.1% 🔺)0.000s (-47.6% 🟢)8.712s (+50.4% 🔺)1.591s71.07x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Express | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro12/21
🐘 PostgresExpress16/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres15/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: success
  • Vercel: failure

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a flaky race during @workflow/world-postgres startup where concurrent processes can both attempt graphile-worker schema installation on a fresh database, triggering duplicate key value violates unique constraint "pg_namespace_nspname_index".

Changes:

  • Serialize graphile-worker bootstrap (makeWorkerUtils + migrate) using a Postgres advisory lock in packages/world-postgres/src/queue.ts.
  • Update unit test pool mocks to include pool.connect() to match the new startup path.
  • Add a changeset documenting the patch release.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

FileDescription
packages/world-postgres/src/queue.tsAdds transaction-scoped advisory lock wrapper around graphile-worker bootstrap to avoid concurrent schema install races.
packages/world-postgres/src/queue.test.tsUpdates pool mock to include connect() for the new locking code path.
packages/world-postgres/src/reenqueue.test.tsUpdates pool mock to include connect() for the new locking code path.
.changeset/fix-world-postgres-graphile-bootstrap-race.mdDeclares a patch release and describes the race/lock fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/world-postgres/src/queue.ts Outdated
Comment threadpackages/world-postgres/src/queue.ts Outdated
- Release the locked connection before makeWorkerUtils() so the
bootstrap can't deadlock against the same pool when maxPoolSize is
small (Copilot review #1). Achieved by replicating graphile-worker's
installSchema DDL ourselves under the lock; once the schema exists
graphile-worker's own installSchema is a no-op.
- Add a unit test that asserts the lock-ordering: pool.connect -> BEGIN
-> pg_advisory_xact_lock -> CREATE SCHEMA -> COMMIT -> release ->
makeWorkerUtils (Copilot review #2).

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not convinced we should duplicate migration code in the queue file and use a lock for this

"@workflow/world-postgres": patch
---

Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()` callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS` and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()`callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS`and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.
Ensure concurrent `world.start()`calls don't race on `CREATE SCHEMA IF NOT EXISTS`by using a lock. Fixes `duplicate key value violates unique constraint "pg_namespace_nspname_index"` errors.

@TooTallNate

Copy link
Copy Markdown
MemberAuthor

Closing in favor of #2019 — Peter's approach pre-bootstraps the graphile_worker schema in workflow-postgres-setup (the CLI that CI already runs once before any consumer process), which eliminates the race window entirely without touching the production hot path. Cleaner fix; 23 lines vs 135 here.

See #2019 (review) for the full comparison.

@TooTallNate
TooTallNate deleted the fix-world-postgres-graphile-bootstrap-race branch May 19, 2026 16:47
Sign up for freeto 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.

3 participants

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock - #1966

Closed
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race
Closed

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock#1966
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Fixes the E2E Local Postgres Tests flake on main (example failing job) where the first test (addTenWorkflow) fails with:

error: duplicate key value violates unique constraint "pg_namespace_nspname_index"
❯ installSchema node_modules/.../graphile-worker/dist/migrate.js:23:5
❯ migrate node_modules/.../graphile-worker/dist/migrate.js:92:17
❯ makeWorkerUtils node_modules/.../graphile-worker/dist/workerUtils.js:12:40
❯ packages/world-postgres/dist/queue.js:212:35
❯ start packages/world-postgres/dist/queue.js:226:9

Root cause

PR #1959 removed instrumentation.ts from the workbenches, which previously pre-warmed world.start() in the Next.js dev server before any HTTP traffic arrived. Without that pre-warm, world.start() is now called lazily on the first workflow request — and in the local-postgres CI matrix, the vitest test process itself also initializes a postgres world (because WORKFLOW_TARGET_WORLD=@workflow/world-postgres is set in the test env). So two independent Node processes (the test runner and the Next.js dev server) race to install the graphile_worker schema on a fresh database.

PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe across concurrent sessions — the existence check happens at one MVCC snapshot but the pg_namespace insert happens at commit, so two sessions can both pass the check and one then fails with duplicate key value violates unique constraint "pg_namespace_nspname_index". graphile-worker's installSchema does no locking around this.

Fix

Wrap the makeWorkerUtils({pgPool}).migrate() call in packages/world-postgres/src/queue.ts with a Postgres advisory lock (pg_advisory_xact_lock) so that concurrent callers across processes are serialized on graphile-worker schema bootstrap. The lock is transaction-scoped, so it is automatically released if the bootstrapping process dies mid-flight.

Verification

  • pnpm --filter @workflow/world-postgres typecheck
  • pnpm --filter @workflow/world-postgres build
  • pnpm --filter @workflow/world-postgres test ✓ (109/109, including the real-Postgres integration tests in test/spec.test.ts that exercise the full world.start() path)

…y lock
Prevents "duplicate key value violates unique constraint
pg_namespace_nspname_index" errors when multiple processes (e.g. dev
server + test runner) call world.start() concurrently against a fresh
database. PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe
across concurrent sessions, and graphile-worker's installSchema does
not lock its bootstrap path.
CopilotAI review requested due to automatic review settings May 11, 2026 06:06
@vercel

vercelBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

changeset-botBot commented May 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8f2980

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
NameType
@workflow/world-postgresPatch
tarballsPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production120002191419
✅ 💻 Local Development158702191806
✅ 📦 Local Production158702191806
✅ 🐘 Local Postgres158702191806
✅ 🪟 Windows12900129
✅ 📋 Other7270176903
Total6817010527869

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro103026
✅ example103026
✅ express103026
✅ fastify103026
✅ hono103026
✅ nextjs-turbopack12702
✅ nextjs-webpack12702
✅ nitro103026
✅ nuxt103026
✅ sveltekit12207
✅ vite103026
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack12900
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable104025
✅ e2e-local-dev-tanstack-start-104025
✅ e2e-local-postgres-nest-stable104025
✅ e2e-local-postgres-tanstack-start-104025
✅ e2e-local-prod-nest-stable104025
✅ e2e-local-prod-tanstack-start-104025
✅ e2e-vercel-prod-tanstack-start103026

📋 View full workflow run

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.032s (-28.9% 🟢)1.006s (~)0.974s101.00x
💻 LocalNitro0.033s (-22.7% 🟢)1.006s (~)0.972s101.06x
💻 LocalNext.js (Turbopack)0.046s1.005s0.960s101.46x
🐘 PostgresExpress0.049s (-16.0% 🟢)1.012s (~)0.963s101.55x
🐘 PostgresNitro0.053s (-44.5% 🟢)1.013s (-2.9%)0.960s101.68x
🐘 PostgresNext.js (Turbopack)0.057s1.011s0.954s101.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.292s (-28.8% 🟢)2.290s (-8.7% 🟢)1.998s101.00x
▲ VercelExpress0.338s (+43.5% 🔺)2.489s (+16.5% 🔺)2.151s101.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.067s (-5.7% 🟢)2.006s (~)0.939s101.00x
💻 LocalExpress1.069s (-5.0% 🟢)2.007s (~)0.938s101.00x
🐘 PostgresExpress1.083s (-5.6% 🟢)2.008s (~)0.926s101.01x
🐘 PostgresNitro1.089s (-4.5%)2.010s (~)0.921s101.02x
💻 LocalNext.js (Turbopack)1.123s2.006s0.882s101.05x
🐘 PostgresNext.js (Turbopack)1.123s2.009s0.886s101.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.634s (-58.0% 🟢)3.924s (-33.6% 🟢)2.290s101.00x
▲ VercelExpress1.652s (-11.9% 🟢)3.842s (+0.9%)2.190s101.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.404s (-5.0%)11.022s (~)0.618s31.00x
🐘 PostgresNitro10.414s (-4.2%)11.018s (~)0.604s31.00x
💻 LocalExpress10.423s (-4.6%)11.022s (~)0.600s31.00x
🐘 PostgresExpress10.426s (-4.9%)11.019s (~)0.593s31.00x
💻 LocalNext.js (Turbopack)10.661s11.021s0.360s31.02x
🐘 PostgresNext.js (Turbopack)10.720s11.017s0.296s31.03x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.871s (-18.3% 🟢)16.522s (-17.5% 🟢)2.651s21.00x
▲ VercelNitro14.235s (-40.0% 🟢)16.109s (-35.9% 🟢)1.874s21.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express13.443s (-7.8% 🟢)14.017s (-6.7% 🟢)0.574s51.00x
💻 LocalNitro13.449s (-10.7% 🟢)14.026s (-12.5% 🟢)0.577s51.00x
💻 LocalExpress13.466s (-10.0% 🟢)14.028s (-6.7% 🟢)0.562s51.00x
🐘 PostgresNitro13.488s (-7.6% 🟢)14.016s (-6.7% 🟢)0.529s51.00x
💻 LocalNext.js (Turbopack)14.079s15.030s0.951s41.05x
🐘 PostgresNext.js (Turbopack)14.119s15.017s0.898s41.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.850s (-64.5% 🟢)24.719s (-62.9% 🟢)1.869s31.00x
▲ VercelExpress23.445s (-53.4% 🟢)25.528s (-51.4% 🟢)2.083s31.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro11.921s (-29.0% 🟢)12.147s (-28.7% 🟢)0.226s81.00x
🐘 PostgresExpress11.945s (-14.7% 🟢)12.266s (-15.9% 🟢)0.321s81.00x
🐘 PostgresNitro11.952s (-14.4% 🟢)12.143s (-15.1% 🟢)0.191s81.00x
💻 LocalExpress12.038s (-27.5% 🟢)12.649s (-25.7% 🟢)0.612s81.01x
💻 LocalNext.js (Turbopack)13.059s13.451s0.392s71.10x
🐘 PostgresNext.js (Turbopack)13.118s14.017s0.899s71.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro32.773s (-92.3% 🟢)34.865s (-91.8% 🟢)2.092s31.00x
▲ VercelExpress33.214s (-72.6% 🟢)35.758s (-71.1% 🟢)2.545s31.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.147s (-9.0% 🟢)2.007s (~)0.860s151.00x
🐘 PostgresNitro1.149s (-9.9% 🟢)2.007s (~)0.858s151.00x
💻 LocalExpress1.175s (-21.0% 🟢)2.005s (~)0.830s151.02x
💻 LocalNitro1.197s (-26.6% 🟢)2.006s (-3.3%)0.809s151.04x
🐘 PostgresNext.js (Turbopack)1.213s2.008s0.795s151.06x
💻 LocalNext.js (Turbopack)1.289s2.006s0.717s151.12x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro5.022s (+78.2% 🔺)6.611s (+53.0% 🔺)1.590s51.00x
▲ VercelExpress5.473s (+91.4% 🔺)7.608s (+64.6% 🔺)2.135s41.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.224s (-48.2% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNitro1.224s (-47.9% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNext.js (Turbopack)1.376s2.008s0.631s151.12x
💻 LocalExpress1.743s (-41.0% 🟢)2.005s (-41.9% 🟢)0.262s151.42x
💻 LocalNitro1.755s (-44.2% 🟢)2.006s (-48.4% 🟢)0.251s151.43x
💻 LocalNext.js (Turbopack)1.769s2.149s0.380s141.45x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.028s (+38.9% 🔺)6.726s (+31.6% 🔺)1.698s61.00x
▲ VercelNitro5.572s (+37.5% 🔺)7.208s (+21.7% 🔺)1.636s51.11x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.369s (-60.7% 🟢)2.007s (-50.0% 🟢)0.638s151.00x
🐘 PostgresNitro1.370s (-60.6% 🟢)2.007s (-49.9% 🟢)0.636s151.00x
🐘 PostgresNext.js (Turbopack)1.635s2.007s0.371s151.19x
💻 LocalNext.js (Turbopack)4.663s5.154s0.491s73.41x
💻 LocalNitro5.177s (-38.0% 🟢)5.679s (-37.0% 🟢)0.503s63.78x
💻 LocalExpress5.194s (-37.7% 🟢)5.513s (-38.9% 🟢)0.319s63.79x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.029s (+65.8% 🔺)8.709s (+42.1% 🔺)1.679s41.00x
▲ VercelNitro8.935s (+153.4% 🔺)10.556s (+90.7% 🔺)1.621s31.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.148s (-8.7% 🟢)2.007s (~)0.859s151.00x
🐘 PostgresExpress1.152s (-8.3% 🟢)2.007s (~)0.855s151.00x
🐘 PostgresNext.js (Turbopack)1.214s2.006s0.793s151.06x
💻 LocalNext.js (Turbopack)1.353s2.005s0.653s151.18x
💻 LocalNitro1.433s (-23.2% 🟢)2.006s (-14.3% 🟢)0.573s151.25x
💻 LocalExpress1.441s (-23.9% 🟢)2.006s (-15.1% 🟢)0.564s151.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.577s (+38.6% 🔺)5.207s (+19.7% 🔺)1.630s61.00x
▲ VercelNitro4.549s (+85.0% 🔺)6.211s (+49.0% 🔺)1.662s61.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.215s (-48.1% 🟢)2.009s (-33.3% 🟢)0.794s151.00x
🐘 PostgresNitro1.247s (-46.7% 🟢)2.009s (-33.3% 🟢)0.761s151.03x
🐘 PostgresNext.js (Turbopack)1.363s2.008s0.645s151.12x
💻 LocalNitro1.967s (-35.8% 🟢)2.469s (-36.5% 🟢)0.503s131.62x
💻 LocalExpress1.979s (-36.8% 🟢)2.392s (-36.4% 🟢)0.413s131.63x
💻 LocalNext.js (Turbopack)1.998s2.675s0.678s121.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro4.851s (+50.0% 🔺)6.263s (+23.4% 🔺)1.413s51.00x
▲ VercelExpress5.603s (+75.5% 🔺)7.182s (+49.9% 🔺)1.579s51.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.366s (-61.0% 🟢)2.008s (-49.9% 🟢)0.641s151.00x
🐘 PostgresNitro1.403s (-59.7% 🟢)2.007s (-49.9% 🟢)0.604s151.03x
🐘 PostgresNext.js (Turbopack)1.638s2.007s0.369s151.20x
💻 LocalNext.js (Turbopack)4.981s5.680s0.699s63.65x
💻 LocalNitro5.479s (-40.1% 🟢)6.214s (-38.0% 🟢)0.734s54.01x
💻 LocalExpress5.612s (-36.2% 🟢)6.214s (-33.0% 🟢)0.602s54.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.939s (+23.7% 🔺)10.418s (+27.4% 🔺)2.479s41.00x
▲ VercelNitro8.342s (+63.8% 🔺)9.730s (+42.7% 🔺)1.389s41.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.450s (-46.4% 🟢)1.006s (-1.6%)0.557s601.00x
🐘 PostgresNitro0.452s (-45.0% 🟢)1.006s (~)0.554s601.00x
💻 LocalNitro0.462s (-52.9% 🟢)1.004s (-8.2% 🟢)0.542s601.03x
💻 LocalExpress0.467s (-52.5% 🟢)1.004s (-6.7% 🟢)0.537s601.04x
🐘 PostgresNext.js (Turbopack)0.676s1.007s0.331s601.50x
💻 LocalNext.js (Turbopack)0.727s1.004s0.278s601.62x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.163s (-72.8% 🟢)7.100s (-66.7% 🟢)1.938s91.00x
▲ VercelNitro6.750s (-69.4% 🟢)8.352s (-65.2% 🟢)1.602s81.31x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.045s (-47.1% 🟢)1.523s (-32.6% 🟢)0.478s601.00x
🐘 PostgresNitro1.082s (-43.8% 🟢)1.705s (-18.8% 🟢)0.622s531.04x
💻 LocalNitro1.183s (-61.0% 🟢)2.006s (-46.6% 🟢)0.823s451.13x
💻 LocalExpress1.191s (-60.5% 🟢)2.005s (-44.1% 🟢)0.814s451.14x
🐘 PostgresNext.js (Turbopack)1.602s2.007s0.405s451.53x
💻 LocalNext.js (Turbopack)1.814s2.006s0.192s451.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.163s (-61.9% 🟢)15.281s (-58.5% 🟢)2.117s61.00x
▲ VercelNitro13.845s (-64.9% 🟢)15.606s (-62.2% 🟢)1.761s61.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.041s (-50.3% 🟢)2.477s (-46.2% 🟢)0.436s491.00x
🐘 PostgresExpress2.090s (-47.6% 🟢)2.638s (-39.6% 🟢)0.548s461.02x
💻 LocalNitro2.660s (-71.4% 🟢)3.008s (-70.0% 🟢)0.348s401.30x
💻 LocalExpress2.681s (-70.9% 🟢)3.032s (-69.7% 🟢)0.352s401.31x
🐘 PostgresNext.js (Turbopack)3.154s4.009s0.855s301.55x
💻 LocalNext.js (Turbopack)3.855s4.075s0.220s301.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express40.673s (-68.7% 🟢)42.850s (-67.6% 🟢)2.177s31.00x
▲ VercelNitro41.417s (-57.3% 🟢)43.192s (-56.1% 🟢)1.776s31.02x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.177s (-37.2% 🟢)1.007s (~)0.829s601.00x
🐘 PostgresNitro0.189s (-33.3% 🟢)1.006s (~)0.817s601.07x
🐘 PostgresNext.js (Turbopack)0.237s1.006s0.770s601.33x
💻 LocalExpress0.428s (-23.6% 🟢)1.004s (~)0.576s602.41x
💻 LocalNitro0.456s (-24.6% 🟢)1.004s (-1.7%)0.548s602.57x
💻 LocalNext.js (Turbopack)0.568s1.004s0.436s603.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.570s (+54.7% 🔺)4.071s (+21.5% 🔺)1.501s151.00x
▲ VercelExpress2.703s (+38.3% 🔺)4.438s (+22.0% 🔺)1.735s141.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.303s (-40.5% 🟢)1.007s (~)0.703s901.00x
🐘 PostgresNitro0.316s (-36.3% 🟢)1.006s (~)0.690s901.04x
🐘 PostgresNext.js (Turbopack)0.459s1.006s0.547s901.51x
💻 LocalExpress2.171s (-13.6% 🟢)2.796s (-7.1% 🟢)0.625s337.16x
💻 LocalNext.js (Turbopack)2.175s3.010s0.835s307.17x
💻 LocalNitro2.239s (-11.8% 🟢)2.944s (-2.2%)0.705s317.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro8.771s (+171.9% 🔺)10.519s (+118.2% 🔺)1.747s91.00x
▲ VercelExpress9.600s (+215.1% 🔺)12.351s (+156.9% 🔺)2.751s81.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.622s (-24.0% 🟢)1.006s (-1.1%)0.383s1201.00x
🐘 PostgresNitro0.640s (-19.0% 🟢)1.006s (~)0.365s1201.03x
🐘 PostgresNext.js (Turbopack)0.967s1.466s0.499s831.55x
💻 LocalNitro10.059s (-10.1% 🟢)10.531s (-9.7% 🟢)0.472s1216.16x
💻 LocalExpress10.208s (-8.8% 🟢)10.696s (-10.4% 🟢)0.488s1216.40x
💻 LocalNext.js (Turbopack)11.327s11.939s0.612s1118.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.654s (+205.3% 🔺)24.859s (+168.9% 🔺)2.205s61.00x
▲ VercelNitro24.155s (+212.8% 🔺)26.342s (+180.2% 🔺)2.187s51.07x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.131s (+429.4% 🔺)2.005s (+99.6% 🔺)0.012s (-2.4%)2.019s (+98.2% 🔺)0.888s101.00x
🐘 PostgresNitro1.133s (+452.4% 🔺)2.001s (+100.1% 🔺)0.001s (-13.3% 🟢)2.010s (+98.7% 🔺)0.877s101.00x
🐘 PostgresExpress1.133s (+452.7% 🔺)1.998s (+100.1% 🔺)0.001s (-31.3% 🟢)2.009s (+98.7% 🔺)0.876s101.00x
💻 LocalExpress1.134s (+469.7% 🔺)2.005s (+99.6% 🔺)0.012s (+0.8%)2.019s (+98.3% 🔺)0.885s101.00x
💻 LocalNext.js (Turbopack)1.186s2.003s0.011s2.017s0.831s101.05x
🐘 PostgresNext.js (Turbopack)1.198s2.002s0.002s2.012s0.814s101.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.433s (-36.5% 🟢)3.428s (-35.0% 🟢)2.381s (+220.8% 🔺)6.286s (-3.0%)3.853s101.00x
▲ VercelExpress2.493s (~)3.666s (-10.4% 🟢)2.778s (+189.1% 🔺)6.958s (+24.5% 🔺)4.465s101.02x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.490s (+136.5% 🔺)2.006s (+99.3% 🔺)0.004s (+0.9%)2.028s (+98.2% 🔺)0.537s301.00x
🐘 PostgresNitro1.515s (+142.7% 🔺)2.004s (+99.0% 🔺)0.004s (-6.5% 🟢)2.026s (+98.1% 🔺)0.511s301.02x
💻 LocalNitro1.527s (+82.1% 🔺)2.010s (+98.7% 🔺)0.010s (+7.8% 🔺)2.023s (+81.2% 🔺)0.496s301.02x
🐘 PostgresNext.js (Turbopack)1.693s2.010s0.004s2.027s0.334s301.14x
💻 LocalNext.js (Turbopack)1.846s2.009s0.011s2.201s0.355s281.24x
💻 LocalExpress1.926s (+154.4% 🔺)2.012s (+95.5% 🔺)0.010s (+4.5%)2.424s (+133.1% 🔺)0.498s251.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.501s (-77.9% 🟢)7.965s (-74.1% 🟢)0.254s (+126.5% 🔺)8.704s (-72.6% 🟢)2.203s71.00x
▲ VercelExpress6.740s (+3.6%)8.086s (+1.0%)0.308s (-24.6% 🟢)8.933s (+1.1%)2.193s71.04x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.657s (-32.2% 🟢)1.032s (-17.3% 🟢)0.000s (-17.2% 🟢)1.050s (-16.5% 🟢)0.392s581.00x
🐘 PostgresExpress0.660s (-31.3% 🟢)1.030s (-19.4% 🟢)0.000s (+19.0% 🔺)1.049s (-19.7% 🟢)0.389s581.00x
🐘 PostgresNext.js (Turbopack)0.794s1.072s0.000s1.079s0.285s561.21x
💻 LocalNitro1.361s (+11.3% 🔺)2.015s (~)0.000s (+133.3% 🔺)2.017s (~)0.656s302.07x
💻 LocalExpress1.361s (+11.2% 🔺)2.016s (~)0.001s (+60.0% 🔺)2.018s (~)0.657s302.07x
💻 LocalNext.js (Turbopack)1.480s2.014s0.000s2.017s0.537s302.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.891s (+27.5% 🔺)5.190s (+18.2% 🔺)0.000s (+254.5% 🔺)5.758s (+19.7% 🔺)1.868s111.00x
▲ VercelExpress4.219s (+12.8% 🔺)5.581s (+9.4% 🔺)0.002s (+1000.0% 🔺)6.074s (+9.8% 🔺)1.855s111.08x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.232s (-30.5% 🟢)1.998s (-8.3% 🟢)0.000s (+Infinity% 🔺)2.015s (-8.4% 🟢)0.783s301.00x
🐘 PostgresNitro1.273s (-28.9% 🟢)2.029s (-5.3% 🟢)0.000s (-6.7% 🟢)2.045s (-6.0% 🟢)0.771s301.03x
🐘 PostgresNext.js (Turbopack)1.610s2.110s0.000s2.145s0.534s281.31x
💻 LocalNext.js (Turbopack)2.878s3.416s0.000s3.424s0.545s182.34x
💻 LocalNitro3.083s (-9.0% 🟢)3.905s (-3.2%)0.000s (-64.8% 🟢)3.907s (-3.2%)0.824s162.50x
💻 LocalExpress3.168s (-8.6% 🟢)3.966s (-1.7%)0.001s (-6.3% 🟢)3.968s (-1.7%)0.800s162.57x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express6.633s (+44.6% 🔺)8.145s (+35.3% 🔺)0.001s (+Infinity% 🔺)8.706s (+34.8% 🔺)2.073s71.00x
▲ VercelNitro7.121s (+73.9% 🔺)8.227s (+53.1% 🔺)0.000s (-47.6% 🟢)8.712s (+50.4% 🔺)1.591s71.07x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Express | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro12/21
🐘 PostgresExpress16/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres15/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: success
  • Vercel: failure

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a flaky race during @workflow/world-postgres startup where concurrent processes can both attempt graphile-worker schema installation on a fresh database, triggering duplicate key value violates unique constraint "pg_namespace_nspname_index".

Changes:

  • Serialize graphile-worker bootstrap (makeWorkerUtils + migrate) using a Postgres advisory lock in packages/world-postgres/src/queue.ts.
  • Update unit test pool mocks to include pool.connect() to match the new startup path.
  • Add a changeset documenting the patch release.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

FileDescription
packages/world-postgres/src/queue.tsAdds transaction-scoped advisory lock wrapper around graphile-worker bootstrap to avoid concurrent schema install races.
packages/world-postgres/src/queue.test.tsUpdates pool mock to include connect() for the new locking code path.
packages/world-postgres/src/reenqueue.test.tsUpdates pool mock to include connect() for the new locking code path.
.changeset/fix-world-postgres-graphile-bootstrap-race.mdDeclares a patch release and describes the race/lock fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/world-postgres/src/queue.ts Outdated
Comment threadpackages/world-postgres/src/queue.ts Outdated
- Release the locked connection before makeWorkerUtils() so the
bootstrap can't deadlock against the same pool when maxPoolSize is
small (Copilot review #1). Achieved by replicating graphile-worker's
installSchema DDL ourselves under the lock; once the schema exists
graphile-worker's own installSchema is a no-op.
- Add a unit test that asserts the lock-ordering: pool.connect -> BEGIN
-> pg_advisory_xact_lock -> CREATE SCHEMA -> COMMIT -> release ->
makeWorkerUtils (Copilot review #2).

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not convinced we should duplicate migration code in the queue file and use a lock for this

"@workflow/world-postgres": patch
---

Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()` callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS` and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()`callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS`and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.
Ensure concurrent `world.start()`calls don't race on `CREATE SCHEMA IF NOT EXISTS`by using a lock. Fixes `duplicate key value violates unique constraint "pg_namespace_nspname_index"` errors.

@TooTallNate

Copy link
Copy Markdown
MemberAuthor

Closing in favor of #2019 — Peter's approach pre-bootstraps the graphile_worker schema in workflow-postgres-setup (the CLI that CI already runs once before any consumer process), which eliminates the race window entirely without touching the production hot path. Cleaner fix; 23 lines vs 135 here.

See #2019 (review) for the full comparison.

@TooTallNate
TooTallNate deleted the fix-world-postgres-graphile-bootstrap-race branch May 19, 2026 16:47
Sign up for freeto 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.

3 participants

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock - #1966

Closed
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race
Closed

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock#1966
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Fixes the E2E Local Postgres Tests flake on main (example failing job) where the first test (addTenWorkflow) fails with:

error: duplicate key value violates unique constraint "pg_namespace_nspname_index"
❯ installSchema node_modules/.../graphile-worker/dist/migrate.js:23:5
❯ migrate node_modules/.../graphile-worker/dist/migrate.js:92:17
❯ makeWorkerUtils node_modules/.../graphile-worker/dist/workerUtils.js:12:40
❯ packages/world-postgres/dist/queue.js:212:35
❯ start packages/world-postgres/dist/queue.js:226:9

Root cause

PR #1959 removed instrumentation.ts from the workbenches, which previously pre-warmed world.start() in the Next.js dev server before any HTTP traffic arrived. Without that pre-warm, world.start() is now called lazily on the first workflow request — and in the local-postgres CI matrix, the vitest test process itself also initializes a postgres world (because WORKFLOW_TARGET_WORLD=@workflow/world-postgres is set in the test env). So two independent Node processes (the test runner and the Next.js dev server) race to install the graphile_worker schema on a fresh database.

PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe across concurrent sessions — the existence check happens at one MVCC snapshot but the pg_namespace insert happens at commit, so two sessions can both pass the check and one then fails with duplicate key value violates unique constraint "pg_namespace_nspname_index". graphile-worker's installSchema does no locking around this.

Fix

Wrap the makeWorkerUtils({pgPool}).migrate() call in packages/world-postgres/src/queue.ts with a Postgres advisory lock (pg_advisory_xact_lock) so that concurrent callers across processes are serialized on graphile-worker schema bootstrap. The lock is transaction-scoped, so it is automatically released if the bootstrapping process dies mid-flight.

Verification

  • pnpm --filter @workflow/world-postgres typecheck
  • pnpm --filter @workflow/world-postgres build
  • pnpm --filter @workflow/world-postgres test ✓ (109/109, including the real-Postgres integration tests in test/spec.test.ts that exercise the full world.start() path)

…y lock
Prevents "duplicate key value violates unique constraint
pg_namespace_nspname_index" errors when multiple processes (e.g. dev
server + test runner) call world.start() concurrently against a fresh
database. PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe
across concurrent sessions, and graphile-worker's installSchema does
not lock its bootstrap path.
CopilotAI review requested due to automatic review settings May 11, 2026 06:06
@vercel

vercelBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

changeset-botBot commented May 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8f2980

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
NameType
@workflow/world-postgresPatch
tarballsPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production120002191419
✅ 💻 Local Development158702191806
✅ 📦 Local Production158702191806
✅ 🐘 Local Postgres158702191806
✅ 🪟 Windows12900129
✅ 📋 Other7270176903
Total6817010527869

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro103026
✅ example103026
✅ express103026
✅ fastify103026
✅ hono103026
✅ nextjs-turbopack12702
✅ nextjs-webpack12702
✅ nitro103026
✅ nuxt103026
✅ sveltekit12207
✅ vite103026
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack12900
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable104025
✅ e2e-local-dev-tanstack-start-104025
✅ e2e-local-postgres-nest-stable104025
✅ e2e-local-postgres-tanstack-start-104025
✅ e2e-local-prod-nest-stable104025
✅ e2e-local-prod-tanstack-start-104025
✅ e2e-vercel-prod-tanstack-start103026

📋 View full workflow run

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.032s (-28.9% 🟢)1.006s (~)0.974s101.00x
💻 LocalNitro0.033s (-22.7% 🟢)1.006s (~)0.972s101.06x
💻 LocalNext.js (Turbopack)0.046s1.005s0.960s101.46x
🐘 PostgresExpress0.049s (-16.0% 🟢)1.012s (~)0.963s101.55x
🐘 PostgresNitro0.053s (-44.5% 🟢)1.013s (-2.9%)0.960s101.68x
🐘 PostgresNext.js (Turbopack)0.057s1.011s0.954s101.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.292s (-28.8% 🟢)2.290s (-8.7% 🟢)1.998s101.00x
▲ VercelExpress0.338s (+43.5% 🔺)2.489s (+16.5% 🔺)2.151s101.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.067s (-5.7% 🟢)2.006s (~)0.939s101.00x
💻 LocalExpress1.069s (-5.0% 🟢)2.007s (~)0.938s101.00x
🐘 PostgresExpress1.083s (-5.6% 🟢)2.008s (~)0.926s101.01x
🐘 PostgresNitro1.089s (-4.5%)2.010s (~)0.921s101.02x
💻 LocalNext.js (Turbopack)1.123s2.006s0.882s101.05x
🐘 PostgresNext.js (Turbopack)1.123s2.009s0.886s101.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.634s (-58.0% 🟢)3.924s (-33.6% 🟢)2.290s101.00x
▲ VercelExpress1.652s (-11.9% 🟢)3.842s (+0.9%)2.190s101.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.404s (-5.0%)11.022s (~)0.618s31.00x
🐘 PostgresNitro10.414s (-4.2%)11.018s (~)0.604s31.00x
💻 LocalExpress10.423s (-4.6%)11.022s (~)0.600s31.00x
🐘 PostgresExpress10.426s (-4.9%)11.019s (~)0.593s31.00x
💻 LocalNext.js (Turbopack)10.661s11.021s0.360s31.02x
🐘 PostgresNext.js (Turbopack)10.720s11.017s0.296s31.03x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.871s (-18.3% 🟢)16.522s (-17.5% 🟢)2.651s21.00x
▲ VercelNitro14.235s (-40.0% 🟢)16.109s (-35.9% 🟢)1.874s21.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express13.443s (-7.8% 🟢)14.017s (-6.7% 🟢)0.574s51.00x
💻 LocalNitro13.449s (-10.7% 🟢)14.026s (-12.5% 🟢)0.577s51.00x
💻 LocalExpress13.466s (-10.0% 🟢)14.028s (-6.7% 🟢)0.562s51.00x
🐘 PostgresNitro13.488s (-7.6% 🟢)14.016s (-6.7% 🟢)0.529s51.00x
💻 LocalNext.js (Turbopack)14.079s15.030s0.951s41.05x
🐘 PostgresNext.js (Turbopack)14.119s15.017s0.898s41.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.850s (-64.5% 🟢)24.719s (-62.9% 🟢)1.869s31.00x
▲ VercelExpress23.445s (-53.4% 🟢)25.528s (-51.4% 🟢)2.083s31.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro11.921s (-29.0% 🟢)12.147s (-28.7% 🟢)0.226s81.00x
🐘 PostgresExpress11.945s (-14.7% 🟢)12.266s (-15.9% 🟢)0.321s81.00x
🐘 PostgresNitro11.952s (-14.4% 🟢)12.143s (-15.1% 🟢)0.191s81.00x
💻 LocalExpress12.038s (-27.5% 🟢)12.649s (-25.7% 🟢)0.612s81.01x
💻 LocalNext.js (Turbopack)13.059s13.451s0.392s71.10x
🐘 PostgresNext.js (Turbopack)13.118s14.017s0.899s71.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro32.773s (-92.3% 🟢)34.865s (-91.8% 🟢)2.092s31.00x
▲ VercelExpress33.214s (-72.6% 🟢)35.758s (-71.1% 🟢)2.545s31.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.147s (-9.0% 🟢)2.007s (~)0.860s151.00x
🐘 PostgresNitro1.149s (-9.9% 🟢)2.007s (~)0.858s151.00x
💻 LocalExpress1.175s (-21.0% 🟢)2.005s (~)0.830s151.02x
💻 LocalNitro1.197s (-26.6% 🟢)2.006s (-3.3%)0.809s151.04x
🐘 PostgresNext.js (Turbopack)1.213s2.008s0.795s151.06x
💻 LocalNext.js (Turbopack)1.289s2.006s0.717s151.12x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro5.022s (+78.2% 🔺)6.611s (+53.0% 🔺)1.590s51.00x
▲ VercelExpress5.473s (+91.4% 🔺)7.608s (+64.6% 🔺)2.135s41.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.224s (-48.2% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNitro1.224s (-47.9% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNext.js (Turbopack)1.376s2.008s0.631s151.12x
💻 LocalExpress1.743s (-41.0% 🟢)2.005s (-41.9% 🟢)0.262s151.42x
💻 LocalNitro1.755s (-44.2% 🟢)2.006s (-48.4% 🟢)0.251s151.43x
💻 LocalNext.js (Turbopack)1.769s2.149s0.380s141.45x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.028s (+38.9% 🔺)6.726s (+31.6% 🔺)1.698s61.00x
▲ VercelNitro5.572s (+37.5% 🔺)7.208s (+21.7% 🔺)1.636s51.11x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.369s (-60.7% 🟢)2.007s (-50.0% 🟢)0.638s151.00x
🐘 PostgresNitro1.370s (-60.6% 🟢)2.007s (-49.9% 🟢)0.636s151.00x
🐘 PostgresNext.js (Turbopack)1.635s2.007s0.371s151.19x
💻 LocalNext.js (Turbopack)4.663s5.154s0.491s73.41x
💻 LocalNitro5.177s (-38.0% 🟢)5.679s (-37.0% 🟢)0.503s63.78x
💻 LocalExpress5.194s (-37.7% 🟢)5.513s (-38.9% 🟢)0.319s63.79x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.029s (+65.8% 🔺)8.709s (+42.1% 🔺)1.679s41.00x
▲ VercelNitro8.935s (+153.4% 🔺)10.556s (+90.7% 🔺)1.621s31.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.148s (-8.7% 🟢)2.007s (~)0.859s151.00x
🐘 PostgresExpress1.152s (-8.3% 🟢)2.007s (~)0.855s151.00x
🐘 PostgresNext.js (Turbopack)1.214s2.006s0.793s151.06x
💻 LocalNext.js (Turbopack)1.353s2.005s0.653s151.18x
💻 LocalNitro1.433s (-23.2% 🟢)2.006s (-14.3% 🟢)0.573s151.25x
💻 LocalExpress1.441s (-23.9% 🟢)2.006s (-15.1% 🟢)0.564s151.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.577s (+38.6% 🔺)5.207s (+19.7% 🔺)1.630s61.00x
▲ VercelNitro4.549s (+85.0% 🔺)6.211s (+49.0% 🔺)1.662s61.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.215s (-48.1% 🟢)2.009s (-33.3% 🟢)0.794s151.00x
🐘 PostgresNitro1.247s (-46.7% 🟢)2.009s (-33.3% 🟢)0.761s151.03x
🐘 PostgresNext.js (Turbopack)1.363s2.008s0.645s151.12x
💻 LocalNitro1.967s (-35.8% 🟢)2.469s (-36.5% 🟢)0.503s131.62x
💻 LocalExpress1.979s (-36.8% 🟢)2.392s (-36.4% 🟢)0.413s131.63x
💻 LocalNext.js (Turbopack)1.998s2.675s0.678s121.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro4.851s (+50.0% 🔺)6.263s (+23.4% 🔺)1.413s51.00x
▲ VercelExpress5.603s (+75.5% 🔺)7.182s (+49.9% 🔺)1.579s51.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.366s (-61.0% 🟢)2.008s (-49.9% 🟢)0.641s151.00x
🐘 PostgresNitro1.403s (-59.7% 🟢)2.007s (-49.9% 🟢)0.604s151.03x
🐘 PostgresNext.js (Turbopack)1.638s2.007s0.369s151.20x
💻 LocalNext.js (Turbopack)4.981s5.680s0.699s63.65x
💻 LocalNitro5.479s (-40.1% 🟢)6.214s (-38.0% 🟢)0.734s54.01x
💻 LocalExpress5.612s (-36.2% 🟢)6.214s (-33.0% 🟢)0.602s54.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.939s (+23.7% 🔺)10.418s (+27.4% 🔺)2.479s41.00x
▲ VercelNitro8.342s (+63.8% 🔺)9.730s (+42.7% 🔺)1.389s41.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.450s (-46.4% 🟢)1.006s (-1.6%)0.557s601.00x
🐘 PostgresNitro0.452s (-45.0% 🟢)1.006s (~)0.554s601.00x
💻 LocalNitro0.462s (-52.9% 🟢)1.004s (-8.2% 🟢)0.542s601.03x
💻 LocalExpress0.467s (-52.5% 🟢)1.004s (-6.7% 🟢)0.537s601.04x
🐘 PostgresNext.js (Turbopack)0.676s1.007s0.331s601.50x
💻 LocalNext.js (Turbopack)0.727s1.004s0.278s601.62x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.163s (-72.8% 🟢)7.100s (-66.7% 🟢)1.938s91.00x
▲ VercelNitro6.750s (-69.4% 🟢)8.352s (-65.2% 🟢)1.602s81.31x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.045s (-47.1% 🟢)1.523s (-32.6% 🟢)0.478s601.00x
🐘 PostgresNitro1.082s (-43.8% 🟢)1.705s (-18.8% 🟢)0.622s531.04x
💻 LocalNitro1.183s (-61.0% 🟢)2.006s (-46.6% 🟢)0.823s451.13x
💻 LocalExpress1.191s (-60.5% 🟢)2.005s (-44.1% 🟢)0.814s451.14x
🐘 PostgresNext.js (Turbopack)1.602s2.007s0.405s451.53x
💻 LocalNext.js (Turbopack)1.814s2.006s0.192s451.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.163s (-61.9% 🟢)15.281s (-58.5% 🟢)2.117s61.00x
▲ VercelNitro13.845s (-64.9% 🟢)15.606s (-62.2% 🟢)1.761s61.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.041s (-50.3% 🟢)2.477s (-46.2% 🟢)0.436s491.00x
🐘 PostgresExpress2.090s (-47.6% 🟢)2.638s (-39.6% 🟢)0.548s461.02x
💻 LocalNitro2.660s (-71.4% 🟢)3.008s (-70.0% 🟢)0.348s401.30x
💻 LocalExpress2.681s (-70.9% 🟢)3.032s (-69.7% 🟢)0.352s401.31x
🐘 PostgresNext.js (Turbopack)3.154s4.009s0.855s301.55x
💻 LocalNext.js (Turbopack)3.855s4.075s0.220s301.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express40.673s (-68.7% 🟢)42.850s (-67.6% 🟢)2.177s31.00x
▲ VercelNitro41.417s (-57.3% 🟢)43.192s (-56.1% 🟢)1.776s31.02x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.177s (-37.2% 🟢)1.007s (~)0.829s601.00x
🐘 PostgresNitro0.189s (-33.3% 🟢)1.006s (~)0.817s601.07x
🐘 PostgresNext.js (Turbopack)0.237s1.006s0.770s601.33x
💻 LocalExpress0.428s (-23.6% 🟢)1.004s (~)0.576s602.41x
💻 LocalNitro0.456s (-24.6% 🟢)1.004s (-1.7%)0.548s602.57x
💻 LocalNext.js (Turbopack)0.568s1.004s0.436s603.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.570s (+54.7% 🔺)4.071s (+21.5% 🔺)1.501s151.00x
▲ VercelExpress2.703s (+38.3% 🔺)4.438s (+22.0% 🔺)1.735s141.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.303s (-40.5% 🟢)1.007s (~)0.703s901.00x
🐘 PostgresNitro0.316s (-36.3% 🟢)1.006s (~)0.690s901.04x
🐘 PostgresNext.js (Turbopack)0.459s1.006s0.547s901.51x
💻 LocalExpress2.171s (-13.6% 🟢)2.796s (-7.1% 🟢)0.625s337.16x
💻 LocalNext.js (Turbopack)2.175s3.010s0.835s307.17x
💻 LocalNitro2.239s (-11.8% 🟢)2.944s (-2.2%)0.705s317.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro8.771s (+171.9% 🔺)10.519s (+118.2% 🔺)1.747s91.00x
▲ VercelExpress9.600s (+215.1% 🔺)12.351s (+156.9% 🔺)2.751s81.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.622s (-24.0% 🟢)1.006s (-1.1%)0.383s1201.00x
🐘 PostgresNitro0.640s (-19.0% 🟢)1.006s (~)0.365s1201.03x
🐘 PostgresNext.js (Turbopack)0.967s1.466s0.499s831.55x
💻 LocalNitro10.059s (-10.1% 🟢)10.531s (-9.7% 🟢)0.472s1216.16x
💻 LocalExpress10.208s (-8.8% 🟢)10.696s (-10.4% 🟢)0.488s1216.40x
💻 LocalNext.js (Turbopack)11.327s11.939s0.612s1118.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.654s (+205.3% 🔺)24.859s (+168.9% 🔺)2.205s61.00x
▲ VercelNitro24.155s (+212.8% 🔺)26.342s (+180.2% 🔺)2.187s51.07x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.131s (+429.4% 🔺)2.005s (+99.6% 🔺)0.012s (-2.4%)2.019s (+98.2% 🔺)0.888s101.00x
🐘 PostgresNitro1.133s (+452.4% 🔺)2.001s (+100.1% 🔺)0.001s (-13.3% 🟢)2.010s (+98.7% 🔺)0.877s101.00x
🐘 PostgresExpress1.133s (+452.7% 🔺)1.998s (+100.1% 🔺)0.001s (-31.3% 🟢)2.009s (+98.7% 🔺)0.876s101.00x
💻 LocalExpress1.134s (+469.7% 🔺)2.005s (+99.6% 🔺)0.012s (+0.8%)2.019s (+98.3% 🔺)0.885s101.00x
💻 LocalNext.js (Turbopack)1.186s2.003s0.011s2.017s0.831s101.05x
🐘 PostgresNext.js (Turbopack)1.198s2.002s0.002s2.012s0.814s101.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.433s (-36.5% 🟢)3.428s (-35.0% 🟢)2.381s (+220.8% 🔺)6.286s (-3.0%)3.853s101.00x
▲ VercelExpress2.493s (~)3.666s (-10.4% 🟢)2.778s (+189.1% 🔺)6.958s (+24.5% 🔺)4.465s101.02x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.490s (+136.5% 🔺)2.006s (+99.3% 🔺)0.004s (+0.9%)2.028s (+98.2% 🔺)0.537s301.00x
🐘 PostgresNitro1.515s (+142.7% 🔺)2.004s (+99.0% 🔺)0.004s (-6.5% 🟢)2.026s (+98.1% 🔺)0.511s301.02x
💻 LocalNitro1.527s (+82.1% 🔺)2.010s (+98.7% 🔺)0.010s (+7.8% 🔺)2.023s (+81.2% 🔺)0.496s301.02x
🐘 PostgresNext.js (Turbopack)1.693s2.010s0.004s2.027s0.334s301.14x
💻 LocalNext.js (Turbopack)1.846s2.009s0.011s2.201s0.355s281.24x
💻 LocalExpress1.926s (+154.4% 🔺)2.012s (+95.5% 🔺)0.010s (+4.5%)2.424s (+133.1% 🔺)0.498s251.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.501s (-77.9% 🟢)7.965s (-74.1% 🟢)0.254s (+126.5% 🔺)8.704s (-72.6% 🟢)2.203s71.00x
▲ VercelExpress6.740s (+3.6%)8.086s (+1.0%)0.308s (-24.6% 🟢)8.933s (+1.1%)2.193s71.04x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.657s (-32.2% 🟢)1.032s (-17.3% 🟢)0.000s (-17.2% 🟢)1.050s (-16.5% 🟢)0.392s581.00x
🐘 PostgresExpress0.660s (-31.3% 🟢)1.030s (-19.4% 🟢)0.000s (+19.0% 🔺)1.049s (-19.7% 🟢)0.389s581.00x
🐘 PostgresNext.js (Turbopack)0.794s1.072s0.000s1.079s0.285s561.21x
💻 LocalNitro1.361s (+11.3% 🔺)2.015s (~)0.000s (+133.3% 🔺)2.017s (~)0.656s302.07x
💻 LocalExpress1.361s (+11.2% 🔺)2.016s (~)0.001s (+60.0% 🔺)2.018s (~)0.657s302.07x
💻 LocalNext.js (Turbopack)1.480s2.014s0.000s2.017s0.537s302.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.891s (+27.5% 🔺)5.190s (+18.2% 🔺)0.000s (+254.5% 🔺)5.758s (+19.7% 🔺)1.868s111.00x
▲ VercelExpress4.219s (+12.8% 🔺)5.581s (+9.4% 🔺)0.002s (+1000.0% 🔺)6.074s (+9.8% 🔺)1.855s111.08x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.232s (-30.5% 🟢)1.998s (-8.3% 🟢)0.000s (+Infinity% 🔺)2.015s (-8.4% 🟢)0.783s301.00x
🐘 PostgresNitro1.273s (-28.9% 🟢)2.029s (-5.3% 🟢)0.000s (-6.7% 🟢)2.045s (-6.0% 🟢)0.771s301.03x
🐘 PostgresNext.js (Turbopack)1.610s2.110s0.000s2.145s0.534s281.31x
💻 LocalNext.js (Turbopack)2.878s3.416s0.000s3.424s0.545s182.34x
💻 LocalNitro3.083s (-9.0% 🟢)3.905s (-3.2%)0.000s (-64.8% 🟢)3.907s (-3.2%)0.824s162.50x
💻 LocalExpress3.168s (-8.6% 🟢)3.966s (-1.7%)0.001s (-6.3% 🟢)3.968s (-1.7%)0.800s162.57x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express6.633s (+44.6% 🔺)8.145s (+35.3% 🔺)0.001s (+Infinity% 🔺)8.706s (+34.8% 🔺)2.073s71.00x
▲ VercelNitro7.121s (+73.9% 🔺)8.227s (+53.1% 🔺)0.000s (-47.6% 🟢)8.712s (+50.4% 🔺)1.591s71.07x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Express | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro12/21
🐘 PostgresExpress16/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres15/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: success
  • Vercel: failure

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a flaky race during @workflow/world-postgres startup where concurrent processes can both attempt graphile-worker schema installation on a fresh database, triggering duplicate key value violates unique constraint "pg_namespace_nspname_index".

Changes:

  • Serialize graphile-worker bootstrap (makeWorkerUtils + migrate) using a Postgres advisory lock in packages/world-postgres/src/queue.ts.
  • Update unit test pool mocks to include pool.connect() to match the new startup path.
  • Add a changeset documenting the patch release.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

FileDescription
packages/world-postgres/src/queue.tsAdds transaction-scoped advisory lock wrapper around graphile-worker bootstrap to avoid concurrent schema install races.
packages/world-postgres/src/queue.test.tsUpdates pool mock to include connect() for the new locking code path.
packages/world-postgres/src/reenqueue.test.tsUpdates pool mock to include connect() for the new locking code path.
.changeset/fix-world-postgres-graphile-bootstrap-race.mdDeclares a patch release and describes the race/lock fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/world-postgres/src/queue.ts Outdated
Comment threadpackages/world-postgres/src/queue.ts Outdated
- Release the locked connection before makeWorkerUtils() so the
bootstrap can't deadlock against the same pool when maxPoolSize is
small (Copilot review #1). Achieved by replicating graphile-worker's
installSchema DDL ourselves under the lock; once the schema exists
graphile-worker's own installSchema is a no-op.
- Add a unit test that asserts the lock-ordering: pool.connect -> BEGIN
-> pg_advisory_xact_lock -> CREATE SCHEMA -> COMMIT -> release ->
makeWorkerUtils (Copilot review #2).

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not convinced we should duplicate migration code in the queue file and use a lock for this

"@workflow/world-postgres": patch
---

Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()` callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS` and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()`callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS`and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.
Ensure concurrent `world.start()`calls don't race on `CREATE SCHEMA IF NOT EXISTS`by using a lock. Fixes `duplicate key value violates unique constraint "pg_namespace_nspname_index"` errors.

@TooTallNate

Copy link
Copy Markdown
MemberAuthor

Closing in favor of #2019 — Peter's approach pre-bootstraps the graphile_worker schema in workflow-postgres-setup (the CLI that CI already runs once before any consumer process), which eliminates the race window entirely without touching the production hot path. Cleaner fix; 23 lines vs 135 here.

See #2019 (review) for the full comparison.

@TooTallNate
TooTallNate deleted the fix-world-postgres-graphile-bootstrap-race branch May 19, 2026 16:47
Sign up for freeto 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.

3 participants

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock - #1966

Closed
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race
Closed

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock#1966
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Fixes the E2E Local Postgres Tests flake on main (example failing job) where the first test (addTenWorkflow) fails with:

error: duplicate key value violates unique constraint "pg_namespace_nspname_index"
❯ installSchema node_modules/.../graphile-worker/dist/migrate.js:23:5
❯ migrate node_modules/.../graphile-worker/dist/migrate.js:92:17
❯ makeWorkerUtils node_modules/.../graphile-worker/dist/workerUtils.js:12:40
❯ packages/world-postgres/dist/queue.js:212:35
❯ start packages/world-postgres/dist/queue.js:226:9

Root cause

PR #1959 removed instrumentation.ts from the workbenches, which previously pre-warmed world.start() in the Next.js dev server before any HTTP traffic arrived. Without that pre-warm, world.start() is now called lazily on the first workflow request — and in the local-postgres CI matrix, the vitest test process itself also initializes a postgres world (because WORKFLOW_TARGET_WORLD=@workflow/world-postgres is set in the test env). So two independent Node processes (the test runner and the Next.js dev server) race to install the graphile_worker schema on a fresh database.

PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe across concurrent sessions — the existence check happens at one MVCC snapshot but the pg_namespace insert happens at commit, so two sessions can both pass the check and one then fails with duplicate key value violates unique constraint "pg_namespace_nspname_index". graphile-worker's installSchema does no locking around this.

Fix

Wrap the makeWorkerUtils({pgPool}).migrate() call in packages/world-postgres/src/queue.ts with a Postgres advisory lock (pg_advisory_xact_lock) so that concurrent callers across processes are serialized on graphile-worker schema bootstrap. The lock is transaction-scoped, so it is automatically released if the bootstrapping process dies mid-flight.

Verification

  • pnpm --filter @workflow/world-postgres typecheck
  • pnpm --filter @workflow/world-postgres build
  • pnpm --filter @workflow/world-postgres test ✓ (109/109, including the real-Postgres integration tests in test/spec.test.ts that exercise the full world.start() path)

…y lock
Prevents "duplicate key value violates unique constraint
pg_namespace_nspname_index" errors when multiple processes (e.g. dev
server + test runner) call world.start() concurrently against a fresh
database. PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe
across concurrent sessions, and graphile-worker's installSchema does
not lock its bootstrap path.
CopilotAI review requested due to automatic review settings May 11, 2026 06:06
@vercel

vercelBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

changeset-botBot commented May 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8f2980

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
NameType
@workflow/world-postgresPatch
tarballsPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production120002191419
✅ 💻 Local Development158702191806
✅ 📦 Local Production158702191806
✅ 🐘 Local Postgres158702191806
✅ 🪟 Windows12900129
✅ 📋 Other7270176903
Total6817010527869

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro103026
✅ example103026
✅ express103026
✅ fastify103026
✅ hono103026
✅ nextjs-turbopack12702
✅ nextjs-webpack12702
✅ nitro103026
✅ nuxt103026
✅ sveltekit12207
✅ vite103026
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack12900
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable104025
✅ e2e-local-dev-tanstack-start-104025
✅ e2e-local-postgres-nest-stable104025
✅ e2e-local-postgres-tanstack-start-104025
✅ e2e-local-prod-nest-stable104025
✅ e2e-local-prod-tanstack-start-104025
✅ e2e-vercel-prod-tanstack-start103026

📋 View full workflow run

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.032s (-28.9% 🟢)1.006s (~)0.974s101.00x
💻 LocalNitro0.033s (-22.7% 🟢)1.006s (~)0.972s101.06x
💻 LocalNext.js (Turbopack)0.046s1.005s0.960s101.46x
🐘 PostgresExpress0.049s (-16.0% 🟢)1.012s (~)0.963s101.55x
🐘 PostgresNitro0.053s (-44.5% 🟢)1.013s (-2.9%)0.960s101.68x
🐘 PostgresNext.js (Turbopack)0.057s1.011s0.954s101.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.292s (-28.8% 🟢)2.290s (-8.7% 🟢)1.998s101.00x
▲ VercelExpress0.338s (+43.5% 🔺)2.489s (+16.5% 🔺)2.151s101.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.067s (-5.7% 🟢)2.006s (~)0.939s101.00x
💻 LocalExpress1.069s (-5.0% 🟢)2.007s (~)0.938s101.00x
🐘 PostgresExpress1.083s (-5.6% 🟢)2.008s (~)0.926s101.01x
🐘 PostgresNitro1.089s (-4.5%)2.010s (~)0.921s101.02x
💻 LocalNext.js (Turbopack)1.123s2.006s0.882s101.05x
🐘 PostgresNext.js (Turbopack)1.123s2.009s0.886s101.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.634s (-58.0% 🟢)3.924s (-33.6% 🟢)2.290s101.00x
▲ VercelExpress1.652s (-11.9% 🟢)3.842s (+0.9%)2.190s101.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.404s (-5.0%)11.022s (~)0.618s31.00x
🐘 PostgresNitro10.414s (-4.2%)11.018s (~)0.604s31.00x
💻 LocalExpress10.423s (-4.6%)11.022s (~)0.600s31.00x
🐘 PostgresExpress10.426s (-4.9%)11.019s (~)0.593s31.00x
💻 LocalNext.js (Turbopack)10.661s11.021s0.360s31.02x
🐘 PostgresNext.js (Turbopack)10.720s11.017s0.296s31.03x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.871s (-18.3% 🟢)16.522s (-17.5% 🟢)2.651s21.00x
▲ VercelNitro14.235s (-40.0% 🟢)16.109s (-35.9% 🟢)1.874s21.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express13.443s (-7.8% 🟢)14.017s (-6.7% 🟢)0.574s51.00x
💻 LocalNitro13.449s (-10.7% 🟢)14.026s (-12.5% 🟢)0.577s51.00x
💻 LocalExpress13.466s (-10.0% 🟢)14.028s (-6.7% 🟢)0.562s51.00x
🐘 PostgresNitro13.488s (-7.6% 🟢)14.016s (-6.7% 🟢)0.529s51.00x
💻 LocalNext.js (Turbopack)14.079s15.030s0.951s41.05x
🐘 PostgresNext.js (Turbopack)14.119s15.017s0.898s41.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.850s (-64.5% 🟢)24.719s (-62.9% 🟢)1.869s31.00x
▲ VercelExpress23.445s (-53.4% 🟢)25.528s (-51.4% 🟢)2.083s31.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro11.921s (-29.0% 🟢)12.147s (-28.7% 🟢)0.226s81.00x
🐘 PostgresExpress11.945s (-14.7% 🟢)12.266s (-15.9% 🟢)0.321s81.00x
🐘 PostgresNitro11.952s (-14.4% 🟢)12.143s (-15.1% 🟢)0.191s81.00x
💻 LocalExpress12.038s (-27.5% 🟢)12.649s (-25.7% 🟢)0.612s81.01x
💻 LocalNext.js (Turbopack)13.059s13.451s0.392s71.10x
🐘 PostgresNext.js (Turbopack)13.118s14.017s0.899s71.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro32.773s (-92.3% 🟢)34.865s (-91.8% 🟢)2.092s31.00x
▲ VercelExpress33.214s (-72.6% 🟢)35.758s (-71.1% 🟢)2.545s31.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.147s (-9.0% 🟢)2.007s (~)0.860s151.00x
🐘 PostgresNitro1.149s (-9.9% 🟢)2.007s (~)0.858s151.00x
💻 LocalExpress1.175s (-21.0% 🟢)2.005s (~)0.830s151.02x
💻 LocalNitro1.197s (-26.6% 🟢)2.006s (-3.3%)0.809s151.04x
🐘 PostgresNext.js (Turbopack)1.213s2.008s0.795s151.06x
💻 LocalNext.js (Turbopack)1.289s2.006s0.717s151.12x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro5.022s (+78.2% 🔺)6.611s (+53.0% 🔺)1.590s51.00x
▲ VercelExpress5.473s (+91.4% 🔺)7.608s (+64.6% 🔺)2.135s41.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.224s (-48.2% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNitro1.224s (-47.9% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNext.js (Turbopack)1.376s2.008s0.631s151.12x
💻 LocalExpress1.743s (-41.0% 🟢)2.005s (-41.9% 🟢)0.262s151.42x
💻 LocalNitro1.755s (-44.2% 🟢)2.006s (-48.4% 🟢)0.251s151.43x
💻 LocalNext.js (Turbopack)1.769s2.149s0.380s141.45x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.028s (+38.9% 🔺)6.726s (+31.6% 🔺)1.698s61.00x
▲ VercelNitro5.572s (+37.5% 🔺)7.208s (+21.7% 🔺)1.636s51.11x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.369s (-60.7% 🟢)2.007s (-50.0% 🟢)0.638s151.00x
🐘 PostgresNitro1.370s (-60.6% 🟢)2.007s (-49.9% 🟢)0.636s151.00x
🐘 PostgresNext.js (Turbopack)1.635s2.007s0.371s151.19x
💻 LocalNext.js (Turbopack)4.663s5.154s0.491s73.41x
💻 LocalNitro5.177s (-38.0% 🟢)5.679s (-37.0% 🟢)0.503s63.78x
💻 LocalExpress5.194s (-37.7% 🟢)5.513s (-38.9% 🟢)0.319s63.79x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.029s (+65.8% 🔺)8.709s (+42.1% 🔺)1.679s41.00x
▲ VercelNitro8.935s (+153.4% 🔺)10.556s (+90.7% 🔺)1.621s31.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.148s (-8.7% 🟢)2.007s (~)0.859s151.00x
🐘 PostgresExpress1.152s (-8.3% 🟢)2.007s (~)0.855s151.00x
🐘 PostgresNext.js (Turbopack)1.214s2.006s0.793s151.06x
💻 LocalNext.js (Turbopack)1.353s2.005s0.653s151.18x
💻 LocalNitro1.433s (-23.2% 🟢)2.006s (-14.3% 🟢)0.573s151.25x
💻 LocalExpress1.441s (-23.9% 🟢)2.006s (-15.1% 🟢)0.564s151.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.577s (+38.6% 🔺)5.207s (+19.7% 🔺)1.630s61.00x
▲ VercelNitro4.549s (+85.0% 🔺)6.211s (+49.0% 🔺)1.662s61.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.215s (-48.1% 🟢)2.009s (-33.3% 🟢)0.794s151.00x
🐘 PostgresNitro1.247s (-46.7% 🟢)2.009s (-33.3% 🟢)0.761s151.03x
🐘 PostgresNext.js (Turbopack)1.363s2.008s0.645s151.12x
💻 LocalNitro1.967s (-35.8% 🟢)2.469s (-36.5% 🟢)0.503s131.62x
💻 LocalExpress1.979s (-36.8% 🟢)2.392s (-36.4% 🟢)0.413s131.63x
💻 LocalNext.js (Turbopack)1.998s2.675s0.678s121.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro4.851s (+50.0% 🔺)6.263s (+23.4% 🔺)1.413s51.00x
▲ VercelExpress5.603s (+75.5% 🔺)7.182s (+49.9% 🔺)1.579s51.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.366s (-61.0% 🟢)2.008s (-49.9% 🟢)0.641s151.00x
🐘 PostgresNitro1.403s (-59.7% 🟢)2.007s (-49.9% 🟢)0.604s151.03x
🐘 PostgresNext.js (Turbopack)1.638s2.007s0.369s151.20x
💻 LocalNext.js (Turbopack)4.981s5.680s0.699s63.65x
💻 LocalNitro5.479s (-40.1% 🟢)6.214s (-38.0% 🟢)0.734s54.01x
💻 LocalExpress5.612s (-36.2% 🟢)6.214s (-33.0% 🟢)0.602s54.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.939s (+23.7% 🔺)10.418s (+27.4% 🔺)2.479s41.00x
▲ VercelNitro8.342s (+63.8% 🔺)9.730s (+42.7% 🔺)1.389s41.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.450s (-46.4% 🟢)1.006s (-1.6%)0.557s601.00x
🐘 PostgresNitro0.452s (-45.0% 🟢)1.006s (~)0.554s601.00x
💻 LocalNitro0.462s (-52.9% 🟢)1.004s (-8.2% 🟢)0.542s601.03x
💻 LocalExpress0.467s (-52.5% 🟢)1.004s (-6.7% 🟢)0.537s601.04x
🐘 PostgresNext.js (Turbopack)0.676s1.007s0.331s601.50x
💻 LocalNext.js (Turbopack)0.727s1.004s0.278s601.62x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.163s (-72.8% 🟢)7.100s (-66.7% 🟢)1.938s91.00x
▲ VercelNitro6.750s (-69.4% 🟢)8.352s (-65.2% 🟢)1.602s81.31x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.045s (-47.1% 🟢)1.523s (-32.6% 🟢)0.478s601.00x
🐘 PostgresNitro1.082s (-43.8% 🟢)1.705s (-18.8% 🟢)0.622s531.04x
💻 LocalNitro1.183s (-61.0% 🟢)2.006s (-46.6% 🟢)0.823s451.13x
💻 LocalExpress1.191s (-60.5% 🟢)2.005s (-44.1% 🟢)0.814s451.14x
🐘 PostgresNext.js (Turbopack)1.602s2.007s0.405s451.53x
💻 LocalNext.js (Turbopack)1.814s2.006s0.192s451.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.163s (-61.9% 🟢)15.281s (-58.5% 🟢)2.117s61.00x
▲ VercelNitro13.845s (-64.9% 🟢)15.606s (-62.2% 🟢)1.761s61.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.041s (-50.3% 🟢)2.477s (-46.2% 🟢)0.436s491.00x
🐘 PostgresExpress2.090s (-47.6% 🟢)2.638s (-39.6% 🟢)0.548s461.02x
💻 LocalNitro2.660s (-71.4% 🟢)3.008s (-70.0% 🟢)0.348s401.30x
💻 LocalExpress2.681s (-70.9% 🟢)3.032s (-69.7% 🟢)0.352s401.31x
🐘 PostgresNext.js (Turbopack)3.154s4.009s0.855s301.55x
💻 LocalNext.js (Turbopack)3.855s4.075s0.220s301.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express40.673s (-68.7% 🟢)42.850s (-67.6% 🟢)2.177s31.00x
▲ VercelNitro41.417s (-57.3% 🟢)43.192s (-56.1% 🟢)1.776s31.02x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.177s (-37.2% 🟢)1.007s (~)0.829s601.00x
🐘 PostgresNitro0.189s (-33.3% 🟢)1.006s (~)0.817s601.07x
🐘 PostgresNext.js (Turbopack)0.237s1.006s0.770s601.33x
💻 LocalExpress0.428s (-23.6% 🟢)1.004s (~)0.576s602.41x
💻 LocalNitro0.456s (-24.6% 🟢)1.004s (-1.7%)0.548s602.57x
💻 LocalNext.js (Turbopack)0.568s1.004s0.436s603.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.570s (+54.7% 🔺)4.071s (+21.5% 🔺)1.501s151.00x
▲ VercelExpress2.703s (+38.3% 🔺)4.438s (+22.0% 🔺)1.735s141.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.303s (-40.5% 🟢)1.007s (~)0.703s901.00x
🐘 PostgresNitro0.316s (-36.3% 🟢)1.006s (~)0.690s901.04x
🐘 PostgresNext.js (Turbopack)0.459s1.006s0.547s901.51x
💻 LocalExpress2.171s (-13.6% 🟢)2.796s (-7.1% 🟢)0.625s337.16x
💻 LocalNext.js (Turbopack)2.175s3.010s0.835s307.17x
💻 LocalNitro2.239s (-11.8% 🟢)2.944s (-2.2%)0.705s317.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro8.771s (+171.9% 🔺)10.519s (+118.2% 🔺)1.747s91.00x
▲ VercelExpress9.600s (+215.1% 🔺)12.351s (+156.9% 🔺)2.751s81.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.622s (-24.0% 🟢)1.006s (-1.1%)0.383s1201.00x
🐘 PostgresNitro0.640s (-19.0% 🟢)1.006s (~)0.365s1201.03x
🐘 PostgresNext.js (Turbopack)0.967s1.466s0.499s831.55x
💻 LocalNitro10.059s (-10.1% 🟢)10.531s (-9.7% 🟢)0.472s1216.16x
💻 LocalExpress10.208s (-8.8% 🟢)10.696s (-10.4% 🟢)0.488s1216.40x
💻 LocalNext.js (Turbopack)11.327s11.939s0.612s1118.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.654s (+205.3% 🔺)24.859s (+168.9% 🔺)2.205s61.00x
▲ VercelNitro24.155s (+212.8% 🔺)26.342s (+180.2% 🔺)2.187s51.07x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.131s (+429.4% 🔺)2.005s (+99.6% 🔺)0.012s (-2.4%)2.019s (+98.2% 🔺)0.888s101.00x
🐘 PostgresNitro1.133s (+452.4% 🔺)2.001s (+100.1% 🔺)0.001s (-13.3% 🟢)2.010s (+98.7% 🔺)0.877s101.00x
🐘 PostgresExpress1.133s (+452.7% 🔺)1.998s (+100.1% 🔺)0.001s (-31.3% 🟢)2.009s (+98.7% 🔺)0.876s101.00x
💻 LocalExpress1.134s (+469.7% 🔺)2.005s (+99.6% 🔺)0.012s (+0.8%)2.019s (+98.3% 🔺)0.885s101.00x
💻 LocalNext.js (Turbopack)1.186s2.003s0.011s2.017s0.831s101.05x
🐘 PostgresNext.js (Turbopack)1.198s2.002s0.002s2.012s0.814s101.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.433s (-36.5% 🟢)3.428s (-35.0% 🟢)2.381s (+220.8% 🔺)6.286s (-3.0%)3.853s101.00x
▲ VercelExpress2.493s (~)3.666s (-10.4% 🟢)2.778s (+189.1% 🔺)6.958s (+24.5% 🔺)4.465s101.02x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.490s (+136.5% 🔺)2.006s (+99.3% 🔺)0.004s (+0.9%)2.028s (+98.2% 🔺)0.537s301.00x
🐘 PostgresNitro1.515s (+142.7% 🔺)2.004s (+99.0% 🔺)0.004s (-6.5% 🟢)2.026s (+98.1% 🔺)0.511s301.02x
💻 LocalNitro1.527s (+82.1% 🔺)2.010s (+98.7% 🔺)0.010s (+7.8% 🔺)2.023s (+81.2% 🔺)0.496s301.02x
🐘 PostgresNext.js (Turbopack)1.693s2.010s0.004s2.027s0.334s301.14x
💻 LocalNext.js (Turbopack)1.846s2.009s0.011s2.201s0.355s281.24x
💻 LocalExpress1.926s (+154.4% 🔺)2.012s (+95.5% 🔺)0.010s (+4.5%)2.424s (+133.1% 🔺)0.498s251.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.501s (-77.9% 🟢)7.965s (-74.1% 🟢)0.254s (+126.5% 🔺)8.704s (-72.6% 🟢)2.203s71.00x
▲ VercelExpress6.740s (+3.6%)8.086s (+1.0%)0.308s (-24.6% 🟢)8.933s (+1.1%)2.193s71.04x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.657s (-32.2% 🟢)1.032s (-17.3% 🟢)0.000s (-17.2% 🟢)1.050s (-16.5% 🟢)0.392s581.00x
🐘 PostgresExpress0.660s (-31.3% 🟢)1.030s (-19.4% 🟢)0.000s (+19.0% 🔺)1.049s (-19.7% 🟢)0.389s581.00x
🐘 PostgresNext.js (Turbopack)0.794s1.072s0.000s1.079s0.285s561.21x
💻 LocalNitro1.361s (+11.3% 🔺)2.015s (~)0.000s (+133.3% 🔺)2.017s (~)0.656s302.07x
💻 LocalExpress1.361s (+11.2% 🔺)2.016s (~)0.001s (+60.0% 🔺)2.018s (~)0.657s302.07x
💻 LocalNext.js (Turbopack)1.480s2.014s0.000s2.017s0.537s302.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.891s (+27.5% 🔺)5.190s (+18.2% 🔺)0.000s (+254.5% 🔺)5.758s (+19.7% 🔺)1.868s111.00x
▲ VercelExpress4.219s (+12.8% 🔺)5.581s (+9.4% 🔺)0.002s (+1000.0% 🔺)6.074s (+9.8% 🔺)1.855s111.08x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.232s (-30.5% 🟢)1.998s (-8.3% 🟢)0.000s (+Infinity% 🔺)2.015s (-8.4% 🟢)0.783s301.00x
🐘 PostgresNitro1.273s (-28.9% 🟢)2.029s (-5.3% 🟢)0.000s (-6.7% 🟢)2.045s (-6.0% 🟢)0.771s301.03x
🐘 PostgresNext.js (Turbopack)1.610s2.110s0.000s2.145s0.534s281.31x
💻 LocalNext.js (Turbopack)2.878s3.416s0.000s3.424s0.545s182.34x
💻 LocalNitro3.083s (-9.0% 🟢)3.905s (-3.2%)0.000s (-64.8% 🟢)3.907s (-3.2%)0.824s162.50x
💻 LocalExpress3.168s (-8.6% 🟢)3.966s (-1.7%)0.001s (-6.3% 🟢)3.968s (-1.7%)0.800s162.57x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express6.633s (+44.6% 🔺)8.145s (+35.3% 🔺)0.001s (+Infinity% 🔺)8.706s (+34.8% 🔺)2.073s71.00x
▲ VercelNitro7.121s (+73.9% 🔺)8.227s (+53.1% 🔺)0.000s (-47.6% 🟢)8.712s (+50.4% 🔺)1.591s71.07x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Express | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro12/21
🐘 PostgresExpress16/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres15/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: success
  • Vercel: failure

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a flaky race during @workflow/world-postgres startup where concurrent processes can both attempt graphile-worker schema installation on a fresh database, triggering duplicate key value violates unique constraint "pg_namespace_nspname_index".

Changes:

  • Serialize graphile-worker bootstrap (makeWorkerUtils + migrate) using a Postgres advisory lock in packages/world-postgres/src/queue.ts.
  • Update unit test pool mocks to include pool.connect() to match the new startup path.
  • Add a changeset documenting the patch release.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

FileDescription
packages/world-postgres/src/queue.tsAdds transaction-scoped advisory lock wrapper around graphile-worker bootstrap to avoid concurrent schema install races.
packages/world-postgres/src/queue.test.tsUpdates pool mock to include connect() for the new locking code path.
packages/world-postgres/src/reenqueue.test.tsUpdates pool mock to include connect() for the new locking code path.
.changeset/fix-world-postgres-graphile-bootstrap-race.mdDeclares a patch release and describes the race/lock fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/world-postgres/src/queue.ts Outdated
Comment threadpackages/world-postgres/src/queue.ts Outdated
- Release the locked connection before makeWorkerUtils() so the
bootstrap can't deadlock against the same pool when maxPoolSize is
small (Copilot review #1). Achieved by replicating graphile-worker's
installSchema DDL ourselves under the lock; once the schema exists
graphile-worker's own installSchema is a no-op.
- Add a unit test that asserts the lock-ordering: pool.connect -> BEGIN
-> pg_advisory_xact_lock -> CREATE SCHEMA -> COMMIT -> release ->
makeWorkerUtils (Copilot review #2).

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not convinced we should duplicate migration code in the queue file and use a lock for this

"@workflow/world-postgres": patch
---

Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()` callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS` and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()`callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS`and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.
Ensure concurrent `world.start()`calls don't race on `CREATE SCHEMA IF NOT EXISTS`by using a lock. Fixes `duplicate key value violates unique constraint "pg_namespace_nspname_index"` errors.

@TooTallNate

Copy link
Copy Markdown
MemberAuthor

Closing in favor of #2019 — Peter's approach pre-bootstraps the graphile_worker schema in workflow-postgres-setup (the CLI that CI already runs once before any consumer process), which eliminates the race window entirely without touching the production hot path. Cleaner fix; 23 lines vs 135 here.

See #2019 (review) for the full comparison.

@TooTallNate
TooTallNate deleted the fix-world-postgres-graphile-bootstrap-race branch May 19, 2026 16:47
Sign up for freeto 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.

3 participants

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock - #1966

Closed
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race
Closed

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock#1966
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Fixes the E2E Local Postgres Tests flake on main (example failing job) where the first test (addTenWorkflow) fails with:

error: duplicate key value violates unique constraint "pg_namespace_nspname_index"
❯ installSchema node_modules/.../graphile-worker/dist/migrate.js:23:5
❯ migrate node_modules/.../graphile-worker/dist/migrate.js:92:17
❯ makeWorkerUtils node_modules/.../graphile-worker/dist/workerUtils.js:12:40
❯ packages/world-postgres/dist/queue.js:212:35
❯ start packages/world-postgres/dist/queue.js:226:9

Root cause

PR #1959 removed instrumentation.ts from the workbenches, which previously pre-warmed world.start() in the Next.js dev server before any HTTP traffic arrived. Without that pre-warm, world.start() is now called lazily on the first workflow request — and in the local-postgres CI matrix, the vitest test process itself also initializes a postgres world (because WORKFLOW_TARGET_WORLD=@workflow/world-postgres is set in the test env). So two independent Node processes (the test runner and the Next.js dev server) race to install the graphile_worker schema on a fresh database.

PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe across concurrent sessions — the existence check happens at one MVCC snapshot but the pg_namespace insert happens at commit, so two sessions can both pass the check and one then fails with duplicate key value violates unique constraint "pg_namespace_nspname_index". graphile-worker's installSchema does no locking around this.

Fix

Wrap the makeWorkerUtils({pgPool}).migrate() call in packages/world-postgres/src/queue.ts with a Postgres advisory lock (pg_advisory_xact_lock) so that concurrent callers across processes are serialized on graphile-worker schema bootstrap. The lock is transaction-scoped, so it is automatically released if the bootstrapping process dies mid-flight.

Verification

  • pnpm --filter @workflow/world-postgres typecheck
  • pnpm --filter @workflow/world-postgres build
  • pnpm --filter @workflow/world-postgres test ✓ (109/109, including the real-Postgres integration tests in test/spec.test.ts that exercise the full world.start() path)

…y lock
Prevents "duplicate key value violates unique constraint
pg_namespace_nspname_index" errors when multiple processes (e.g. dev
server + test runner) call world.start() concurrently against a fresh
database. PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe
across concurrent sessions, and graphile-worker's installSchema does
not lock its bootstrap path.
CopilotAI review requested due to automatic review settings May 11, 2026 06:06
@vercel

vercelBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

changeset-botBot commented May 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8f2980

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
NameType
@workflow/world-postgresPatch
tarballsPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production120002191419
✅ 💻 Local Development158702191806
✅ 📦 Local Production158702191806
✅ 🐘 Local Postgres158702191806
✅ 🪟 Windows12900129
✅ 📋 Other7270176903
Total6817010527869

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro103026
✅ example103026
✅ express103026
✅ fastify103026
✅ hono103026
✅ nextjs-turbopack12702
✅ nextjs-webpack12702
✅ nitro103026
✅ nuxt103026
✅ sveltekit12207
✅ vite103026
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack12900
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable104025
✅ e2e-local-dev-tanstack-start-104025
✅ e2e-local-postgres-nest-stable104025
✅ e2e-local-postgres-tanstack-start-104025
✅ e2e-local-prod-nest-stable104025
✅ e2e-local-prod-tanstack-start-104025
✅ e2e-vercel-prod-tanstack-start103026

📋 View full workflow run

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.032s (-28.9% 🟢)1.006s (~)0.974s101.00x
💻 LocalNitro0.033s (-22.7% 🟢)1.006s (~)0.972s101.06x
💻 LocalNext.js (Turbopack)0.046s1.005s0.960s101.46x
🐘 PostgresExpress0.049s (-16.0% 🟢)1.012s (~)0.963s101.55x
🐘 PostgresNitro0.053s (-44.5% 🟢)1.013s (-2.9%)0.960s101.68x
🐘 PostgresNext.js (Turbopack)0.057s1.011s0.954s101.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.292s (-28.8% 🟢)2.290s (-8.7% 🟢)1.998s101.00x
▲ VercelExpress0.338s (+43.5% 🔺)2.489s (+16.5% 🔺)2.151s101.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.067s (-5.7% 🟢)2.006s (~)0.939s101.00x
💻 LocalExpress1.069s (-5.0% 🟢)2.007s (~)0.938s101.00x
🐘 PostgresExpress1.083s (-5.6% 🟢)2.008s (~)0.926s101.01x
🐘 PostgresNitro1.089s (-4.5%)2.010s (~)0.921s101.02x
💻 LocalNext.js (Turbopack)1.123s2.006s0.882s101.05x
🐘 PostgresNext.js (Turbopack)1.123s2.009s0.886s101.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.634s (-58.0% 🟢)3.924s (-33.6% 🟢)2.290s101.00x
▲ VercelExpress1.652s (-11.9% 🟢)3.842s (+0.9%)2.190s101.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.404s (-5.0%)11.022s (~)0.618s31.00x
🐘 PostgresNitro10.414s (-4.2%)11.018s (~)0.604s31.00x
💻 LocalExpress10.423s (-4.6%)11.022s (~)0.600s31.00x
🐘 PostgresExpress10.426s (-4.9%)11.019s (~)0.593s31.00x
💻 LocalNext.js (Turbopack)10.661s11.021s0.360s31.02x
🐘 PostgresNext.js (Turbopack)10.720s11.017s0.296s31.03x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.871s (-18.3% 🟢)16.522s (-17.5% 🟢)2.651s21.00x
▲ VercelNitro14.235s (-40.0% 🟢)16.109s (-35.9% 🟢)1.874s21.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express13.443s (-7.8% 🟢)14.017s (-6.7% 🟢)0.574s51.00x
💻 LocalNitro13.449s (-10.7% 🟢)14.026s (-12.5% 🟢)0.577s51.00x
💻 LocalExpress13.466s (-10.0% 🟢)14.028s (-6.7% 🟢)0.562s51.00x
🐘 PostgresNitro13.488s (-7.6% 🟢)14.016s (-6.7% 🟢)0.529s51.00x
💻 LocalNext.js (Turbopack)14.079s15.030s0.951s41.05x
🐘 PostgresNext.js (Turbopack)14.119s15.017s0.898s41.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.850s (-64.5% 🟢)24.719s (-62.9% 🟢)1.869s31.00x
▲ VercelExpress23.445s (-53.4% 🟢)25.528s (-51.4% 🟢)2.083s31.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro11.921s (-29.0% 🟢)12.147s (-28.7% 🟢)0.226s81.00x
🐘 PostgresExpress11.945s (-14.7% 🟢)12.266s (-15.9% 🟢)0.321s81.00x
🐘 PostgresNitro11.952s (-14.4% 🟢)12.143s (-15.1% 🟢)0.191s81.00x
💻 LocalExpress12.038s (-27.5% 🟢)12.649s (-25.7% 🟢)0.612s81.01x
💻 LocalNext.js (Turbopack)13.059s13.451s0.392s71.10x
🐘 PostgresNext.js (Turbopack)13.118s14.017s0.899s71.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro32.773s (-92.3% 🟢)34.865s (-91.8% 🟢)2.092s31.00x
▲ VercelExpress33.214s (-72.6% 🟢)35.758s (-71.1% 🟢)2.545s31.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.147s (-9.0% 🟢)2.007s (~)0.860s151.00x
🐘 PostgresNitro1.149s (-9.9% 🟢)2.007s (~)0.858s151.00x
💻 LocalExpress1.175s (-21.0% 🟢)2.005s (~)0.830s151.02x
💻 LocalNitro1.197s (-26.6% 🟢)2.006s (-3.3%)0.809s151.04x
🐘 PostgresNext.js (Turbopack)1.213s2.008s0.795s151.06x
💻 LocalNext.js (Turbopack)1.289s2.006s0.717s151.12x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro5.022s (+78.2% 🔺)6.611s (+53.0% 🔺)1.590s51.00x
▲ VercelExpress5.473s (+91.4% 🔺)7.608s (+64.6% 🔺)2.135s41.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.224s (-48.2% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNitro1.224s (-47.9% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNext.js (Turbopack)1.376s2.008s0.631s151.12x
💻 LocalExpress1.743s (-41.0% 🟢)2.005s (-41.9% 🟢)0.262s151.42x
💻 LocalNitro1.755s (-44.2% 🟢)2.006s (-48.4% 🟢)0.251s151.43x
💻 LocalNext.js (Turbopack)1.769s2.149s0.380s141.45x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.028s (+38.9% 🔺)6.726s (+31.6% 🔺)1.698s61.00x
▲ VercelNitro5.572s (+37.5% 🔺)7.208s (+21.7% 🔺)1.636s51.11x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.369s (-60.7% 🟢)2.007s (-50.0% 🟢)0.638s151.00x
🐘 PostgresNitro1.370s (-60.6% 🟢)2.007s (-49.9% 🟢)0.636s151.00x
🐘 PostgresNext.js (Turbopack)1.635s2.007s0.371s151.19x
💻 LocalNext.js (Turbopack)4.663s5.154s0.491s73.41x
💻 LocalNitro5.177s (-38.0% 🟢)5.679s (-37.0% 🟢)0.503s63.78x
💻 LocalExpress5.194s (-37.7% 🟢)5.513s (-38.9% 🟢)0.319s63.79x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.029s (+65.8% 🔺)8.709s (+42.1% 🔺)1.679s41.00x
▲ VercelNitro8.935s (+153.4% 🔺)10.556s (+90.7% 🔺)1.621s31.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.148s (-8.7% 🟢)2.007s (~)0.859s151.00x
🐘 PostgresExpress1.152s (-8.3% 🟢)2.007s (~)0.855s151.00x
🐘 PostgresNext.js (Turbopack)1.214s2.006s0.793s151.06x
💻 LocalNext.js (Turbopack)1.353s2.005s0.653s151.18x
💻 LocalNitro1.433s (-23.2% 🟢)2.006s (-14.3% 🟢)0.573s151.25x
💻 LocalExpress1.441s (-23.9% 🟢)2.006s (-15.1% 🟢)0.564s151.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.577s (+38.6% 🔺)5.207s (+19.7% 🔺)1.630s61.00x
▲ VercelNitro4.549s (+85.0% 🔺)6.211s (+49.0% 🔺)1.662s61.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.215s (-48.1% 🟢)2.009s (-33.3% 🟢)0.794s151.00x
🐘 PostgresNitro1.247s (-46.7% 🟢)2.009s (-33.3% 🟢)0.761s151.03x
🐘 PostgresNext.js (Turbopack)1.363s2.008s0.645s151.12x
💻 LocalNitro1.967s (-35.8% 🟢)2.469s (-36.5% 🟢)0.503s131.62x
💻 LocalExpress1.979s (-36.8% 🟢)2.392s (-36.4% 🟢)0.413s131.63x
💻 LocalNext.js (Turbopack)1.998s2.675s0.678s121.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro4.851s (+50.0% 🔺)6.263s (+23.4% 🔺)1.413s51.00x
▲ VercelExpress5.603s (+75.5% 🔺)7.182s (+49.9% 🔺)1.579s51.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.366s (-61.0% 🟢)2.008s (-49.9% 🟢)0.641s151.00x
🐘 PostgresNitro1.403s (-59.7% 🟢)2.007s (-49.9% 🟢)0.604s151.03x
🐘 PostgresNext.js (Turbopack)1.638s2.007s0.369s151.20x
💻 LocalNext.js (Turbopack)4.981s5.680s0.699s63.65x
💻 LocalNitro5.479s (-40.1% 🟢)6.214s (-38.0% 🟢)0.734s54.01x
💻 LocalExpress5.612s (-36.2% 🟢)6.214s (-33.0% 🟢)0.602s54.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.939s (+23.7% 🔺)10.418s (+27.4% 🔺)2.479s41.00x
▲ VercelNitro8.342s (+63.8% 🔺)9.730s (+42.7% 🔺)1.389s41.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.450s (-46.4% 🟢)1.006s (-1.6%)0.557s601.00x
🐘 PostgresNitro0.452s (-45.0% 🟢)1.006s (~)0.554s601.00x
💻 LocalNitro0.462s (-52.9% 🟢)1.004s (-8.2% 🟢)0.542s601.03x
💻 LocalExpress0.467s (-52.5% 🟢)1.004s (-6.7% 🟢)0.537s601.04x
🐘 PostgresNext.js (Turbopack)0.676s1.007s0.331s601.50x
💻 LocalNext.js (Turbopack)0.727s1.004s0.278s601.62x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.163s (-72.8% 🟢)7.100s (-66.7% 🟢)1.938s91.00x
▲ VercelNitro6.750s (-69.4% 🟢)8.352s (-65.2% 🟢)1.602s81.31x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.045s (-47.1% 🟢)1.523s (-32.6% 🟢)0.478s601.00x
🐘 PostgresNitro1.082s (-43.8% 🟢)1.705s (-18.8% 🟢)0.622s531.04x
💻 LocalNitro1.183s (-61.0% 🟢)2.006s (-46.6% 🟢)0.823s451.13x
💻 LocalExpress1.191s (-60.5% 🟢)2.005s (-44.1% 🟢)0.814s451.14x
🐘 PostgresNext.js (Turbopack)1.602s2.007s0.405s451.53x
💻 LocalNext.js (Turbopack)1.814s2.006s0.192s451.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.163s (-61.9% 🟢)15.281s (-58.5% 🟢)2.117s61.00x
▲ VercelNitro13.845s (-64.9% 🟢)15.606s (-62.2% 🟢)1.761s61.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.041s (-50.3% 🟢)2.477s (-46.2% 🟢)0.436s491.00x
🐘 PostgresExpress2.090s (-47.6% 🟢)2.638s (-39.6% 🟢)0.548s461.02x
💻 LocalNitro2.660s (-71.4% 🟢)3.008s (-70.0% 🟢)0.348s401.30x
💻 LocalExpress2.681s (-70.9% 🟢)3.032s (-69.7% 🟢)0.352s401.31x
🐘 PostgresNext.js (Turbopack)3.154s4.009s0.855s301.55x
💻 LocalNext.js (Turbopack)3.855s4.075s0.220s301.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express40.673s (-68.7% 🟢)42.850s (-67.6% 🟢)2.177s31.00x
▲ VercelNitro41.417s (-57.3% 🟢)43.192s (-56.1% 🟢)1.776s31.02x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.177s (-37.2% 🟢)1.007s (~)0.829s601.00x
🐘 PostgresNitro0.189s (-33.3% 🟢)1.006s (~)0.817s601.07x
🐘 PostgresNext.js (Turbopack)0.237s1.006s0.770s601.33x
💻 LocalExpress0.428s (-23.6% 🟢)1.004s (~)0.576s602.41x
💻 LocalNitro0.456s (-24.6% 🟢)1.004s (-1.7%)0.548s602.57x
💻 LocalNext.js (Turbopack)0.568s1.004s0.436s603.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.570s (+54.7% 🔺)4.071s (+21.5% 🔺)1.501s151.00x
▲ VercelExpress2.703s (+38.3% 🔺)4.438s (+22.0% 🔺)1.735s141.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.303s (-40.5% 🟢)1.007s (~)0.703s901.00x
🐘 PostgresNitro0.316s (-36.3% 🟢)1.006s (~)0.690s901.04x
🐘 PostgresNext.js (Turbopack)0.459s1.006s0.547s901.51x
💻 LocalExpress2.171s (-13.6% 🟢)2.796s (-7.1% 🟢)0.625s337.16x
💻 LocalNext.js (Turbopack)2.175s3.010s0.835s307.17x
💻 LocalNitro2.239s (-11.8% 🟢)2.944s (-2.2%)0.705s317.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro8.771s (+171.9% 🔺)10.519s (+118.2% 🔺)1.747s91.00x
▲ VercelExpress9.600s (+215.1% 🔺)12.351s (+156.9% 🔺)2.751s81.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.622s (-24.0% 🟢)1.006s (-1.1%)0.383s1201.00x
🐘 PostgresNitro0.640s (-19.0% 🟢)1.006s (~)0.365s1201.03x
🐘 PostgresNext.js (Turbopack)0.967s1.466s0.499s831.55x
💻 LocalNitro10.059s (-10.1% 🟢)10.531s (-9.7% 🟢)0.472s1216.16x
💻 LocalExpress10.208s (-8.8% 🟢)10.696s (-10.4% 🟢)0.488s1216.40x
💻 LocalNext.js (Turbopack)11.327s11.939s0.612s1118.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.654s (+205.3% 🔺)24.859s (+168.9% 🔺)2.205s61.00x
▲ VercelNitro24.155s (+212.8% 🔺)26.342s (+180.2% 🔺)2.187s51.07x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.131s (+429.4% 🔺)2.005s (+99.6% 🔺)0.012s (-2.4%)2.019s (+98.2% 🔺)0.888s101.00x
🐘 PostgresNitro1.133s (+452.4% 🔺)2.001s (+100.1% 🔺)0.001s (-13.3% 🟢)2.010s (+98.7% 🔺)0.877s101.00x
🐘 PostgresExpress1.133s (+452.7% 🔺)1.998s (+100.1% 🔺)0.001s (-31.3% 🟢)2.009s (+98.7% 🔺)0.876s101.00x
💻 LocalExpress1.134s (+469.7% 🔺)2.005s (+99.6% 🔺)0.012s (+0.8%)2.019s (+98.3% 🔺)0.885s101.00x
💻 LocalNext.js (Turbopack)1.186s2.003s0.011s2.017s0.831s101.05x
🐘 PostgresNext.js (Turbopack)1.198s2.002s0.002s2.012s0.814s101.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.433s (-36.5% 🟢)3.428s (-35.0% 🟢)2.381s (+220.8% 🔺)6.286s (-3.0%)3.853s101.00x
▲ VercelExpress2.493s (~)3.666s (-10.4% 🟢)2.778s (+189.1% 🔺)6.958s (+24.5% 🔺)4.465s101.02x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.490s (+136.5% 🔺)2.006s (+99.3% 🔺)0.004s (+0.9%)2.028s (+98.2% 🔺)0.537s301.00x
🐘 PostgresNitro1.515s (+142.7% 🔺)2.004s (+99.0% 🔺)0.004s (-6.5% 🟢)2.026s (+98.1% 🔺)0.511s301.02x
💻 LocalNitro1.527s (+82.1% 🔺)2.010s (+98.7% 🔺)0.010s (+7.8% 🔺)2.023s (+81.2% 🔺)0.496s301.02x
🐘 PostgresNext.js (Turbopack)1.693s2.010s0.004s2.027s0.334s301.14x
💻 LocalNext.js (Turbopack)1.846s2.009s0.011s2.201s0.355s281.24x
💻 LocalExpress1.926s (+154.4% 🔺)2.012s (+95.5% 🔺)0.010s (+4.5%)2.424s (+133.1% 🔺)0.498s251.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.501s (-77.9% 🟢)7.965s (-74.1% 🟢)0.254s (+126.5% 🔺)8.704s (-72.6% 🟢)2.203s71.00x
▲ VercelExpress6.740s (+3.6%)8.086s (+1.0%)0.308s (-24.6% 🟢)8.933s (+1.1%)2.193s71.04x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.657s (-32.2% 🟢)1.032s (-17.3% 🟢)0.000s (-17.2% 🟢)1.050s (-16.5% 🟢)0.392s581.00x
🐘 PostgresExpress0.660s (-31.3% 🟢)1.030s (-19.4% 🟢)0.000s (+19.0% 🔺)1.049s (-19.7% 🟢)0.389s581.00x
🐘 PostgresNext.js (Turbopack)0.794s1.072s0.000s1.079s0.285s561.21x
💻 LocalNitro1.361s (+11.3% 🔺)2.015s (~)0.000s (+133.3% 🔺)2.017s (~)0.656s302.07x
💻 LocalExpress1.361s (+11.2% 🔺)2.016s (~)0.001s (+60.0% 🔺)2.018s (~)0.657s302.07x
💻 LocalNext.js (Turbopack)1.480s2.014s0.000s2.017s0.537s302.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.891s (+27.5% 🔺)5.190s (+18.2% 🔺)0.000s (+254.5% 🔺)5.758s (+19.7% 🔺)1.868s111.00x
▲ VercelExpress4.219s (+12.8% 🔺)5.581s (+9.4% 🔺)0.002s (+1000.0% 🔺)6.074s (+9.8% 🔺)1.855s111.08x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.232s (-30.5% 🟢)1.998s (-8.3% 🟢)0.000s (+Infinity% 🔺)2.015s (-8.4% 🟢)0.783s301.00x
🐘 PostgresNitro1.273s (-28.9% 🟢)2.029s (-5.3% 🟢)0.000s (-6.7% 🟢)2.045s (-6.0% 🟢)0.771s301.03x
🐘 PostgresNext.js (Turbopack)1.610s2.110s0.000s2.145s0.534s281.31x
💻 LocalNext.js (Turbopack)2.878s3.416s0.000s3.424s0.545s182.34x
💻 LocalNitro3.083s (-9.0% 🟢)3.905s (-3.2%)0.000s (-64.8% 🟢)3.907s (-3.2%)0.824s162.50x
💻 LocalExpress3.168s (-8.6% 🟢)3.966s (-1.7%)0.001s (-6.3% 🟢)3.968s (-1.7%)0.800s162.57x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express6.633s (+44.6% 🔺)8.145s (+35.3% 🔺)0.001s (+Infinity% 🔺)8.706s (+34.8% 🔺)2.073s71.00x
▲ VercelNitro7.121s (+73.9% 🔺)8.227s (+53.1% 🔺)0.000s (-47.6% 🟢)8.712s (+50.4% 🔺)1.591s71.07x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Express | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro12/21
🐘 PostgresExpress16/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres15/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: success
  • Vercel: failure

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a flaky race during @workflow/world-postgres startup where concurrent processes can both attempt graphile-worker schema installation on a fresh database, triggering duplicate key value violates unique constraint "pg_namespace_nspname_index".

Changes:

  • Serialize graphile-worker bootstrap (makeWorkerUtils + migrate) using a Postgres advisory lock in packages/world-postgres/src/queue.ts.
  • Update unit test pool mocks to include pool.connect() to match the new startup path.
  • Add a changeset documenting the patch release.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

FileDescription
packages/world-postgres/src/queue.tsAdds transaction-scoped advisory lock wrapper around graphile-worker bootstrap to avoid concurrent schema install races.
packages/world-postgres/src/queue.test.tsUpdates pool mock to include connect() for the new locking code path.
packages/world-postgres/src/reenqueue.test.tsUpdates pool mock to include connect() for the new locking code path.
.changeset/fix-world-postgres-graphile-bootstrap-race.mdDeclares a patch release and describes the race/lock fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/world-postgres/src/queue.ts Outdated
Comment threadpackages/world-postgres/src/queue.ts Outdated
- Release the locked connection before makeWorkerUtils() so the
bootstrap can't deadlock against the same pool when maxPoolSize is
small (Copilot review #1). Achieved by replicating graphile-worker's
installSchema DDL ourselves under the lock; once the schema exists
graphile-worker's own installSchema is a no-op.
- Add a unit test that asserts the lock-ordering: pool.connect -> BEGIN
-> pg_advisory_xact_lock -> CREATE SCHEMA -> COMMIT -> release ->
makeWorkerUtils (Copilot review #2).

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not convinced we should duplicate migration code in the queue file and use a lock for this

"@workflow/world-postgres": patch
---

Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()` callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS` and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()`callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS`and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.
Ensure concurrent `world.start()`calls don't race on `CREATE SCHEMA IF NOT EXISTS`by using a lock. Fixes `duplicate key value violates unique constraint "pg_namespace_nspname_index"` errors.

@TooTallNate

Copy link
Copy Markdown
MemberAuthor

Closing in favor of #2019 — Peter's approach pre-bootstraps the graphile_worker schema in workflow-postgres-setup (the CLI that CI already runs once before any consumer process), which eliminates the race window entirely without touching the production hot path. Cleaner fix; 23 lines vs 135 here.

See #2019 (review) for the full comparison.

@TooTallNate
TooTallNate deleted the fix-world-postgres-graphile-bootstrap-race branch May 19, 2026 16:47
Sign up for freeto 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.

3 participants

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock - #1966

Closed
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race
Closed

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock#1966
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Fixes the E2E Local Postgres Tests flake on main (example failing job) where the first test (addTenWorkflow) fails with:

error: duplicate key value violates unique constraint "pg_namespace_nspname_index"
❯ installSchema node_modules/.../graphile-worker/dist/migrate.js:23:5
❯ migrate node_modules/.../graphile-worker/dist/migrate.js:92:17
❯ makeWorkerUtils node_modules/.../graphile-worker/dist/workerUtils.js:12:40
❯ packages/world-postgres/dist/queue.js:212:35
❯ start packages/world-postgres/dist/queue.js:226:9

Root cause

PR #1959 removed instrumentation.ts from the workbenches, which previously pre-warmed world.start() in the Next.js dev server before any HTTP traffic arrived. Without that pre-warm, world.start() is now called lazily on the first workflow request — and in the local-postgres CI matrix, the vitest test process itself also initializes a postgres world (because WORKFLOW_TARGET_WORLD=@workflow/world-postgres is set in the test env). So two independent Node processes (the test runner and the Next.js dev server) race to install the graphile_worker schema on a fresh database.

PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe across concurrent sessions — the existence check happens at one MVCC snapshot but the pg_namespace insert happens at commit, so two sessions can both pass the check and one then fails with duplicate key value violates unique constraint "pg_namespace_nspname_index". graphile-worker's installSchema does no locking around this.

Fix

Wrap the makeWorkerUtils({pgPool}).migrate() call in packages/world-postgres/src/queue.ts with a Postgres advisory lock (pg_advisory_xact_lock) so that concurrent callers across processes are serialized on graphile-worker schema bootstrap. The lock is transaction-scoped, so it is automatically released if the bootstrapping process dies mid-flight.

Verification

  • pnpm --filter @workflow/world-postgres typecheck
  • pnpm --filter @workflow/world-postgres build
  • pnpm --filter @workflow/world-postgres test ✓ (109/109, including the real-Postgres integration tests in test/spec.test.ts that exercise the full world.start() path)

…y lock
Prevents "duplicate key value violates unique constraint
pg_namespace_nspname_index" errors when multiple processes (e.g. dev
server + test runner) call world.start() concurrently against a fresh
database. PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe
across concurrent sessions, and graphile-worker's installSchema does
not lock its bootstrap path.
CopilotAI review requested due to automatic review settings May 11, 2026 06:06
@vercel

vercelBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

changeset-botBot commented May 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8f2980

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
NameType
@workflow/world-postgresPatch
tarballsPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production120002191419
✅ 💻 Local Development158702191806
✅ 📦 Local Production158702191806
✅ 🐘 Local Postgres158702191806
✅ 🪟 Windows12900129
✅ 📋 Other7270176903
Total6817010527869

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro103026
✅ example103026
✅ express103026
✅ fastify103026
✅ hono103026
✅ nextjs-turbopack12702
✅ nextjs-webpack12702
✅ nitro103026
✅ nuxt103026
✅ sveltekit12207
✅ vite103026
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack12900
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable104025
✅ e2e-local-dev-tanstack-start-104025
✅ e2e-local-postgres-nest-stable104025
✅ e2e-local-postgres-tanstack-start-104025
✅ e2e-local-prod-nest-stable104025
✅ e2e-local-prod-tanstack-start-104025
✅ e2e-vercel-prod-tanstack-start103026

📋 View full workflow run

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.032s (-28.9% 🟢)1.006s (~)0.974s101.00x
💻 LocalNitro0.033s (-22.7% 🟢)1.006s (~)0.972s101.06x
💻 LocalNext.js (Turbopack)0.046s1.005s0.960s101.46x
🐘 PostgresExpress0.049s (-16.0% 🟢)1.012s (~)0.963s101.55x
🐘 PostgresNitro0.053s (-44.5% 🟢)1.013s (-2.9%)0.960s101.68x
🐘 PostgresNext.js (Turbopack)0.057s1.011s0.954s101.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.292s (-28.8% 🟢)2.290s (-8.7% 🟢)1.998s101.00x
▲ VercelExpress0.338s (+43.5% 🔺)2.489s (+16.5% 🔺)2.151s101.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.067s (-5.7% 🟢)2.006s (~)0.939s101.00x
💻 LocalExpress1.069s (-5.0% 🟢)2.007s (~)0.938s101.00x
🐘 PostgresExpress1.083s (-5.6% 🟢)2.008s (~)0.926s101.01x
🐘 PostgresNitro1.089s (-4.5%)2.010s (~)0.921s101.02x
💻 LocalNext.js (Turbopack)1.123s2.006s0.882s101.05x
🐘 PostgresNext.js (Turbopack)1.123s2.009s0.886s101.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.634s (-58.0% 🟢)3.924s (-33.6% 🟢)2.290s101.00x
▲ VercelExpress1.652s (-11.9% 🟢)3.842s (+0.9%)2.190s101.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.404s (-5.0%)11.022s (~)0.618s31.00x
🐘 PostgresNitro10.414s (-4.2%)11.018s (~)0.604s31.00x
💻 LocalExpress10.423s (-4.6%)11.022s (~)0.600s31.00x
🐘 PostgresExpress10.426s (-4.9%)11.019s (~)0.593s31.00x
💻 LocalNext.js (Turbopack)10.661s11.021s0.360s31.02x
🐘 PostgresNext.js (Turbopack)10.720s11.017s0.296s31.03x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.871s (-18.3% 🟢)16.522s (-17.5% 🟢)2.651s21.00x
▲ VercelNitro14.235s (-40.0% 🟢)16.109s (-35.9% 🟢)1.874s21.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express13.443s (-7.8% 🟢)14.017s (-6.7% 🟢)0.574s51.00x
💻 LocalNitro13.449s (-10.7% 🟢)14.026s (-12.5% 🟢)0.577s51.00x
💻 LocalExpress13.466s (-10.0% 🟢)14.028s (-6.7% 🟢)0.562s51.00x
🐘 PostgresNitro13.488s (-7.6% 🟢)14.016s (-6.7% 🟢)0.529s51.00x
💻 LocalNext.js (Turbopack)14.079s15.030s0.951s41.05x
🐘 PostgresNext.js (Turbopack)14.119s15.017s0.898s41.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.850s (-64.5% 🟢)24.719s (-62.9% 🟢)1.869s31.00x
▲ VercelExpress23.445s (-53.4% 🟢)25.528s (-51.4% 🟢)2.083s31.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro11.921s (-29.0% 🟢)12.147s (-28.7% 🟢)0.226s81.00x
🐘 PostgresExpress11.945s (-14.7% 🟢)12.266s (-15.9% 🟢)0.321s81.00x
🐘 PostgresNitro11.952s (-14.4% 🟢)12.143s (-15.1% 🟢)0.191s81.00x
💻 LocalExpress12.038s (-27.5% 🟢)12.649s (-25.7% 🟢)0.612s81.01x
💻 LocalNext.js (Turbopack)13.059s13.451s0.392s71.10x
🐘 PostgresNext.js (Turbopack)13.118s14.017s0.899s71.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro32.773s (-92.3% 🟢)34.865s (-91.8% 🟢)2.092s31.00x
▲ VercelExpress33.214s (-72.6% 🟢)35.758s (-71.1% 🟢)2.545s31.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.147s (-9.0% 🟢)2.007s (~)0.860s151.00x
🐘 PostgresNitro1.149s (-9.9% 🟢)2.007s (~)0.858s151.00x
💻 LocalExpress1.175s (-21.0% 🟢)2.005s (~)0.830s151.02x
💻 LocalNitro1.197s (-26.6% 🟢)2.006s (-3.3%)0.809s151.04x
🐘 PostgresNext.js (Turbopack)1.213s2.008s0.795s151.06x
💻 LocalNext.js (Turbopack)1.289s2.006s0.717s151.12x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro5.022s (+78.2% 🔺)6.611s (+53.0% 🔺)1.590s51.00x
▲ VercelExpress5.473s (+91.4% 🔺)7.608s (+64.6% 🔺)2.135s41.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.224s (-48.2% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNitro1.224s (-47.9% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNext.js (Turbopack)1.376s2.008s0.631s151.12x
💻 LocalExpress1.743s (-41.0% 🟢)2.005s (-41.9% 🟢)0.262s151.42x
💻 LocalNitro1.755s (-44.2% 🟢)2.006s (-48.4% 🟢)0.251s151.43x
💻 LocalNext.js (Turbopack)1.769s2.149s0.380s141.45x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.028s (+38.9% 🔺)6.726s (+31.6% 🔺)1.698s61.00x
▲ VercelNitro5.572s (+37.5% 🔺)7.208s (+21.7% 🔺)1.636s51.11x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.369s (-60.7% 🟢)2.007s (-50.0% 🟢)0.638s151.00x
🐘 PostgresNitro1.370s (-60.6% 🟢)2.007s (-49.9% 🟢)0.636s151.00x
🐘 PostgresNext.js (Turbopack)1.635s2.007s0.371s151.19x
💻 LocalNext.js (Turbopack)4.663s5.154s0.491s73.41x
💻 LocalNitro5.177s (-38.0% 🟢)5.679s (-37.0% 🟢)0.503s63.78x
💻 LocalExpress5.194s (-37.7% 🟢)5.513s (-38.9% 🟢)0.319s63.79x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.029s (+65.8% 🔺)8.709s (+42.1% 🔺)1.679s41.00x
▲ VercelNitro8.935s (+153.4% 🔺)10.556s (+90.7% 🔺)1.621s31.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.148s (-8.7% 🟢)2.007s (~)0.859s151.00x
🐘 PostgresExpress1.152s (-8.3% 🟢)2.007s (~)0.855s151.00x
🐘 PostgresNext.js (Turbopack)1.214s2.006s0.793s151.06x
💻 LocalNext.js (Turbopack)1.353s2.005s0.653s151.18x
💻 LocalNitro1.433s (-23.2% 🟢)2.006s (-14.3% 🟢)0.573s151.25x
💻 LocalExpress1.441s (-23.9% 🟢)2.006s (-15.1% 🟢)0.564s151.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.577s (+38.6% 🔺)5.207s (+19.7% 🔺)1.630s61.00x
▲ VercelNitro4.549s (+85.0% 🔺)6.211s (+49.0% 🔺)1.662s61.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.215s (-48.1% 🟢)2.009s (-33.3% 🟢)0.794s151.00x
🐘 PostgresNitro1.247s (-46.7% 🟢)2.009s (-33.3% 🟢)0.761s151.03x
🐘 PostgresNext.js (Turbopack)1.363s2.008s0.645s151.12x
💻 LocalNitro1.967s (-35.8% 🟢)2.469s (-36.5% 🟢)0.503s131.62x
💻 LocalExpress1.979s (-36.8% 🟢)2.392s (-36.4% 🟢)0.413s131.63x
💻 LocalNext.js (Turbopack)1.998s2.675s0.678s121.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro4.851s (+50.0% 🔺)6.263s (+23.4% 🔺)1.413s51.00x
▲ VercelExpress5.603s (+75.5% 🔺)7.182s (+49.9% 🔺)1.579s51.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.366s (-61.0% 🟢)2.008s (-49.9% 🟢)0.641s151.00x
🐘 PostgresNitro1.403s (-59.7% 🟢)2.007s (-49.9% 🟢)0.604s151.03x
🐘 PostgresNext.js (Turbopack)1.638s2.007s0.369s151.20x
💻 LocalNext.js (Turbopack)4.981s5.680s0.699s63.65x
💻 LocalNitro5.479s (-40.1% 🟢)6.214s (-38.0% 🟢)0.734s54.01x
💻 LocalExpress5.612s (-36.2% 🟢)6.214s (-33.0% 🟢)0.602s54.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.939s (+23.7% 🔺)10.418s (+27.4% 🔺)2.479s41.00x
▲ VercelNitro8.342s (+63.8% 🔺)9.730s (+42.7% 🔺)1.389s41.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.450s (-46.4% 🟢)1.006s (-1.6%)0.557s601.00x
🐘 PostgresNitro0.452s (-45.0% 🟢)1.006s (~)0.554s601.00x
💻 LocalNitro0.462s (-52.9% 🟢)1.004s (-8.2% 🟢)0.542s601.03x
💻 LocalExpress0.467s (-52.5% 🟢)1.004s (-6.7% 🟢)0.537s601.04x
🐘 PostgresNext.js (Turbopack)0.676s1.007s0.331s601.50x
💻 LocalNext.js (Turbopack)0.727s1.004s0.278s601.62x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.163s (-72.8% 🟢)7.100s (-66.7% 🟢)1.938s91.00x
▲ VercelNitro6.750s (-69.4% 🟢)8.352s (-65.2% 🟢)1.602s81.31x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.045s (-47.1% 🟢)1.523s (-32.6% 🟢)0.478s601.00x
🐘 PostgresNitro1.082s (-43.8% 🟢)1.705s (-18.8% 🟢)0.622s531.04x
💻 LocalNitro1.183s (-61.0% 🟢)2.006s (-46.6% 🟢)0.823s451.13x
💻 LocalExpress1.191s (-60.5% 🟢)2.005s (-44.1% 🟢)0.814s451.14x
🐘 PostgresNext.js (Turbopack)1.602s2.007s0.405s451.53x
💻 LocalNext.js (Turbopack)1.814s2.006s0.192s451.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.163s (-61.9% 🟢)15.281s (-58.5% 🟢)2.117s61.00x
▲ VercelNitro13.845s (-64.9% 🟢)15.606s (-62.2% 🟢)1.761s61.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.041s (-50.3% 🟢)2.477s (-46.2% 🟢)0.436s491.00x
🐘 PostgresExpress2.090s (-47.6% 🟢)2.638s (-39.6% 🟢)0.548s461.02x
💻 LocalNitro2.660s (-71.4% 🟢)3.008s (-70.0% 🟢)0.348s401.30x
💻 LocalExpress2.681s (-70.9% 🟢)3.032s (-69.7% 🟢)0.352s401.31x
🐘 PostgresNext.js (Turbopack)3.154s4.009s0.855s301.55x
💻 LocalNext.js (Turbopack)3.855s4.075s0.220s301.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express40.673s (-68.7% 🟢)42.850s (-67.6% 🟢)2.177s31.00x
▲ VercelNitro41.417s (-57.3% 🟢)43.192s (-56.1% 🟢)1.776s31.02x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.177s (-37.2% 🟢)1.007s (~)0.829s601.00x
🐘 PostgresNitro0.189s (-33.3% 🟢)1.006s (~)0.817s601.07x
🐘 PostgresNext.js (Turbopack)0.237s1.006s0.770s601.33x
💻 LocalExpress0.428s (-23.6% 🟢)1.004s (~)0.576s602.41x
💻 LocalNitro0.456s (-24.6% 🟢)1.004s (-1.7%)0.548s602.57x
💻 LocalNext.js (Turbopack)0.568s1.004s0.436s603.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.570s (+54.7% 🔺)4.071s (+21.5% 🔺)1.501s151.00x
▲ VercelExpress2.703s (+38.3% 🔺)4.438s (+22.0% 🔺)1.735s141.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.303s (-40.5% 🟢)1.007s (~)0.703s901.00x
🐘 PostgresNitro0.316s (-36.3% 🟢)1.006s (~)0.690s901.04x
🐘 PostgresNext.js (Turbopack)0.459s1.006s0.547s901.51x
💻 LocalExpress2.171s (-13.6% 🟢)2.796s (-7.1% 🟢)0.625s337.16x
💻 LocalNext.js (Turbopack)2.175s3.010s0.835s307.17x
💻 LocalNitro2.239s (-11.8% 🟢)2.944s (-2.2%)0.705s317.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro8.771s (+171.9% 🔺)10.519s (+118.2% 🔺)1.747s91.00x
▲ VercelExpress9.600s (+215.1% 🔺)12.351s (+156.9% 🔺)2.751s81.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.622s (-24.0% 🟢)1.006s (-1.1%)0.383s1201.00x
🐘 PostgresNitro0.640s (-19.0% 🟢)1.006s (~)0.365s1201.03x
🐘 PostgresNext.js (Turbopack)0.967s1.466s0.499s831.55x
💻 LocalNitro10.059s (-10.1% 🟢)10.531s (-9.7% 🟢)0.472s1216.16x
💻 LocalExpress10.208s (-8.8% 🟢)10.696s (-10.4% 🟢)0.488s1216.40x
💻 LocalNext.js (Turbopack)11.327s11.939s0.612s1118.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.654s (+205.3% 🔺)24.859s (+168.9% 🔺)2.205s61.00x
▲ VercelNitro24.155s (+212.8% 🔺)26.342s (+180.2% 🔺)2.187s51.07x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.131s (+429.4% 🔺)2.005s (+99.6% 🔺)0.012s (-2.4%)2.019s (+98.2% 🔺)0.888s101.00x
🐘 PostgresNitro1.133s (+452.4% 🔺)2.001s (+100.1% 🔺)0.001s (-13.3% 🟢)2.010s (+98.7% 🔺)0.877s101.00x
🐘 PostgresExpress1.133s (+452.7% 🔺)1.998s (+100.1% 🔺)0.001s (-31.3% 🟢)2.009s (+98.7% 🔺)0.876s101.00x
💻 LocalExpress1.134s (+469.7% 🔺)2.005s (+99.6% 🔺)0.012s (+0.8%)2.019s (+98.3% 🔺)0.885s101.00x
💻 LocalNext.js (Turbopack)1.186s2.003s0.011s2.017s0.831s101.05x
🐘 PostgresNext.js (Turbopack)1.198s2.002s0.002s2.012s0.814s101.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.433s (-36.5% 🟢)3.428s (-35.0% 🟢)2.381s (+220.8% 🔺)6.286s (-3.0%)3.853s101.00x
▲ VercelExpress2.493s (~)3.666s (-10.4% 🟢)2.778s (+189.1% 🔺)6.958s (+24.5% 🔺)4.465s101.02x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.490s (+136.5% 🔺)2.006s (+99.3% 🔺)0.004s (+0.9%)2.028s (+98.2% 🔺)0.537s301.00x
🐘 PostgresNitro1.515s (+142.7% 🔺)2.004s (+99.0% 🔺)0.004s (-6.5% 🟢)2.026s (+98.1% 🔺)0.511s301.02x
💻 LocalNitro1.527s (+82.1% 🔺)2.010s (+98.7% 🔺)0.010s (+7.8% 🔺)2.023s (+81.2% 🔺)0.496s301.02x
🐘 PostgresNext.js (Turbopack)1.693s2.010s0.004s2.027s0.334s301.14x
💻 LocalNext.js (Turbopack)1.846s2.009s0.011s2.201s0.355s281.24x
💻 LocalExpress1.926s (+154.4% 🔺)2.012s (+95.5% 🔺)0.010s (+4.5%)2.424s (+133.1% 🔺)0.498s251.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.501s (-77.9% 🟢)7.965s (-74.1% 🟢)0.254s (+126.5% 🔺)8.704s (-72.6% 🟢)2.203s71.00x
▲ VercelExpress6.740s (+3.6%)8.086s (+1.0%)0.308s (-24.6% 🟢)8.933s (+1.1%)2.193s71.04x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.657s (-32.2% 🟢)1.032s (-17.3% 🟢)0.000s (-17.2% 🟢)1.050s (-16.5% 🟢)0.392s581.00x
🐘 PostgresExpress0.660s (-31.3% 🟢)1.030s (-19.4% 🟢)0.000s (+19.0% 🔺)1.049s (-19.7% 🟢)0.389s581.00x
🐘 PostgresNext.js (Turbopack)0.794s1.072s0.000s1.079s0.285s561.21x
💻 LocalNitro1.361s (+11.3% 🔺)2.015s (~)0.000s (+133.3% 🔺)2.017s (~)0.656s302.07x
💻 LocalExpress1.361s (+11.2% 🔺)2.016s (~)0.001s (+60.0% 🔺)2.018s (~)0.657s302.07x
💻 LocalNext.js (Turbopack)1.480s2.014s0.000s2.017s0.537s302.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.891s (+27.5% 🔺)5.190s (+18.2% 🔺)0.000s (+254.5% 🔺)5.758s (+19.7% 🔺)1.868s111.00x
▲ VercelExpress4.219s (+12.8% 🔺)5.581s (+9.4% 🔺)0.002s (+1000.0% 🔺)6.074s (+9.8% 🔺)1.855s111.08x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.232s (-30.5% 🟢)1.998s (-8.3% 🟢)0.000s (+Infinity% 🔺)2.015s (-8.4% 🟢)0.783s301.00x
🐘 PostgresNitro1.273s (-28.9% 🟢)2.029s (-5.3% 🟢)0.000s (-6.7% 🟢)2.045s (-6.0% 🟢)0.771s301.03x
🐘 PostgresNext.js (Turbopack)1.610s2.110s0.000s2.145s0.534s281.31x
💻 LocalNext.js (Turbopack)2.878s3.416s0.000s3.424s0.545s182.34x
💻 LocalNitro3.083s (-9.0% 🟢)3.905s (-3.2%)0.000s (-64.8% 🟢)3.907s (-3.2%)0.824s162.50x
💻 LocalExpress3.168s (-8.6% 🟢)3.966s (-1.7%)0.001s (-6.3% 🟢)3.968s (-1.7%)0.800s162.57x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express6.633s (+44.6% 🔺)8.145s (+35.3% 🔺)0.001s (+Infinity% 🔺)8.706s (+34.8% 🔺)2.073s71.00x
▲ VercelNitro7.121s (+73.9% 🔺)8.227s (+53.1% 🔺)0.000s (-47.6% 🟢)8.712s (+50.4% 🔺)1.591s71.07x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Express | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro12/21
🐘 PostgresExpress16/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres15/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: success
  • Vercel: failure

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a flaky race during @workflow/world-postgres startup where concurrent processes can both attempt graphile-worker schema installation on a fresh database, triggering duplicate key value violates unique constraint "pg_namespace_nspname_index".

Changes:

  • Serialize graphile-worker bootstrap (makeWorkerUtils + migrate) using a Postgres advisory lock in packages/world-postgres/src/queue.ts.
  • Update unit test pool mocks to include pool.connect() to match the new startup path.
  • Add a changeset documenting the patch release.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

FileDescription
packages/world-postgres/src/queue.tsAdds transaction-scoped advisory lock wrapper around graphile-worker bootstrap to avoid concurrent schema install races.
packages/world-postgres/src/queue.test.tsUpdates pool mock to include connect() for the new locking code path.
packages/world-postgres/src/reenqueue.test.tsUpdates pool mock to include connect() for the new locking code path.
.changeset/fix-world-postgres-graphile-bootstrap-race.mdDeclares a patch release and describes the race/lock fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/world-postgres/src/queue.ts Outdated
Comment threadpackages/world-postgres/src/queue.ts Outdated
- Release the locked connection before makeWorkerUtils() so the
bootstrap can't deadlock against the same pool when maxPoolSize is
small (Copilot review #1). Achieved by replicating graphile-worker's
installSchema DDL ourselves under the lock; once the schema exists
graphile-worker's own installSchema is a no-op.
- Add a unit test that asserts the lock-ordering: pool.connect -> BEGIN
-> pg_advisory_xact_lock -> CREATE SCHEMA -> COMMIT -> release ->
makeWorkerUtils (Copilot review #2).

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not convinced we should duplicate migration code in the queue file and use a lock for this

"@workflow/world-postgres": patch
---

Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()` callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS` and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()`callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS`and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.
Ensure concurrent `world.start()`calls don't race on `CREATE SCHEMA IF NOT EXISTS`by using a lock. Fixes `duplicate key value violates unique constraint "pg_namespace_nspname_index"` errors.

@TooTallNate

Copy link
Copy Markdown
MemberAuthor

Closing in favor of #2019 — Peter's approach pre-bootstraps the graphile_worker schema in workflow-postgres-setup (the CLI that CI already runs once before any consumer process), which eliminates the race window entirely without touching the production hot path. Cleaner fix; 23 lines vs 135 here.

See #2019 (review) for the full comparison.

@TooTallNate
TooTallNate deleted the fix-world-postgres-graphile-bootstrap-race branch May 19, 2026 16:47
Sign up for freeto 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.

3 participants

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock - #1966

Closed
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race
Closed

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock#1966
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Fixes the E2E Local Postgres Tests flake on main (example failing job) where the first test (addTenWorkflow) fails with:

error: duplicate key value violates unique constraint "pg_namespace_nspname_index"
❯ installSchema node_modules/.../graphile-worker/dist/migrate.js:23:5
❯ migrate node_modules/.../graphile-worker/dist/migrate.js:92:17
❯ makeWorkerUtils node_modules/.../graphile-worker/dist/workerUtils.js:12:40
❯ packages/world-postgres/dist/queue.js:212:35
❯ start packages/world-postgres/dist/queue.js:226:9

Root cause

PR #1959 removed instrumentation.ts from the workbenches, which previously pre-warmed world.start() in the Next.js dev server before any HTTP traffic arrived. Without that pre-warm, world.start() is now called lazily on the first workflow request — and in the local-postgres CI matrix, the vitest test process itself also initializes a postgres world (because WORKFLOW_TARGET_WORLD=@workflow/world-postgres is set in the test env). So two independent Node processes (the test runner and the Next.js dev server) race to install the graphile_worker schema on a fresh database.

PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe across concurrent sessions — the existence check happens at one MVCC snapshot but the pg_namespace insert happens at commit, so two sessions can both pass the check and one then fails with duplicate key value violates unique constraint "pg_namespace_nspname_index". graphile-worker's installSchema does no locking around this.

Fix

Wrap the makeWorkerUtils({pgPool}).migrate() call in packages/world-postgres/src/queue.ts with a Postgres advisory lock (pg_advisory_xact_lock) so that concurrent callers across processes are serialized on graphile-worker schema bootstrap. The lock is transaction-scoped, so it is automatically released if the bootstrapping process dies mid-flight.

Verification

  • pnpm --filter @workflow/world-postgres typecheck
  • pnpm --filter @workflow/world-postgres build
  • pnpm --filter @workflow/world-postgres test ✓ (109/109, including the real-Postgres integration tests in test/spec.test.ts that exercise the full world.start() path)

…y lock
Prevents "duplicate key value violates unique constraint
pg_namespace_nspname_index" errors when multiple processes (e.g. dev
server + test runner) call world.start() concurrently against a fresh
database. PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe
across concurrent sessions, and graphile-worker's installSchema does
not lock its bootstrap path.
CopilotAI review requested due to automatic review settings May 11, 2026 06:06
@vercel

vercelBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

changeset-botBot commented May 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8f2980

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
NameType
@workflow/world-postgresPatch
tarballsPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production120002191419
✅ 💻 Local Development158702191806
✅ 📦 Local Production158702191806
✅ 🐘 Local Postgres158702191806
✅ 🪟 Windows12900129
✅ 📋 Other7270176903
Total6817010527869

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro103026
✅ example103026
✅ express103026
✅ fastify103026
✅ hono103026
✅ nextjs-turbopack12702
✅ nextjs-webpack12702
✅ nitro103026
✅ nuxt103026
✅ sveltekit12207
✅ vite103026
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable104025
✅ express-stable104025
✅ fastify-stable104025
✅ hono-stable104025
✅ nextjs-turbopack-canary110019
✅ nextjs-turbopack-stable-lazy-discovery-disabled12900
✅ nextjs-turbopack-stable-lazy-discovery-enabled12900
✅ nextjs-webpack-canary110019
✅ nextjs-webpack-stable-lazy-discovery-disabled12900
✅ nextjs-webpack-stable-lazy-discovery-enabled12900
✅ nitro-stable104025
✅ nuxt-stable104025
✅ sveltekit-stable12306
✅ vite-stable104025
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack12900
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable104025
✅ e2e-local-dev-tanstack-start-104025
✅ e2e-local-postgres-nest-stable104025
✅ e2e-local-postgres-tanstack-start-104025
✅ e2e-local-prod-nest-stable104025
✅ e2e-local-prod-tanstack-start-104025
✅ e2e-vercel-prod-tanstack-start103026

📋 View full workflow run

@github-actions

github-actionsBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.032s (-28.9% 🟢)1.006s (~)0.974s101.00x
💻 LocalNitro0.033s (-22.7% 🟢)1.006s (~)0.972s101.06x
💻 LocalNext.js (Turbopack)0.046s1.005s0.960s101.46x
🐘 PostgresExpress0.049s (-16.0% 🟢)1.012s (~)0.963s101.55x
🐘 PostgresNitro0.053s (-44.5% 🟢)1.013s (-2.9%)0.960s101.68x
🐘 PostgresNext.js (Turbopack)0.057s1.011s0.954s101.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.292s (-28.8% 🟢)2.290s (-8.7% 🟢)1.998s101.00x
▲ VercelExpress0.338s (+43.5% 🔺)2.489s (+16.5% 🔺)2.151s101.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.067s (-5.7% 🟢)2.006s (~)0.939s101.00x
💻 LocalExpress1.069s (-5.0% 🟢)2.007s (~)0.938s101.00x
🐘 PostgresExpress1.083s (-5.6% 🟢)2.008s (~)0.926s101.01x
🐘 PostgresNitro1.089s (-4.5%)2.010s (~)0.921s101.02x
💻 LocalNext.js (Turbopack)1.123s2.006s0.882s101.05x
🐘 PostgresNext.js (Turbopack)1.123s2.009s0.886s101.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.634s (-58.0% 🟢)3.924s (-33.6% 🟢)2.290s101.00x
▲ VercelExpress1.652s (-11.9% 🟢)3.842s (+0.9%)2.190s101.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.404s (-5.0%)11.022s (~)0.618s31.00x
🐘 PostgresNitro10.414s (-4.2%)11.018s (~)0.604s31.00x
💻 LocalExpress10.423s (-4.6%)11.022s (~)0.600s31.00x
🐘 PostgresExpress10.426s (-4.9%)11.019s (~)0.593s31.00x
💻 LocalNext.js (Turbopack)10.661s11.021s0.360s31.02x
🐘 PostgresNext.js (Turbopack)10.720s11.017s0.296s31.03x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.871s (-18.3% 🟢)16.522s (-17.5% 🟢)2.651s21.00x
▲ VercelNitro14.235s (-40.0% 🟢)16.109s (-35.9% 🟢)1.874s21.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express13.443s (-7.8% 🟢)14.017s (-6.7% 🟢)0.574s51.00x
💻 LocalNitro13.449s (-10.7% 🟢)14.026s (-12.5% 🟢)0.577s51.00x
💻 LocalExpress13.466s (-10.0% 🟢)14.028s (-6.7% 🟢)0.562s51.00x
🐘 PostgresNitro13.488s (-7.6% 🟢)14.016s (-6.7% 🟢)0.529s51.00x
💻 LocalNext.js (Turbopack)14.079s15.030s0.951s41.05x
🐘 PostgresNext.js (Turbopack)14.119s15.017s0.898s41.05x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.850s (-64.5% 🟢)24.719s (-62.9% 🟢)1.869s31.00x
▲ VercelExpress23.445s (-53.4% 🟢)25.528s (-51.4% 🟢)2.083s31.03x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro11.921s (-29.0% 🟢)12.147s (-28.7% 🟢)0.226s81.00x
🐘 PostgresExpress11.945s (-14.7% 🟢)12.266s (-15.9% 🟢)0.321s81.00x
🐘 PostgresNitro11.952s (-14.4% 🟢)12.143s (-15.1% 🟢)0.191s81.00x
💻 LocalExpress12.038s (-27.5% 🟢)12.649s (-25.7% 🟢)0.612s81.01x
💻 LocalNext.js (Turbopack)13.059s13.451s0.392s71.10x
🐘 PostgresNext.js (Turbopack)13.118s14.017s0.899s71.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro32.773s (-92.3% 🟢)34.865s (-91.8% 🟢)2.092s31.00x
▲ VercelExpress33.214s (-72.6% 🟢)35.758s (-71.1% 🟢)2.545s31.01x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.147s (-9.0% 🟢)2.007s (~)0.860s151.00x
🐘 PostgresNitro1.149s (-9.9% 🟢)2.007s (~)0.858s151.00x
💻 LocalExpress1.175s (-21.0% 🟢)2.005s (~)0.830s151.02x
💻 LocalNitro1.197s (-26.6% 🟢)2.006s (-3.3%)0.809s151.04x
🐘 PostgresNext.js (Turbopack)1.213s2.008s0.795s151.06x
💻 LocalNext.js (Turbopack)1.289s2.006s0.717s151.12x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro5.022s (+78.2% 🔺)6.611s (+53.0% 🔺)1.590s51.00x
▲ VercelExpress5.473s (+91.4% 🔺)7.608s (+64.6% 🔺)2.135s41.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.224s (-48.2% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNitro1.224s (-47.9% 🟢)2.006s (-33.3% 🟢)0.782s151.00x
🐘 PostgresNext.js (Turbopack)1.376s2.008s0.631s151.12x
💻 LocalExpress1.743s (-41.0% 🟢)2.005s (-41.9% 🟢)0.262s151.42x
💻 LocalNitro1.755s (-44.2% 🟢)2.006s (-48.4% 🟢)0.251s151.43x
💻 LocalNext.js (Turbopack)1.769s2.149s0.380s141.45x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.028s (+38.9% 🔺)6.726s (+31.6% 🔺)1.698s61.00x
▲ VercelNitro5.572s (+37.5% 🔺)7.208s (+21.7% 🔺)1.636s51.11x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.369s (-60.7% 🟢)2.007s (-50.0% 🟢)0.638s151.00x
🐘 PostgresNitro1.370s (-60.6% 🟢)2.007s (-49.9% 🟢)0.636s151.00x
🐘 PostgresNext.js (Turbopack)1.635s2.007s0.371s151.19x
💻 LocalNext.js (Turbopack)4.663s5.154s0.491s73.41x
💻 LocalNitro5.177s (-38.0% 🟢)5.679s (-37.0% 🟢)0.503s63.78x
💻 LocalExpress5.194s (-37.7% 🟢)5.513s (-38.9% 🟢)0.319s63.79x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.029s (+65.8% 🔺)8.709s (+42.1% 🔺)1.679s41.00x
▲ VercelNitro8.935s (+153.4% 🔺)10.556s (+90.7% 🔺)1.621s31.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.148s (-8.7% 🟢)2.007s (~)0.859s151.00x
🐘 PostgresExpress1.152s (-8.3% 🟢)2.007s (~)0.855s151.00x
🐘 PostgresNext.js (Turbopack)1.214s2.006s0.793s151.06x
💻 LocalNext.js (Turbopack)1.353s2.005s0.653s151.18x
💻 LocalNitro1.433s (-23.2% 🟢)2.006s (-14.3% 🟢)0.573s151.25x
💻 LocalExpress1.441s (-23.9% 🟢)2.006s (-15.1% 🟢)0.564s151.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.577s (+38.6% 🔺)5.207s (+19.7% 🔺)1.630s61.00x
▲ VercelNitro4.549s (+85.0% 🔺)6.211s (+49.0% 🔺)1.662s61.27x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.215s (-48.1% 🟢)2.009s (-33.3% 🟢)0.794s151.00x
🐘 PostgresNitro1.247s (-46.7% 🟢)2.009s (-33.3% 🟢)0.761s151.03x
🐘 PostgresNext.js (Turbopack)1.363s2.008s0.645s151.12x
💻 LocalNitro1.967s (-35.8% 🟢)2.469s (-36.5% 🟢)0.503s131.62x
💻 LocalExpress1.979s (-36.8% 🟢)2.392s (-36.4% 🟢)0.413s131.63x
💻 LocalNext.js (Turbopack)1.998s2.675s0.678s121.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro4.851s (+50.0% 🔺)6.263s (+23.4% 🔺)1.413s51.00x
▲ VercelExpress5.603s (+75.5% 🔺)7.182s (+49.9% 🔺)1.579s51.16x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.366s (-61.0% 🟢)2.008s (-49.9% 🟢)0.641s151.00x
🐘 PostgresNitro1.403s (-59.7% 🟢)2.007s (-49.9% 🟢)0.604s151.03x
🐘 PostgresNext.js (Turbopack)1.638s2.007s0.369s151.20x
💻 LocalNext.js (Turbopack)4.981s5.680s0.699s63.65x
💻 LocalNitro5.479s (-40.1% 🟢)6.214s (-38.0% 🟢)0.734s54.01x
💻 LocalExpress5.612s (-36.2% 🟢)6.214s (-33.0% 🟢)0.602s54.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express7.939s (+23.7% 🔺)10.418s (+27.4% 🔺)2.479s41.00x
▲ VercelNitro8.342s (+63.8% 🔺)9.730s (+42.7% 🔺)1.389s41.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.450s (-46.4% 🟢)1.006s (-1.6%)0.557s601.00x
🐘 PostgresNitro0.452s (-45.0% 🟢)1.006s (~)0.554s601.00x
💻 LocalNitro0.462s (-52.9% 🟢)1.004s (-8.2% 🟢)0.542s601.03x
💻 LocalExpress0.467s (-52.5% 🟢)1.004s (-6.7% 🟢)0.537s601.04x
🐘 PostgresNext.js (Turbopack)0.676s1.007s0.331s601.50x
💻 LocalNext.js (Turbopack)0.727s1.004s0.278s601.62x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express5.163s (-72.8% 🟢)7.100s (-66.7% 🟢)1.938s91.00x
▲ VercelNitro6.750s (-69.4% 🟢)8.352s (-65.2% 🟢)1.602s81.31x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.045s (-47.1% 🟢)1.523s (-32.6% 🟢)0.478s601.00x
🐘 PostgresNitro1.082s (-43.8% 🟢)1.705s (-18.8% 🟢)0.622s531.04x
💻 LocalNitro1.183s (-61.0% 🟢)2.006s (-46.6% 🟢)0.823s451.13x
💻 LocalExpress1.191s (-60.5% 🟢)2.005s (-44.1% 🟢)0.814s451.14x
🐘 PostgresNext.js (Turbopack)1.602s2.007s0.405s451.53x
💻 LocalNext.js (Turbopack)1.814s2.006s0.192s451.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express13.163s (-61.9% 🟢)15.281s (-58.5% 🟢)2.117s61.00x
▲ VercelNitro13.845s (-64.9% 🟢)15.606s (-62.2% 🟢)1.761s61.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.041s (-50.3% 🟢)2.477s (-46.2% 🟢)0.436s491.00x
🐘 PostgresExpress2.090s (-47.6% 🟢)2.638s (-39.6% 🟢)0.548s461.02x
💻 LocalNitro2.660s (-71.4% 🟢)3.008s (-70.0% 🟢)0.348s401.30x
💻 LocalExpress2.681s (-70.9% 🟢)3.032s (-69.7% 🟢)0.352s401.31x
🐘 PostgresNext.js (Turbopack)3.154s4.009s0.855s301.55x
💻 LocalNext.js (Turbopack)3.855s4.075s0.220s301.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express40.673s (-68.7% 🟢)42.850s (-67.6% 🟢)2.177s31.00x
▲ VercelNitro41.417s (-57.3% 🟢)43.192s (-56.1% 🟢)1.776s31.02x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.177s (-37.2% 🟢)1.007s (~)0.829s601.00x
🐘 PostgresNitro0.189s (-33.3% 🟢)1.006s (~)0.817s601.07x
🐘 PostgresNext.js (Turbopack)0.237s1.006s0.770s601.33x
💻 LocalExpress0.428s (-23.6% 🟢)1.004s (~)0.576s602.41x
💻 LocalNitro0.456s (-24.6% 🟢)1.004s (-1.7%)0.548s602.57x
💻 LocalNext.js (Turbopack)0.568s1.004s0.436s603.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.570s (+54.7% 🔺)4.071s (+21.5% 🔺)1.501s151.00x
▲ VercelExpress2.703s (+38.3% 🔺)4.438s (+22.0% 🔺)1.735s141.05x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.303s (-40.5% 🟢)1.007s (~)0.703s901.00x
🐘 PostgresNitro0.316s (-36.3% 🟢)1.006s (~)0.690s901.04x
🐘 PostgresNext.js (Turbopack)0.459s1.006s0.547s901.51x
💻 LocalExpress2.171s (-13.6% 🟢)2.796s (-7.1% 🟢)0.625s337.16x
💻 LocalNext.js (Turbopack)2.175s3.010s0.835s307.17x
💻 LocalNitro2.239s (-11.8% 🟢)2.944s (-2.2%)0.705s317.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro8.771s (+171.9% 🔺)10.519s (+118.2% 🔺)1.747s91.00x
▲ VercelExpress9.600s (+215.1% 🔺)12.351s (+156.9% 🔺)2.751s81.09x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Nitro | Express

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.622s (-24.0% 🟢)1.006s (-1.1%)0.383s1201.00x
🐘 PostgresNitro0.640s (-19.0% 🟢)1.006s (~)0.365s1201.03x
🐘 PostgresNext.js (Turbopack)0.967s1.466s0.499s831.55x
💻 LocalNitro10.059s (-10.1% 🟢)10.531s (-9.7% 🟢)0.472s1216.16x
💻 LocalExpress10.208s (-8.8% 🟢)10.696s (-10.4% 🟢)0.488s1216.40x
💻 LocalNext.js (Turbopack)11.327s11.939s0.612s1118.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.654s (+205.3% 🔺)24.859s (+168.9% 🔺)2.205s61.00x
▲ VercelNitro24.155s (+212.8% 🔺)26.342s (+180.2% 🔺)2.187s51.07x
▲ VercelNext.js (Turbopack)⚠️missing----

🔍 Observability: Express | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.131s (+429.4% 🔺)2.005s (+99.6% 🔺)0.012s (-2.4%)2.019s (+98.2% 🔺)0.888s101.00x
🐘 PostgresNitro1.133s (+452.4% 🔺)2.001s (+100.1% 🔺)0.001s (-13.3% 🟢)2.010s (+98.7% 🔺)0.877s101.00x
🐘 PostgresExpress1.133s (+452.7% 🔺)1.998s (+100.1% 🔺)0.001s (-31.3% 🟢)2.009s (+98.7% 🔺)0.876s101.00x
💻 LocalExpress1.134s (+469.7% 🔺)2.005s (+99.6% 🔺)0.012s (+0.8%)2.019s (+98.3% 🔺)0.885s101.00x
💻 LocalNext.js (Turbopack)1.186s2.003s0.011s2.017s0.831s101.05x
🐘 PostgresNext.js (Turbopack)1.198s2.002s0.002s2.012s0.814s101.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.433s (-36.5% 🟢)3.428s (-35.0% 🟢)2.381s (+220.8% 🔺)6.286s (-3.0%)3.853s101.00x
▲ VercelExpress2.493s (~)3.666s (-10.4% 🟢)2.778s (+189.1% 🔺)6.958s (+24.5% 🔺)4.465s101.02x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.490s (+136.5% 🔺)2.006s (+99.3% 🔺)0.004s (+0.9%)2.028s (+98.2% 🔺)0.537s301.00x
🐘 PostgresNitro1.515s (+142.7% 🔺)2.004s (+99.0% 🔺)0.004s (-6.5% 🟢)2.026s (+98.1% 🔺)0.511s301.02x
💻 LocalNitro1.527s (+82.1% 🔺)2.010s (+98.7% 🔺)0.010s (+7.8% 🔺)2.023s (+81.2% 🔺)0.496s301.02x
🐘 PostgresNext.js (Turbopack)1.693s2.010s0.004s2.027s0.334s301.14x
💻 LocalNext.js (Turbopack)1.846s2.009s0.011s2.201s0.355s281.24x
💻 LocalExpress1.926s (+154.4% 🔺)2.012s (+95.5% 🔺)0.010s (+4.5%)2.424s (+133.1% 🔺)0.498s251.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.501s (-77.9% 🟢)7.965s (-74.1% 🟢)0.254s (+126.5% 🔺)8.704s (-72.6% 🟢)2.203s71.00x
▲ VercelExpress6.740s (+3.6%)8.086s (+1.0%)0.308s (-24.6% 🟢)8.933s (+1.1%)2.193s71.04x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.657s (-32.2% 🟢)1.032s (-17.3% 🟢)0.000s (-17.2% 🟢)1.050s (-16.5% 🟢)0.392s581.00x
🐘 PostgresExpress0.660s (-31.3% 🟢)1.030s (-19.4% 🟢)0.000s (+19.0% 🔺)1.049s (-19.7% 🟢)0.389s581.00x
🐘 PostgresNext.js (Turbopack)0.794s1.072s0.000s1.079s0.285s561.21x
💻 LocalNitro1.361s (+11.3% 🔺)2.015s (~)0.000s (+133.3% 🔺)2.017s (~)0.656s302.07x
💻 LocalExpress1.361s (+11.2% 🔺)2.016s (~)0.001s (+60.0% 🔺)2.018s (~)0.657s302.07x
💻 LocalNext.js (Turbopack)1.480s2.014s0.000s2.017s0.537s302.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.891s (+27.5% 🔺)5.190s (+18.2% 🔺)0.000s (+254.5% 🔺)5.758s (+19.7% 🔺)1.868s111.00x
▲ VercelExpress4.219s (+12.8% 🔺)5.581s (+9.4% 🔺)0.002s (+1000.0% 🔺)6.074s (+9.8% 🔺)1.855s111.08x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Nitro | Express

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.232s (-30.5% 🟢)1.998s (-8.3% 🟢)0.000s (+Infinity% 🔺)2.015s (-8.4% 🟢)0.783s301.00x
🐘 PostgresNitro1.273s (-28.9% 🟢)2.029s (-5.3% 🟢)0.000s (-6.7% 🟢)2.045s (-6.0% 🟢)0.771s301.03x
🐘 PostgresNext.js (Turbopack)1.610s2.110s0.000s2.145s0.534s281.31x
💻 LocalNext.js (Turbopack)2.878s3.416s0.000s3.424s0.545s182.34x
💻 LocalNitro3.083s (-9.0% 🟢)3.905s (-3.2%)0.000s (-64.8% 🟢)3.907s (-3.2%)0.824s162.50x
💻 LocalExpress3.168s (-8.6% 🟢)3.966s (-1.7%)0.001s (-6.3% 🟢)3.968s (-1.7%)0.800s162.57x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express6.633s (+44.6% 🔺)8.145s (+35.3% 🔺)0.001s (+Infinity% 🔺)8.706s (+34.8% 🔺)2.073s71.00x
▲ VercelNitro7.121s (+73.9% 🔺)8.227s (+53.1% 🔺)0.000s (-47.6% 🟢)8.712s (+50.4% 🔺)1.591s71.07x
▲ VercelNext.js (Turbopack)⚠️missing-----

🔍 Observability: Express | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro12/21
🐘 PostgresExpress16/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres15/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: success
  • Vercel: failure

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a flaky race during @workflow/world-postgres startup where concurrent processes can both attempt graphile-worker schema installation on a fresh database, triggering duplicate key value violates unique constraint "pg_namespace_nspname_index".

Changes:

  • Serialize graphile-worker bootstrap (makeWorkerUtils + migrate) using a Postgres advisory lock in packages/world-postgres/src/queue.ts.
  • Update unit test pool mocks to include pool.connect() to match the new startup path.
  • Add a changeset documenting the patch release.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

FileDescription
packages/world-postgres/src/queue.tsAdds transaction-scoped advisory lock wrapper around graphile-worker bootstrap to avoid concurrent schema install races.
packages/world-postgres/src/queue.test.tsUpdates pool mock to include connect() for the new locking code path.
packages/world-postgres/src/reenqueue.test.tsUpdates pool mock to include connect() for the new locking code path.
.changeset/fix-world-postgres-graphile-bootstrap-race.mdDeclares a patch release and describes the race/lock fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/world-postgres/src/queue.ts Outdated
Comment threadpackages/world-postgres/src/queue.ts Outdated
- Release the locked connection before makeWorkerUtils() so the
bootstrap can't deadlock against the same pool when maxPoolSize is
small (Copilot review #1). Achieved by replicating graphile-worker's
installSchema DDL ourselves under the lock; once the schema exists
graphile-worker's own installSchema is a no-op.
- Add a unit test that asserts the lock-ordering: pool.connect -> BEGIN
-> pg_advisory_xact_lock -> CREATE SCHEMA -> COMMIT -> release ->
makeWorkerUtils (Copilot review #2).

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not convinced we should duplicate migration code in the queue file and use a lock for this

"@workflow/world-postgres": patch
---

Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()` callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS` and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Pre-create the `graphile_worker` schema under a Postgres advisory lock so concurrent `world.start()`callers (e.g. dev server + test runner, or multiple serverless invocations) don't race on the not-race-safe `CREATE SCHEMA IF NOT EXISTS`and fail with `duplicate key value violates unique constraint "pg_namespace_nspname_index"`. The lock is held on a short-lived dedicated connection that is released before `makeWorkerUtils()` runs so the bootstrap can't deadlock against the same pool when its max size is small.
Ensure concurrent `world.start()`calls don't race on `CREATE SCHEMA IF NOT EXISTS`by using a lock. Fixes `duplicate key value violates unique constraint "pg_namespace_nspname_index"` errors.

@TooTallNate

Copy link
Copy Markdown
MemberAuthor

Closing in favor of #2019 — Peter's approach pre-bootstraps the graphile_worker schema in workflow-postgres-setup (the CLI that CI already runs once before any consumer process), which eliminates the race window entirely without touching the production hot path. Cleaner fix; 23 lines vs 135 here.

See #2019 (review) for the full comparison.

@TooTallNate
TooTallNate deleted the fix-world-postgres-graphile-bootstrap-race branch May 19, 2026 16:47
Sign up for freeto 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.

3 participants

@TooTallNate@VaguelySerious