Skip to content

feat(pgbench): add initial containerized benchmark runner - #15

Merged
amh1k merged 1 commit into
mainfrom
feat/pgbench-runner
Sep 17, 2026
Merged

amh1k merged 1 commit into
mainfrom
feat/pgbench-runner

Conversation

@amh1k

@amh1k amh1k commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a standalone PostgreSQL benchmark runner using Go and pgbench.

Fixes #10

Changes

  • Added a Go runner with configuration validation, optional table initialization, and default read/write benchmark execution.
  • Added cancellation handling and propagation of pgbench failure exit codes.
  • Added a multi-stage Dockerfile containing the compiled runner and PostgreSQL 16 tools, running as a non-root user.
  • Added unit tests for configuration, password-file validation, execution ordering, environment forwarding, cancellation, and process exit codes.
  • Added runners/pgbench/README.md with build, configuration, local testing, and cleanup instructions.

Configuration

Required environment variables:

  • PGHOST: PostgreSQL hostname.
  • PGDATABASE: Existing database to benchmark.
  • PGUSER: PostgreSQL username.
  • PGPASSWORD or PGPASSFILE: Password or a readable password file with owner-only permissions.

Optional settings:

Variable Default
PGPORT 5432
PGCONNECT_TIMEOUT 10 seconds
BENCH_DURATION 60 seconds
BENCH_CLIENTS 1
BENCH_THREADS 1
BENCH_SCALE 1
BENCH_INITIALIZE false

BENCH_INITIALIZE=true drops and recreates pgbench tables. Use it only with a dedicated disposable database.

CI

Added a runner job that:

  • Runs go vet and race-enabled Go tests.
  • Builds the runner image.
  • Starts disposable PostgreSQL and runs benchmarks with and without initialization.
  • Checks throughput and average latency output.
  • Verifies authentication failure and checks that the supplied password is absent from failure output.
  • Cleans up the integration-test container, volume, and network.

Validation

Runner tests, Docker image build, and Docker integration checks passed locally.

Scope

Results are printed to container logs. Coordinator integration, Kubernetes Job and Secret creation, result persistence, and UI integration remain follow-up work.

Signed-off-by: amh1k <abdulmoizx97@gmail.com>
@amh1k
amh1k requested a review from spron-in September 17, 2026 15:02

@spron-in spron-in left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM

@amh1k
amh1k merged commit 95add18 into main Sep 17, 2026
5 checks passed
@spron-in
spron-in deleted the feat/pgbench-runner branch October 6, 2026 07:38
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.

Implement initial PostgreSQL benchmark runner using pgbench

2 participants