Files
joshua-spacetime 5c6f308b74 Add distributed typescript benchmark harness (#4698)
# Description of Changes

The current keynote-2 benchmarks pipelines operations via
`MAX_INFLIGHT_PER_WORKER` in order to simulate a large number of client
connections while running the benchmark locally or on a single machine.

This patch adds a distributed benchmark mode for `templates/keynote-2`
so explicit SpacetimeDB client connections can be spread across multiple
machines without changing the existing single-process benchmark flow.

This is a pure extension. `npm run bench` and the current
`src/core/runner.ts` path remain intact. The new distributed path adds a
small coordinator/generator/control-plane harness specifically for
multi-machine ts client runs.

- New CLI entry points `bench-dist-coordinator`, `bench-dist-generator`,
and `bench-dist-control` were added
- The coordinator defines the benchmark window
- Generators begin submitting requests during warmup, but warmup
transactions are excluded from TPS
- Throughput is measured from the server-side committed transfer
counter, not client-local TPS
- Each connection runs closed-loop with one request at a time in this
distributed mode
- Connection startup is bounded-parallel (`--open-parallelism`) to avoid
a connection storm
- Verification is run by the coordinator after the epoch
- Late generators can be registered after a run to increase load on the
server incrementally
- If a participating generator dies and never sends `/stopped`, the
epoch result is flagged with an error so the run can be retried cleanly

See `DEVELOP.md` for instructions on how to run.

# API and ABI breaking changes

N/A

# Expected complexity level and risk

3

# Testing

Manual
2026-03-25 06:29:45 +00:00

48 lines
1.3 KiB
JSON

{
"name": "spacetime-simulations",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"demo": "tsx src/demo.ts",
"dev": "vite",
"build": "tsc",
"preview": "vite preview",
"prep": "tsx src/init/init-all.ts",
"down": "docker compose down || exit 0",
"test-1": "tsx src/cli.ts test-1",
"bench": "tsx src/cli.ts",
"bench-dist-coordinator": "tsx src/distributed/coordinator.ts",
"bench-dist-generator": "tsx src/distributed/generator.ts",
"bench-dist-control": "tsx src/distributed/control.ts"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.13",
"@types/bun": "^1.3.2",
"@types/express": "^5.0.5",
"@types/pg": "^8.15.6",
"@types/sql.js": "^1.4.9",
"bun-types": "^1.3.2",
"convex": "^1.29.0",
"dotenv": "^17.2.3",
"node-gyp": "^12.1.0",
"pg": "^8.16.3",
"prettier": "^3.3.1",
"tsx": "^4.20.6",
"typescript": "^5.9.3"
},
"dependencies": {
"@convex-dev/sharded-counter": "^0.2.0",
"@supabase/supabase-js": "^2.80.0",
"better-sqlite3": "^12.4.1",
"bun": "^1.3.2",
"cac": "^7.0.0",
"drizzle-orm": "^0.44.7",
"express": "^5.1.0",
"hdr-histogram-js": "^3.0.1",
"spacetimedb": "workspace:^",
"sql.js": "^1.13.0",
"undici": "^6.19.2"
}
}