Skip to Content
Potik Docs
Runbooks

Performance benchmarks

Run from the repository root with Go, Docker Compose v2, curl, and access to the container image registries.

sh tools/benchmarks/run.sh api
sh tools/benchmarks/run.sh worker
sh tools/benchmarks/run.sh combined
sh tools/benchmarks/run.sh smoke

The runner creates a fresh Compose project with its own PostgreSQL and Redis volumes. The API uses loopback-only demo mode, k6 uses the internal Compose endpoint, and the standalone worker consumes disposable notification records. The stack uses automated test data and is removed on exit. The smoke mode runs both workloads for three seconds and is suitable for CI. It checks that the requests succeed, the load generator drops no iterations, and all submitted jobs complete. It sets no latency or throughput requirement. The load modes report dropped iterations without treating them as request errors.

The default load lasts 20 seconds, with 10 k6 iterations per second and 10 jobs submitted per second. Change these independently when investigating a specific workload.

BENCH_DURATION_SECONDS=30 BENCH_API_RATE=75 BENCH_JOB_RATE=25 \
  BENCH_OUTPUT=/tmp/performance-runs sh tools/benchmarks/run.sh combined
  • API. The runner seeds 1,000 project rows. Nine out of ten iterations list the first 20 rows. The tenth creates, reads, renames and deletes a row in sequence. k6 reports HTTP and GraphQL errors separately. A GraphQL error also includes an unexpected response or HTTP error.
  • Worker. Once per second the driver inserts a batch of users, notices and outbox events in PostgreSQL, using the same record shapes as the welcome-notification flow. The production worker dispatches the outbox through Redis, consumes the Asynq jobs and publishes the realtime hints. Redis uses append-only persistence with fsync on every write. The driver measures completion in Asynq, so the measurement includes the outbox and worker. It does not include an identity provider round trip or a connected WebSocket client.
  • Combined. The two workloads share PostgreSQL and start against the same scheduled timestamp. Compare this run with the separate modes when investigating resource contention.

Each command prints a report directory. Use graphql.json and worker.json for p50, p95 and p99 latency, throughput and error rates. The k6 latency metric measures each HTTP request. For worker latency the driver samples up to five evenly spaced events per batch and polls their completion state every 100 ms. That measurement includes up to a poll interval of observation delay when Redis is responsive. The worker counts archived and unfinished jobs as errors and allows up to 20 seconds for draining. API throughput divides the request count by the configured load duration. Worker throughput uses the load duration plus any time spent draining. Use environment.txt for the checkout, CPU, RAM, image IDs and limits, and resources.log for timestamped container CPU and memory samples. The samples cover the startup wait, workload and drain.

Keep the workload configuration, service counts, database and Redis versions, CPU and memory limits, and persistence settings constant when comparing runs. These results characterize the measured environment and workload. Repeat comparisons and record the spread before using them to justify changes.

Recorded local baseline

The 20-second combined baseline ran on 2026-11-22 at 10 scheduled API iterations and 10 job submissions per second. It used x86-64 Linux 6.18.57, AMD EPYC 9V74 CPUs, a four-CPU quota and a 16 GiB benchmark cgroup limit. Docker reported five CPUs and 18,882,662,400 bytes of RAM. The stack used PostgreSQL 17, Redis 7.4, k6 2.4.0 and the standalone worker. The Go job driver used Go 1.25.11. The Docker daemon returned shared cgroup counters on this host, so service-level CPU and memory usage cannot be inferred from those samples.

PathCompletedThroughputError ratep50p95p99
GraphQL HTTP requests25612.80/s0%7.44 ms562.92 ms880.42 ms
Outbox to Asynq completion2009.66/s0%1,218.77 ms2,699.67 ms2,708.98 ms

k6 completed 196 iterations and dropped four. The worker completed all 200 jobs in a 20.71-second observation window. The worker latency percentiles use 100 sampled jobs.

A separate run at 50 API iterations and 50 jobs per second produced the following measurements. k6 completed 955 iterations and dropped 46. The worker drained all 1,000 jobs in a 21.64-second observation window.

PathCompletedThroughputError ratep50p95p99
GraphQL HTTP requests1,24362.15/s0%10.45 ms499.89 ms884.36 ms
Outbox to Asynq completion1,00046.22/s0%1,724.21 ms2,887.05 ms3,100.00 ms

On this page