Skip to content

Commit eb0645c

Browse files
Remove distributed benchmark harness (#4967)
# Description of Changes Never used # API and ABI breaking changes N/A # Expected complexity level and risk 0 # Testing N/A
1 parent 0267392 commit eb0645c

23 files changed

Lines changed: 11 additions & 1866 deletions

templates/keynote-2/.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#SKIP_SQLITE=1 # 1 = don't init SQLite in prep
66
#SKIP_SUPABASE=1 # 1 = don't init Supabase in prep
77
#SKIP_CONVEX=1 # 1 = don't init Convex in prep
8-
SPACETIME_METRICS_ENDPOINT=0
98

109
# ===== PostgreSQL =====
1110
POSTGRES_USER=postgres

templates/keynote-2/DEVELOP.md

Lines changed: 3 additions & 186 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ Copy `.env.example` to `.env` and adjust.
7575
- `SKIP_SQLITE``1` = don't init SQLite in prep
7676
- `SKIP_SUPABASE``1` = don't init Supabase in prep
7777
- `SKIP_CONVEX``1` = don't init Convex in prep
78-
- `SPACETIME_METRICS_ENDPOINT``1` = read committed transfer counts from the derived SpacetimeDB metrics endpoint; otherwise only local counters are used
78+
79+
Throughput is counted from successful operations that the benchmark client observes completing inside the configured test window for every connector, including SpacetimeDB.
7980

8081
**PostgreSQL / CockroachDB:**
8182

@@ -166,7 +167,7 @@ cd ..
166167

167168
## Commands & Examples
168169

169-
### 1. Run a test
170+
### Run a test
170171

171172
```bash
172173
pnpm run bench [test-name] [--seconds N] [--concurrency N] [--alpha A] [--connectors list] [--stdb-compression none|gzip]
@@ -194,190 +195,6 @@ pnpm run bench test-1 --connectors spacetimedb --stdb-compression gzip
194195
pnpm run bench test-1 --connectors spacetimedb,sqlite_rpc
195196
```
196197

197-
### 2. Run the distributed TypeScript SpacetimeDB benchmark
198-
199-
Use this mode when you want to spread explicit TypeScript client connections across multiple machines. The existing `pnpm run bench` flow is still the single-process benchmark; the distributed flow is a separate coordinator + generator setup.
200-
201-
The commands below are written so they run unchanged on a single machine. For a true multi-machine run, replace `127.0.0.1` with the actual coordinator and server hostnames or IP addresses reachable from each generator machine.
202-
203-
#### Machine roles
204-
205-
- **Server machine**: runs SpacetimeDB and hosts the benchmarked module.
206-
- **Coordinator machine**: runs `bench-dist-coordinator` and `bench-dist-control`. It may also run one or more generators if you want.
207-
- **Generator machines**: run `bench-dist-generator`. You can run multiple generator processes on the same machine as long as each one has a unique `--id`.
208-
209-
#### Distributed setup
210-
211-
All coordinator and generator machines should use the same `templates/keynote-2` checkout and have dependencies installed:
212-
213-
```bash
214-
cd templates/keynote-2
215-
pnpm install
216-
cp .env.example .env
217-
```
218-
219-
Generate TypeScript bindings in that checkout on each machine that will run the coordinator or a generator:
220-
221-
```bash
222-
spacetime generate --lang typescript --out-dir module_bindings --module-path ./spacetimedb
223-
```
224-
225-
#### Step 1: Start the server
226-
227-
On the **server machine**:
228-
229-
```bash
230-
spacetime start
231-
```
232-
233-
#### Step 2: Publish the module and seed the accounts
234-
235-
On any machine with the repo checkout and CLI access to the server, publish the module and seed the database once before starting the distributed run:
236-
237-
```bash
238-
cd templates/keynote-2
239-
240-
export STDB_URL=ws://127.0.0.1:3000
241-
export STDB_MODULE=test-1
242-
export STDB_MODULE_PATH=./spacetimedb
243-
244-
spacetime publish -c -y --server local --module-path "$STDB_MODULE_PATH" "$STDB_MODULE"
245-
spacetime call --server local "$STDB_MODULE" seed 100000 10000000
246-
```
247-
248-
If you are using a named server instead of `local`, replace `--server local` with the correct server name.
249-
250-
#### Step 3: Start the coordinator
251-
252-
On the **coordinator machine**:
253-
254-
```bash
255-
cd templates/keynote-2
256-
257-
pnpm run bench-dist-coordinator -- \
258-
--test test-1 \
259-
--connector spacetimedb \
260-
--window-seconds 30 \
261-
--verify 1 \
262-
--stdb-url ws://127.0.0.1:3000 \
263-
--stdb-module test-1 \
264-
--stdb-compression none \
265-
--bind 127.0.0.1 \
266-
--port 8080
267-
```
268-
269-
Notes:
270-
271-
- Before measurement begins, the coordinator waits for every participating generator to start its epoch and acknowledge that it is running.
272-
- `--window-seconds` is the measured interval.
273-
- `--verify 1` preserves the existing benchmark semantics by running one verification pass centrally after the epoch completes.
274-
- If a generator never acknowledges start, the coordinator fails the epoch after `--start-ack-timeout-seconds` seconds. The default is `60`.
275-
- The coordinator derives the HTTP metrics endpoint from `--stdb-url` by switching to `http://` or `https://` and appending `/v1/metrics`.
276-
- For a real multi-machine run, change `--bind 127.0.0.1` to `--bind 0.0.0.0` so remote generators can reach the coordinator.
277-
- For a real multi-machine run, set `--stdb-url` to the server machine's reachable address.
278-
279-
#### Step 4: Start generators on one or more client machines
280-
281-
On **generator machine 1**:
282-
283-
```bash
284-
cd templates/keynote-2
285-
286-
pnpm run bench-dist-generator -- \
287-
--id gen-a \
288-
--coordinator-url http://127.0.0.1:8080 \
289-
--test test-1 \
290-
--connector spacetimedb \
291-
--concurrency 2500 \
292-
--accounts 100000 \
293-
--alpha 1.5 \
294-
--open-parallelism 128 \
295-
--control-retries 3 \
296-
--stdb-url ws://127.0.0.1:3000 \
297-
--stdb-module test-1 \
298-
--stdb-compression none
299-
```
300-
301-
On **generator machine 2**:
302-
303-
```bash
304-
cd templates/keynote-2
305-
306-
pnpm run bench-dist-generator -- \
307-
--id gen-b \
308-
--coordinator-url http://127.0.0.1:8080 \
309-
--test test-1 \
310-
--connector spacetimedb \
311-
--concurrency 2500 \
312-
--accounts 100000 \
313-
--alpha 1.5 \
314-
--open-parallelism 128 \
315-
--control-retries 3 \
316-
--stdb-url ws://127.0.0.1:3000 \
317-
--stdb-module test-1 \
318-
--stdb-compression none
319-
```
320-
321-
Repeat that on as many generator machines as needed, adjusting `--id` and `--concurrency` for each process.
322-
For a real multi-machine run, replace `127.0.0.1` with the coordinator host in `--coordinator-url` and the SpacetimeDB server host in `--stdb-url`.
323-
324-
`--open-parallelism` controls connection ramp-up only. It deliberately avoids a connection storm by opening connections in bounded parallel batches.
325-
`--control-retries` sets the retry cap for `register`, `ready`, `/state`, and `/stopped`. The default is `3`.
326-
327-
#### Step 5: Confirm generators are ready
328-
329-
On the **coordinator machine**:
330-
331-
```bash
332-
cd templates/keynote-2
333-
334-
pnpm run bench-dist-control -- status --coordinator-url http://127.0.0.1:8080
335-
```
336-
337-
Wait until each generator shows `state=ready` and `opened=N/N`.
338-
339-
#### Step 6: Start an epoch
340-
341-
On the **coordinator machine**:
342-
343-
```bash
344-
cd templates/keynote-2
345-
346-
pnpm run bench-dist-control -- start-epoch --coordinator-url http://127.0.0.1:8080 --label run-1
347-
```
348-
349-
`start-epoch` waits for the epoch to finish, then prints the final result.
350-
351-
#### Step 7: Check results
352-
353-
Each completed epoch writes one JSON result file on the coordinator machine under:
354-
355-
```text
356-
templates/keynote-2/runs/distributed/
357-
```
358-
359-
The result contains:
360-
361-
- participating generator IDs
362-
- total participating connections
363-
- committed transaction delta from the server metrics endpoint
364-
- measured window duration
365-
- computed TPS
366-
- verification result
367-
368-
#### Operational notes
369-
370-
- Start the coordinator before the generators.
371-
- Generators begin submitting requests when the coordinator enters `starting`.
372-
- Throughput is measured only from the committed transaction counter delta recorded after all participating generators have acknowledged start, so startup traffic is excluded.
373-
- For this distributed TypeScript mode, each connection runs closed-loop with one request at a time. There is no pipelining in this flow.
374-
- Late generators are allowed to register and become ready while an epoch is already running, but they only participate in the next epoch.
375-
- The coordinator does not use heartbeats. It includes generators that most recently reported `ready`.
376-
- If a participating generator dies and never sends `/stopped`, the epoch result is written with an `error`, and that generator remains `running` in coordinator status until you restart it and let it register again.
377-
- You can run multiple generator processes on the same machine if you want to test the harness locally. Just make sure each process uses a unique `--id`.
378-
379-
---
380-
381198
## CLI Arguments
382199

383200
From `src/cli.ts`:

templates/keynote-2/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ All tests use 50 concurrent connections with a transfer workload (read-modify-wr
3535

3636
**Key Finding:** SpacetimeDB achieves **~14x higher throughput** than the next best option (SQLite RPC) and maintains nearly identical performance under high contention (only ~4% drop), while traditional databases suffer significant degradation (CockroachDB drops 96%).
3737

38-
> **Note:** SpacetimeDB runs on ARM architectures (including Apple M-series Macs), but has not yet been optimized for them.
39-
4038
### Contention Impact
4139

4240
![Contention Chart](./contention-chart.png)
@@ -69,6 +67,8 @@ Client → Integrated Platform (compute + storage colocated)
6967

7068
This ensures we're measuring real-world application performance, not raw database throughput.
7169

70+
Throughput is counted from successful operations that the benchmark client observes completing inside the configured test window for every system.
71+
7272
### The Transaction
7373

7474
Each transaction performs a **fund transfer** between two accounts:
@@ -175,7 +175,6 @@ PlanetScale results (~477 TPS) demonstrate the **significant impact of cloud dat
175175
## Running the Benchmarks
176176

177177
See [DEVELOP.md](./DEVELOP.md) for prerequisites, configuration, and full CLI reference.
178-
The distributed TypeScript SpacetimeDB workflow is documented there as `Run the distributed TypeScript SpacetimeDB benchmark`.
179178

180179
## Output
181180

templates/keynote-2/docker-compose-linux-raid-crdb.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@
174174
STDB_URL: ${STDB_URL}
175175
STDB_MODULE: ${STDB_MODULE}
176176
STDB_MODULE_PATH: ${STDB_MODULE_PATH}
177-
STDB_METRICS_URL: ${STDB_METRICS_URL}
178177
STDB_CONFIRMED_READS: ${STDB_CONFIRMED_READS}
179178
BUN_URL: ${BUN_URL}
180179
SQLITE_FILE: /data/accounts.sqlite
@@ -189,7 +188,6 @@
189188
PLANETSCALE_RPC_URL: ${PLANETSCALE_RPC_URL}
190189
SEED_ACCOUNTS: ${SEED_ACCOUNTS}
191190
SEED_INITIAL_BALANCE: ${SEED_INITIAL_BALANCE}
192-
USE_SPACETIME_METRICS_ENDPOINT: ${USE_SPACETIME_METRICS_ENDPOINT}
193191
CONVEX_USE_SHARDED_COUNTER: ${CONVEX_USE_SHARDED_COUNTER}
194192
VERIFY: ${VERIFY}
195193
volumes:

templates/keynote-2/docker-compose-linux-raid.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@
292292
STDB_URL: ${STDB_URL}
293293
STDB_MODULE: ${STDB_MODULE}
294294
STDB_MODULE_PATH: ${STDB_MODULE_PATH}
295-
STDB_METRICS_URL: ${STDB_METRICS_URL}
296295
STDB_CONFIRMED_READS: ${STDB_CONFIRMED_READS}
297296
BUN_URL: ${BUN_URL}
298297
SQLITE_FILE: /data/accounts.sqlite
@@ -307,7 +306,6 @@
307306
PLANETSCALE_RPC_URL: ${PLANETSCALE_RPC_URL}
308307
SEED_ACCOUNTS: ${SEED_ACCOUNTS}
309308
SEED_INITIAL_BALANCE: ${SEED_INITIAL_BALANCE}
310-
USE_SPACETIME_METRICS_ENDPOINT: ${USE_SPACETIME_METRICS_ENDPOINT}
311309
CONVEX_USE_SHARDED_COUNTER: ${CONVEX_USE_SHARDED_COUNTER}
312310
VERIFY: ${VERIFY}
313311
BENCH_PIPELINED: ${BENCH_PIPELINED}

templates/keynote-2/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@
257257
STDB_URL: ${STDB_URL}
258258
STDB_MODULE: ${STDB_MODULE}
259259
STDB_MODULE_PATH: ${STDB_MODULE_PATH}
260-
STDB_METRICS_URL: ${STDB_METRICS_URL}
261260
STDB_CONFIRMED_READS: ${STDB_CONFIRMED_READS}
262261
BUN_URL: ${BUN_URL}
263262
SQLITE_FILE: ${SQLITE_FILE}
@@ -271,7 +270,6 @@
271270
PLANETSCALE_RPC_URL: ${PLANETSCALE_RPC_URL}
272271
SEED_ACCOUNTS: ${SEED_ACCOUNTS}
273272
SEED_INITIAL_BALANCE: ${SEED_INITIAL_BALANCE}
274-
USE_SPACETIME_METRICS_ENDPOINT: ${USE_SPACETIME_METRICS_ENDPOINT}
275273
CONVEX_USE_SHARDED_COUNTER: ${CONVEX_USE_SHARDED_COUNTER}
276274
VERIFY: ${VERIFY}
277275
volumes:

templates/keynote-2/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
"prep": "tsx src/init/init-all.ts",
1212
"down": "docker compose down || exit 0",
1313
"test-1": "tsx src/cli.ts test-1",
14-
"bench": "tsx src/cli.ts",
15-
"bench-dist-coordinator": "tsx src/distributed/coordinator.ts",
16-
"bench-dist-generator": "tsx src/distributed/generator.ts",
17-
"bench-dist-control": "tsx src/distributed/control.ts"
14+
"bench": "tsx src/cli.ts"
1815
},
1916
"devDependencies": {
2017
"@types/better-sqlite3": "^7.6.13",

templates/keynote-2/src/cli.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class BenchmarkTester {
4242
let totals = {
4343
tps: 0,
4444
samples: 0,
45-
committed_txns: 0,
4645
p50_ms: 0,
4746
p95_ms: 0,
4847
p99_ms: 0,
@@ -54,7 +53,6 @@ class BenchmarkTester {
5453
const result = await runOne({ ...this.config, concurrency, alpha });
5554
totals.tps += result.tps;
5655
totals.samples += result.samples;
57-
totals.committed_txns += result.committed_txns ?? 0;
5856
totals.p50_ms += result.p50_ms;
5957
totals.p95_ms += result.p95_ms;
6058
totals.p99_ms += result.p99_ms;
@@ -67,7 +65,6 @@ class BenchmarkTester {
6765
const avg = {
6866
tps: totals.tps / runs,
6967
samples: totals.samples / runs,
70-
committed_txns: totals.committed_txns / runs,
7168
p50_ms: totals.p50_ms / runs,
7269
p95_ms: totals.p95_ms / runs,
7370
p99_ms: totals.p99_ms / runs,

templates/keynote-2/src/config.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export interface SharedRuntimeConfig {
4545
stdbCompression: StdbCompression;
4646
stdbConfirmedReads: boolean;
4747
useDocker: boolean;
48-
useSpacetimeMetricsEndpoint: boolean;
4948
poolMax: number;
5049
bunUrl: string;
5150
convexUrl: string;
@@ -108,9 +107,7 @@ export type RunnerRuntimeConfig = Pick<
108107
| 'minOpTimeoutMs'
109108
| 'opTimeoutMs'
110109
| 'precomputedTransferPairs'
111-
| 'stdbUrl'
112110
| 'tailSlackMs'
113-
| 'useSpacetimeMetricsEndpoint'
114111
| 'verifyTransactions'
115112
>;
116113

@@ -235,11 +232,6 @@ export function getSharedRuntimeDefaults(
235232
),
236233
stdbConfirmedReads: readBooleanEnv('STDB_CONFIRMED_READS', true, env),
237234
useDocker: readBooleanEnv('USE_DOCKER', false, env),
238-
useSpacetimeMetricsEndpoint: readBooleanEnv(
239-
'SPACETIME_METRICS_ENDPOINT',
240-
true,
241-
env,
242-
),
243235
poolMax: readNumberEnv('MAX_POOL', 1000, env),
244236
bunUrl: readStringEnv('BUN_URL', 'http://127.0.0.1:4000', env),
245237
convexUrl: readStringEnv('CONVEX_URL', 'http://127.0.0.1:3210', env),

templates/keynote-2/src/connectors/spacetimedb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function spacetimedb(config: SpacetimeConnectorConfig): ReducerConnector
7878

7979
return {
8080
name: 'spacetimedb',
81-
maxInflightPerWorker: 512,
81+
maxInflightPerWorker: 128,
8282

8383
async open() {
8484
try {

0 commit comments

Comments
 (0)