Skip to content

Commit 3875887

Browse files
committed
run benchmarks for both postgres drivers
Signed-off-by: Alex Holovach <[email protected]>
1 parent e3d8917 commit 3875887

File tree

2 files changed

+58
-16
lines changed

2 files changed

+58
-16
lines changed

.github/scripts/aggregate-benchmarks.js

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const [, , resultsDir = '.'] = process.argv;
99
const backendConfig = {
1010
local: { emoji: '💻', label: 'Local' },
1111
postgres: { emoji: '🐘', label: 'Postgres' },
12+
'postgres-pgboss': { emoji: '🐘', label: 'Postgres (pg-boss)' },
13+
'postgres-graphile': { emoji: '🐘', label: 'Postgres (graphile)' },
1214
vercel: { emoji: '▲', label: 'Vercel' },
1315
};
1416

@@ -49,9 +51,35 @@ function findBenchmarkFiles(dir) {
4951
// Parse filename to extract app and backend
5052
function parseFilename(filename) {
5153
// Format: bench-results-{app}-{backend}.json
52-
const match = filename.match(/bench-results-(.+)-(\w+)\.json$/);
53-
if (!match) return null;
54-
return { app: match[1], backend: match[2] };
54+
// Backend can be: local, postgres, postgres-pgboss, postgres-graphile, vercel
55+
const knownBackends = [
56+
'postgres-pgboss',
57+
'postgres-graphile',
58+
'postgres',
59+
'local',
60+
'vercel',
61+
];
62+
63+
const baseName = filename
64+
.replace(/\.json$/, '')
65+
.replace(/^bench-results-/, '');
66+
if (!baseName) return null;
67+
68+
// Try each known backend (longest first to match postgres-pgboss before postgres)
69+
for (const backend of knownBackends) {
70+
if (baseName.endsWith(`-${backend}`)) {
71+
const app = baseName.slice(0, -(backend.length + 1));
72+
return { app, backend };
73+
}
74+
}
75+
76+
// Fallback: last segment after hyphen
77+
const lastHyphen = baseName.lastIndexOf('-');
78+
if (lastHyphen === -1) return null;
79+
return {
80+
app: baseName.slice(0, lastHyphen),
81+
backend: baseName.slice(lastHyphen + 1),
82+
};
5583
}
5684

5785
// Load timing data for a benchmark file
@@ -147,11 +175,20 @@ function getAppsAndBackends(data) {
147175
}
148176
}
149177

150-
// Sort: local, postgres, vercel for backends
151-
const backendOrder = ['local', 'postgres', 'vercel'];
152-
const sortedBackends = [...backends].sort(
153-
(a, b) => backendOrder.indexOf(a) - backendOrder.indexOf(b)
154-
);
178+
// Sort: local, postgres variants, vercel for backends
179+
const backendOrder = [
180+
'local',
181+
'postgres',
182+
'postgres-pgboss',
183+
'postgres-graphile',
184+
'vercel',
185+
];
186+
const sortedBackends = [...backends].sort((a, b) => {
187+
const aIdx = backendOrder.indexOf(a);
188+
const bIdx = backendOrder.indexOf(b);
189+
// Unknown backends go to the end
190+
return (aIdx === -1 ? 999 : aIdx) - (bIdx === -1 ? 999 : bIdx);
191+
});
155192

156193
// Sort apps alphabetically
157194
const sortedApps = [...apps].sort();
@@ -348,7 +385,10 @@ function renderComparison(data) {
348385
console.log('');
349386
console.log('**Backends:**');
350387
console.log('- 💻 Local: In-memory filesystem backend');
351-
console.log('- 🐘 Postgres: PostgreSQL database backend');
388+
console.log('- 🐘 Postgres (pg-boss): PostgreSQL with pg-boss queue driver');
389+
console.log(
390+
'- 🐘 Postgres (graphile): PostgreSQL with Graphile Worker queue driver'
391+
);
352392
console.log('- ▲ Vercel: Vercel production backend');
353393
console.log('</details>');
354394
}

.github/workflows/benchmarks.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
140140
# Phase 2b: Postgres benchmarks (with postgres service)
141141
benchmark-postgres:
142-
name: Benchmark Postgres (${{ matrix.app }})
142+
name: Benchmark Postgres/${{ matrix.queue-driver }} (${{ matrix.app }})
143143
runs-on: ubuntu-latest
144144
needs: build
145145
timeout-minutes: 30
@@ -148,6 +148,7 @@ jobs:
148148
matrix:
149149
# Note: Use actual directory names, not symlinks (nitro -> nitro-v3)
150150
app: [nextjs-turbopack, nitro-v3, express]
151+
queue-driver: [pgboss, graphile]
151152

152153
services:
153154
postgres:
@@ -169,6 +170,7 @@ jobs:
169170
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
170171
WORKFLOW_TARGET_WORLD: "@workflow/world-postgres"
171172
WORKFLOW_POSTGRES_URL: "postgres://world:world@localhost:5432/world"
173+
WORKFLOW_QUEUE_DRIVER: ${{ matrix.queue-driver }}
172174

173175
steps:
174176
- uses: actions/checkout@v4
@@ -207,22 +209,22 @@ jobs:
207209
echo "Waiting for server to start..."
208210
sleep 15
209211
cd ../..
210-
pnpm vitest bench packages/core/e2e/bench.bench.ts --run --outputJson=bench-results-${{ matrix.app }}-postgres.json
212+
pnpm vitest bench packages/core/e2e/bench.bench.ts --run --outputJson=bench-results-${{ matrix.app }}-postgres-${{ matrix.queue-driver }}.json
211213
212214
- name: Render benchmark results
213215
uses: ./.github/actions/render-benchmarks
214216
with:
215-
benchmark-file: bench-results-${{ matrix.app }}-postgres.json
217+
benchmark-file: bench-results-${{ matrix.app }}-postgres-${{ matrix.queue-driver }}.json
216218
app-name: ${{ matrix.app }}
217-
backend: postgres
219+
backend: postgres-${{ matrix.queue-driver }}
218220

219221
- name: Upload benchmark results
220222
uses: actions/upload-artifact@v4
221223
with:
222-
name: bench-results-${{ matrix.app }}-postgres
224+
name: bench-results-${{ matrix.app }}-postgres-${{ matrix.queue-driver }}
223225
path: |
224-
bench-results-${{ matrix.app }}-postgres.json
225-
bench-timings-${{ matrix.app }}-postgres.json
226+
bench-results-${{ matrix.app }}-postgres-${{ matrix.queue-driver }}.json
227+
bench-timings-${{ matrix.app }}-postgres-${{ matrix.queue-driver }}.json
226228
227229
# Phase 2c: Vercel benchmarks (needs build artifacts for packages)
228230
benchmark-vercel:

0 commit comments

Comments
 (0)