Skip to content

docs(bench): measure hyperd startup cost and idle memory - #386

Open
StefanSteiner wants to merge 1 commit into
tableau:mainfrom
StefanSteiner:docs/bench-hyperd-startup-cost
Open

StefanSteiner wants to merge 1 commit into
tableau:mainfrom
StefanSteiner:docs/bench-hyperd-startup-cost

Conversation

@StefanSteiner

Copy link
Copy Markdown
Contributor

Summary

Phase 0 of the hyperdb-daemon extraction design (#385): measure what a private hyperd costs to start, and what one costs to keep idle, so the Phase B go/no-go has numbers behind it.

  • New hyperd_startup_cost example (hyperdb-api/benches/hyperd_startup_cost.rs): per-phase wall time (spawn to endpoint, first connect, first SELECT 1, graceful shutdown) as min / median / p95, idle RSS after 5 s, and password-less vs SCRAM-SHA-256 connect time on a warm engine.
  • New section "hyperd startup cost and idle memory" in docs/BENCHMARK_GUIDE.md.

The SCRAM leg starts hyperd with --config (an authorized_users entry with a fixed, benchmark-only verifier) and --strict-settings-mode, the same configuration the design's Phase S uses.

Results

Apple M3 Max, macOS 27.2.1, 96 GB, pinned hyperd main.0.0.26479.r96880f6a, release build, 30 iterations.

Measure (median) TCP IPC
Spawn to endpoint 54.77 ms 54.74 ms
First connect 1.24 ms 0.91 ms
First SELECT 1 5.21 ms 5.01 ms
Shutdown 7.25 ms 7.04 ms
Idle RSS 56.2 MiB 56.7 MiB

Warm-engine connect over TCP: 0.24 ms password-less, 0.73 ms with SCRAM-SHA-256 (+0.49 ms).

Spawn to first query is about 61 ms, so startup cost alone does not justify a shared engine; the design's motivation is sharing databases across the processes of an application.

Raw output, TCP
hyperd startup cost
  Transport:  Tcp
  Iterations: 30

Per-phase wall time (ms), 30 iterations
  phase                               min     median        p95
  spawn to endpoint                 51.03      54.77      55.94
  connect (no password)              1.04       1.24       1.48
  first query (SELECT 1)             4.61       5.21       5.85
  shutdown                           5.49       7.25       8.82

Idle hyperd after 5 s: pid 13807, RSS 57520 KiB (56.2 MiB)

Connect time (ms), TCP, 30 iterations on a warm engine
  auth                                min     median        p95
  password-less                      0.19       0.24       0.37
  SCRAM-SHA-256                      0.66       0.73       0.99
  SCRAM median overhead: 0.49 ms
Raw output, IPC (BENCH_TRANSPORT=ipc)
hyperd startup cost
  Transport:  Ipc
  Iterations: 30

Per-phase wall time (ms), 30 iterations
  phase                               min     median        p95
  spawn to endpoint                 51.78      54.74      55.78
  connect (no password)              0.82       0.91       1.15
  first query (SELECT 1)             4.56       5.01       6.11
  shutdown                           5.35       7.04       9.02

Idle hyperd after 5 s: pid 13991, RSS 58064 KiB (56.7 MiB)

Connect time (ms), TCP, 30 iterations on a warm engine
  auth                                min     median        p95
  password-less                      0.13       0.19       0.33
  SCRAM-SHA-256                      0.60       0.69       0.90
  SCRAM median overhead: 0.51 ms

Test plan

  • cargo fmt --check, cargo clippy -p hyperdb-api --all-targets -- -D warnings
  • npx markdownlint-cli2: 0 issues
  • Ran the example in release mode on both transports (output above)

Add a hyperd_startup_cost example that times spawn, first connect, first
query and shutdown, reads idle RSS, and compares password-less with
SCRAM-SHA-256 connects on a warm engine. Record the results in
BENCHMARK_GUIDE.md. Phase 0 of the hyperdb-daemon extraction design.
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.

1 participant