keynote-2: alpha -> 1.5, withConfirmedReads(true), remove warmup (#4492)

# Description of Changes

This does 3 things to the keynote-2 benchmark:
- it changes the default alpha to 1.5, which we actually tested the
other services with
- it turns on confirmed reads (not the default for < 2.0)
- it removes warmup

This was tested on
https://github.com/clockworklabs/SpacetimeDB/pull/4404 to have no impact
on the TPS throughput of spacetimedb.
**This PR shouldn't be merged before #4404 has.**

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

This tweaks a bench test.
This commit is contained in:
Mazdak Farrokhzad
2026-02-28 04:06:11 +01:00
committed by GitHub
parent c29a44c50b
commit abbcec4ab3
8 changed files with 16 additions and 31 deletions
+1 -1
View File
@@ -205,7 +205,7 @@ From `src/cli.ts`:
- **`--alpha A`**
- Zipf α parameter for account selection (hot vs cold distribution)
- Default: `0.5`
- Default: `1.5`
- **`--connectors list`**
- Optional, comma-separated list of connector `system` names
+1 -1
View File
@@ -197,7 +197,7 @@ docker compose up -d pg crdb
npm run prep
# Run benchmark
npm run bench -- --seconds 10 --concurrency 50 --alpha 0 --connectors spacetimedb,postgres_rpc,sqlite_rpc
npm run bench -- --seconds 10 --concurrency 50 --alpha 1.5 --connectors spacetimedb,postgres_rpc,sqlite_rpc
```
## Output
@@ -194,7 +194,7 @@
volumes:
- /mnt/local-ssd/sqlite_data:/data
- ./runs:/app/runs
command: ["--seconds", "5", "--concurrency", "50", "--alpha", "1", "--connectors", "sqlite"]
command: ["--seconds", "5", "--concurrency", "50", "--alpha", "1.5", "--connectors", "sqlite"]
network_mode: host
sqlite-seed:
@@ -315,7 +315,7 @@
volumes:
- /mnt/local-ssd/sqlite_data:/data
- ./runs:/app/runs
command: ["--seconds", "5", "--concurrency", "50", "--alpha", "1", "--connectors", "sqlite"]
command: ["--seconds", "5", "--concurrency", "50", "--alpha", "1.5", "--connectors", "sqlite"]
network_mode: host
sqlite-seed:
+1 -1
View File
@@ -276,7 +276,7 @@
volumes:
- sqlite_data:/data
- ./runs:/app/runs
command: ["--seconds", "5", "--concurrency", "50", "--alpha", "1", "--connectors", "sqlite"]
command: ["--seconds", "5", "--concurrency", "50", "--alpha", "1.5", "--connectors", "sqlite"]
network_mode: host
sqlite-seed:
@@ -21,13 +21,12 @@ const LOCALHOST: &str = "http://localhost:3000";
const MODULE: &str = "sim";
const DURATION: &str = "5s";
const WARMUP_DURATION: &str = "5s";
const ALPHA: f32 = 0.5;
const ALPHA: f32 = 1.5;
const CONNECTIONS: usize = 10;
const INIT_BALANCE: i64 = 1_000_000;
const AMOUNT: u32 = 1;
const ACCOUNTS: u32 = 100_000;
const CONFIRMED_READS: bool = false;
const CONFIRMED_READS: bool = true;
// Max inflight reducer calls imposed by the server.
const MAX_INFLIGHT_REDUCERS: u64 = 16384;
@@ -139,9 +138,11 @@ fn bench(cli: &Common, bench: &Bench) {
println!();
}
// Parse the durations.
// Parse the duration.
let duration = parse_duration(&bench.duration).expect("invalid duration passed");
let warmup_duration = parse_duration(&bench.warmup_duration).expect("invalid warmup duration passed");
if !cli.quiet {
eprintln!("benchmarking for {}...", format_duration(duration));
}
// Initialize connections.
let connections = bench.connections;
@@ -160,15 +161,10 @@ fn bench(cli: &Common, bench: &Bench) {
let transfer_pairs = &make_transfers(accounts, alpha);
let transfers_per_worker = transfer_pairs.len() / conns.len();
let warmup_start_all = Instant::now();
let mut start_all = warmup_start_all;
let barrier = &std::sync::Barrier::new(conns.len());
let mut start_all = Instant::now();
let completed = Arc::new(AtomicU64::default());
thread::scope(|scope| {
if !cli.quiet {
eprintln!("warming up for {}...", format_duration(warmup_duration));
}
let mut start_all = Some(&mut start_all);
for (worker_idx, (mut rx, tx)) in conns.into_iter().enumerate() {
let completed = completed.clone();
@@ -214,14 +210,6 @@ fn bench(cli: &Common, bench: &Bench) {
transfers
};
while warmup_start_all.elapsed() < warmup_duration {
run();
}
if barrier.wait().is_leader() && !cli.quiet {
eprintln!("finished warmup...");
eprintln!("benchmarking for {}...", format_duration(duration));
}
let start = Instant::now();
if let Some(start_all) = start_all {
*start_all = start;
@@ -315,9 +303,6 @@ struct Bench {
#[arg(short, long, default_value = DURATION)]
duration: String,
#[arg(short, long, default_value = WARMUP_DURATION)]
warmup_duration: String,
#[arg(short, long)]
tps_write_path: Option<String>,
}
+3 -3
View File
@@ -22,7 +22,7 @@ let seconds = 1,
accounts = process.env.SEED_ACCOUNTS
? Number(process.env.SEED_ACCOUNTS)
: 100_000,
alpha = 0.5,
alpha = 1.5,
connectors: string[] | null = null,
contentionTests: {
startAlpha: number;
@@ -173,7 +173,7 @@ class BenchmarkTester {
startConc: number = 1,
endConc: number = 100,
step: number = 1,
alpha: number = 1,
alpha: number = 1.5,
) {
const results: { concurrency: number; avgResult: RunResult }[] = [];
for (let conc = startConc; conc <= endConc; conc += step) {
@@ -189,7 +189,7 @@ class BenchmarkTester {
startConc: number = 1,
endConc: number = 100,
factor: number = 2,
alpha: number = 1,
alpha: number = 1.5,
) {
if (factor <= 1) {
throw new Error('factor must be > 1 to avoid infinite loop');
+1 -1
View File
@@ -71,7 +71,7 @@ function hasFlag(name: string): boolean {
const seconds = getArg('seconds', 10);
const concurrency = getArg('concurrency', 10);
const alpha = getArg('alpha', 0.5);
const alpha = getArg('alpha', 1.5);
const systems = getStringArg('systems', 'convex,spacetimedb')
.split(',')
.map((s) => s.trim());