A distributed PostgreSQL benchmarking tool designed to run comprehensive database performance tests at scale in Kubernetes environments.
pgdistbench enables you to:
- Benchmark PostgreSQL instances (TPC-C, TPC-H, CHBench)
- Scale testing across multiple replicas for distributed load generation
- Test Kubernetes-native PostgreSQL deployments (CloudNativePG, static clusters)
- Stress test entire clusters with dynamic PostgreSQL instance lifecycle management
- Configure complex scenarios using KCL (KusionStack Configuration Language)
The tool consists of two main components:
- Bench Driver: An HTTP server that executes the actual benchmarks against the system under test
- K8 Runner: A CLI tool that manages benchmark deployments, configures systems under test, and coordinates multiple bench driver replicas
- Kubernetes cluster
- Go 1.24+ (for building from source)
- kubectl configured for your cluster
Build the binaries:
make build
This creates two executables:
benchdriver
- The benchmark execution serverk8runner
- The Kubernetes orchestration tool
- Configure your benchmark using KCL (see
demos/
for examples):
# Single database benchmark
cd demos/singledb_kcl
- Deploy systems under test:
k8runner systems apply
- Deploy benchmark runners:
k8runner runner apply
- Execute benchmarks:
k8runner exec prepare --wait tpcc-1
k8runner exec run --wait tpcc-1
k8runner exec cleanup --wait tpcc-1
- TPC-C: OLTP benchmark simulating order processing workloads
- TPC-H: OLAP benchmark with complex analytical queries
- CHBench: Mixed OLTP/OLAP workload combining TPC-C and TPC-H
- K8Stress: Kubernetes-native stress testing with dynamic PostgreSQL lifecycle management
- CloudNativePG (CNPG): Kubernetes-native PostgreSQL clusters
- Static Clusters: Pre-existing PostgreSQL instances
- Kubernetes Clusters: Direct cluster stress testing
Explore the demos/
directory for complete examples:
demos/singledb_kcl/
- Single database benchmarking with KCL configurationdemos/singledb_yaml/
- Single database benchmarking with YAML configurationdemos/clusterload/
- Kubernetes cluster stress testing
Benchmarks can be configured using YAML or KCL. KCL provides:
- Type safety and validation
- Modular and reusable configurations
- Integration with Kubernetes resources
See the scripts/kcl/k8dbbench/
directory for the KCL configuration schema definitions.
For detailed documentation, see the docs/
directory:
- Documentation Hub - Start here for navigation and overview
- Getting Started Guide - Quick start walkthrough
- Architecture Guide - Technical architecture and design
- Configuration Reference - Complete configuration guide
# Build both binaries
make build
# Build individual components
go build -o benchdriver ./cmd/benchdriver
go build -o k8runner ./cmd/k8runner
# Build driver image via docker
make docker_build
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request