Benchmark your SQL query against TimescaleDB
![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)
![Build](https://github.com/knrt10/posbench/actions/workflows/build.yaml/badge.svg)
![release](https://github.com/knrt10/posbench/actions/workflows/release.yaml/badge.svg)
![Go Code reference](https://img.shields.io/badge/code%20reference-go.dev-darkblue.svg)
Contents
Demo
![Demo](https://asciinema.org/a/499961.svg)
Features
-
posbench
is a simple benchmarking tool, which can be used to benchmark SELECT query performance across multiple workers/clients against a TimescaleDB instance.
-
It takes a CSV file as input which contains the query specifications.
Usage
Usage of posbench:
-buffer int
Buffer for streaming files to limit concurrency (default 10)
-dbname string
postgress database (default "homework")
-debug
enable debugging
-host string
postgres hostname (default "localhost")
-pass string
postgress pass
-path string
CSV file to query data from Timescale instance (default "assets/query_params.csv")
-port int
postgres port number (default 5432)
-pretty
pretty printing of logs (default true)
-runs int
number of times to run the benchmark (default 2)
-user string
postgres user (default "postgres")
-workerCount int
Number of concurrent workers processing data from db (default 10)
Running the code
You can run the code either using docker compose
or directly using go
on your machine.
Using docker compose
Prerequisites
To run posbench, follow below steps:
make container-up
To stop posbench and clean containers, follow below steps:
make container-down
Locally
Prerequisites
- Go installed on your host.
- PostgreSQL installed on your host. You will also need to have
psql
cli installed.
postgres
running on a <port>
on your host.
Make sure that your postgres in running on port 5432
. If not, you can pass the -port
flag.
# Build the code
make build
# Setup Timescale instance and go dependencies
make local
# Run the code
dist/posbench -port <port> # default is 5432
Development
Linting
Run linter and formatter using
make fmt
make lint
Testing
# Run unit test
make unit-test
# Run integration test
make local
make integration-test
Internals
See docs/architecture