Skip to content

feat: add benchmark baseline and INFO counters - #270

Merged
skyoo2003 merged 1 commit into
mainfrom
feat/benchmark-baseline
Sep 29, 2026
Merged

skyoo2003 merged 1 commit into
mainfrom
feat/benchmark-baseline

Conversation

@skyoo2003

@skyoo2003 skyoo2003 commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

kvs had no benchmarks and no server-side counters, so nothing could show whether a change made it faster or slower. This PR adds Go benchmarks, a memtier_benchmark harness, and three INFO fields, and records a first baseline on a new Performance docs page. It also fixes make soak, which had failed since the layout change.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactor
  • CI/CD

Changes

  • Go benchmarks (make bench, BENCH_COUNT=n):
    • pkg/kvs: Put/Get, serial and parallel, plus Put with the append log
    • internal/server: RESP SET/GET through go-redis over loopback
    • internal/cluster: Put on a three-node cluster
    • The shared test helpers now take testing.TB so the benchmarks can use them.
  • memtier harness (scripts/memtier.sh, make memtier BENCH_MODE=memory|durable|cluster BENCH_TIME=60):
    • Starts kvs on port 16379 (KVS_BENCH_PORT moves it) and waits until it is ready. In cluster mode, it waits until both followers have joined.
    • Refuses to run if something already answers on that port.
    • Ignores KVS_* environment settings, so a local config cannot change what gets measured.
    • Stops every node it started, including after Ctrl-C.
  • INFO:
    • New # Stats fields: total_connections_received and total_commands_processed. Queued commands count when EXEC runs them, and calls inside a script count too.
    • New # Memory field: used_memory, read from runtime/metrics so INFO does not stop the world.
    • Connection ids are now assigned after admission, so refused connections are not counted as received.
  • make soak: now points at ./pkg/kvs instead of the repository root, which holds no Go files.
  • Docs:
    • New Performance page with the memory, durable, and cluster numbers and how to reproduce them.
    • Links from the compatibility and contributing pages. The bench commands are added to CONTRIBUTING.md.

Known limits of the recorded numbers:

  • They were taken on a laptop running on battery.
  • memtier does not prefill the keyspace, so most GETs measure the miss path.

A follow-up will add a prefill step and re-measure.

Changelog

  • changie new fragment added — one sentence, two at most, 280 characters max
  • Not user-visible, no fragment needed

Testing

  • make all passes (golangci-lint 0 issues, go test ./...)
  • New tests added (if applicable): the INFO counters, covering EXEC, rejected commands, and script calls
  • make soak SOAK=2s SOAK_DOWN=0 passes for both packages.
  • make memtier runs in all three modes and leaves no processes behind.
  • hugo --minify builds the docs.

Related Issues

N/A

Nothing measured kvs's throughput or latency, so no later change could be
shown to cost or save anything. This adds the measurements and records a
first set of numbers.

- `make bench` runs Go benchmarks for the store (in memory and with the
  append log), the RESP path through go-redis, and a three-node cluster.
- `make memtier` builds kvs, starts it in memory, durable, or cluster mode
  on a private port, and drives it with memtier_benchmark.
- `INFO` reports `total_connections_received`, `total_commands_processed`,
  and `used_memory`. Connection ids are now assigned after admission, so a
  refused connection is not counted as received.
- website/content/docs/performance.md records the numbers and how to
  reproduce them.

`make soak` also works again: it still named the repository root, which
has held no Go files since the layout change.
@github-actions github-actions Bot added documentation Improvements or additions to documentation go Pull requests that update Go code labels Sep 29, 2026
@skyoo2003
skyoo2003 merged commit f57bc5b into main Sep 29, 2026
8 checks passed
@skyoo2003
skyoo2003 deleted the feat/benchmark-baseline branch September 29, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant