Skip to content

Add distributed typescript benchmark harness#4698

Merged
joshua-spacetime merged 5 commits intomasterfrom
joshua/keynote-2-dist-bench
Mar 25, 2026
Merged

Add distributed typescript benchmark harness#4698
joshua-spacetime merged 5 commits intomasterfrom
joshua/keynote-2-dist-bench

Conversation

@joshua-spacetime
Copy link
Copy Markdown
Collaborator

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

@joshua-spacetime joshua-spacetime force-pushed the joshua/keynote-2-dist-bench branch 2 times, most recently from a7f5baa to 91d526d Compare March 24, 2026 03:36
@joshua-spacetime joshua-spacetime force-pushed the joshua/keynote-2-dist-bench branch from 934f0ad to 4134efb Compare March 25, 2026 04:12
@joshua-spacetime joshua-spacetime added this pull request to the merge queue Mar 25, 2026
Merged via the queue into master with commit 5c6f308 Mar 25, 2026
32 of 33 checks passed
@joshua-spacetime joshua-spacetime deleted the joshua/keynote-2-dist-bench branch March 25, 2026 14:35
github-merge-queue Bot pushed a commit that referenced this pull request Apr 17, 2026
# Description of Changes

Refresh this stale PR against current `master`. Several original items
were already applied upstream or conflict with recent keynote-2 work
(#4616, #4647, #4678, #4682, #4698, #4703, #4743, #4745, #4753, #4757),
so those are dropped. What remains is the still-relevant subset, rebased
onto the current file structures.

**README.md:**
- Use `pnpm run demo` in Quick Demo (consistency with pnpm workspace)
- Add `--concurrency` and `--alpha` to demo options
- Add `--` separator to `docker compose run` bench example
- Fix hardware config punctuation (add comma before "OS:")
- Remove redundant Quick Start section; replace with link to DEVELOP.md
for prerequisites and CLI reference
- Add symlink for license

**DEVELOP.md:**
- Use `pnpm run` throughout (demo, prep, bench) instead of `npm run`
- Drop the `-- ` pass-through after `pnpm run bench` (not needed with
pnpm; matches the `#4703` testing examples)
- Add Rust to Prerequisites
- Add explicit list of valid connector names (`convex`, `spacetimedb`,
`bun`, `postgres_rpc`, `cockroach_rpc`, `sqlite_rpc`, `supabase_rpc`,
`planetscale_pg_rpc`)
- Update CLI reference defaults to match methodology (seconds: 1→10,
concurrency: 10→50)
- Condense `docker compose run` bench example to a single line with `--`
separator; fix `npm prep` → `pnpm run prep`

**src/opts.ts:** (CLI parsing moved here in `#4703`; original PR
targeted the now-gone inline parsers in `cli.ts`/`demo.ts`)
- `parseBenchOptions`: bench `--seconds` default `1` → `10`
- `parseDemoOptions`: demo `--concurrency` default `10` → `50`

**.env.example:**
- Comment out `USE_DOCKER=1` and `SKIP_CONVEX=1` so demo defaults
(convex, spacetimedb) work out of the box
- Comment out `CONVEX_USE_SHARDED_COUNTER=1` (still a supported knob,
just off by default)

# Dropped as superseded by master

- Rust Client README section tweaks (heading capitalization,
`bottlnecked`/`then` typo fixes) — section was removed by `#4753`
- Rename `SPACETIME_METRICS_ENDPOINT` → `USE_SPACETIME_METRICS_ENDPOINT`
— master's `src/config.ts` still reads the original name
- Connector-name fixes in examples (`sqlite` → `sqlite_rpc`, `postgres`
→ `postgres_rpc`) — already corrected on master

# API and ABI breaking changes

None.

# Expected complexity level and risk

**1** – Documentation and default-value changes. No functional changes
to core logic.

# Testing

- [x] `pnpm install` in `templates/keynote-2/` succeeds
- [x] `pnpm run bench --help` / `pnpm run demo --help` render with
valid-connec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants