Skip to content

Add end-to-end benchmark harness and refresh README - #20

Merged
emoss08 merged 1 commit into
mainfrom
claude/hopeful-hawking-8fzwfa
Nov 5, 2026
Merged

emoss08 merged 1 commit into
mainfrom
claude/hopeful-hawking-8fzwfa

Conversation

@emoss08

@emoss08 emoss08 commented Nov 5, 2026

Copy link
Copy Markdown
Owner

What does this PR do?

Benchmark harness (test/bench). A Go program that runs a real gateway binary against a real PostgreSQL and real sinks. It times each run from the gateway's own Prometheus counters and stops the clock only when every sink has acknowledged every event. It has three modes:

  • stream: commits 1M rows while the gateway is stopped, then times how long the gateway takes to drain them. This separates GTC's throughput from how fast PostgreSQL can insert.
  • backfill: copies an existing 1M-row table with the watermark backfill.
  • latency: inserts single-row transactions at 1,000/s and reads them back with XREAD, measuring commit to consumer.

NATS JetStream runs in-process through nats-server/v2, which is already in go.mod, and the webhook receiver is built into the harness. RedisJSON and Meilisearch are opt-in via -redis-json and -meili. The harness touches only its own slot, publication, tables and gtcbench:* Redis keys.

README.

  • The opening paragraph now names all five sinks and leads with the search keywords.
  • New sections: use cases, a contents line, Performance (with the results below), and a sink overview table.
  • Fixed stale details:
    • Routing defaults now cover every key-templated sink, not only the two Redis ones.
    • The note that Meilisearch needs an id column now describes primary_key.
    • The gtc doctor description now includes the NATS and webhook checks.
    • Added /api/history to the endpoints and the missing metrics to the list.
    • The architecture tree now shows nats, webhook, transform, doctor, schema and test/bench.

Results (median of three runs; 4 vCPU, with PostgreSQL 16, Redis, NATS and GTC all on the same VM):

Scenario Throughput
stream, no sinks 172,700 events/s
stream, Redis Streams 141,300 events/s
stream, NATS JetStream 96,000 events/s
stream, Redis + NATS 83,000 events/s
stream, webhook 7,000 events/s
backfill, Redis Streams 156,800 rows/s
backfill, NATS JetStream 103,600 rows/s

Latency at 1,000 rows/s, commit to consumer: p50 6.8 ms, p99 12.0 ms.

Type of change

  • Bug fix
  • New feature / sink
  • Documentation
  • Refactor / chore

Checklist

  • go test ./... passes
  • gofmt / go vet are clean
  • Tests added or updated for changed behavior (no product code changed)
  • README.md / CLAUDE.md updated if env vars or behavior changed
  • Delivery semantics untouched

Notes for the reviewer

  • The RedisJSON and Meilisearch paths in the harness have not been run: neither server was available in the benchmark environment. They reuse the same mechanism as the sinks that were run (environment variables plus a per-sink success counter).
  • One run of Redis + NATS came in at 49.7k events/s against about 84k in the other two. It looks like a noisy-neighbour effect on a shared box; the README reports the median.
  • During catch-up, batches average about 1,700 events because the 10 ms linger closes them before they reach 5,000. Raising CDC_BATCH_LINGER to 50 ms filled the batches but gained only about 3% here, because the box is CPU-bound. On separate hosts it may matter more.

Generated by Claude Code

test/bench drives a real gateway against real PostgreSQL and sinks and
times it from the gateway's own metrics: backlog drain (stream),
watermark backfill, and commit-to-consumer latency over Redis Streams.
NATS JetStream runs in-process and the webhook receiver is built in;
RedisJSON and Meilisearch are opt-in via flags.

README: lead paragraph names every sink, adds use cases, a contents
line, a Performance section with measured results, a sink overview
table, and fixes stale details (routing defaults for all key-templated
sinks, Meilisearch primary_key, doctor checks, endpoints, metrics,
architecture tree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AcYXsMTRwCcvgt9sytvXPU
@emoss08
emoss08 marked this pull request as ready for review November 5, 2026 03:00
@emoss08
emoss08 merged commit 357998a into main Nov 5, 2026
7 checks passed
@emoss08
emoss08 deleted the claude/hopeful-hawking-8fzwfa branch November 5, 2026 03:00
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