Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ Check [benchmark](benchmark/README.md)
## TODO

* SSL support
* Performance improvement:
granular locking on client/server list
active wait list processing
* Session pooling
* Enrich Statistics & Output
* Sharding?

## License

Expand Down
42 changes: 26 additions & 16 deletions benchmark/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PostgreSQL Connection Pool Benchmark Suite

Comprehensive benchmarking suite for comparing **pgpool** vs **pgbouncer** vs **direct PostgreSQL** connections using the industry-standard `pgbench` tool.
Comprehensive benchmarking suite for comparing **pgpool** vs **pgcat** vs **pgbouncer** vs **direct PostgreSQL** connections using the industry-standard `pgbench` tool.

## Overview

Expand All @@ -14,14 +14,18 @@ This benchmark suite tests:

```
benchmark/
├── config/ # Configuration files
│ ├── pgpool.ini # pgpool configuration
├── config/ # Configuration files
│ ├── pgpool.ini # pgpool configuration
│ ├── pgbouncer.ini # pgbouncer configuration
│ ├── pgcat.toml # pgcat configuration
│ └── userlist.txt # pgbouncer auth file
├── scripts/ # Benchmark scripts
│ ├── setup.sh # Environment setup
│ ├── run_benchmark.sh # Main benchmark runner
│ ├── generate_report.sh # Report generator
│ ├── generate_report.sh # Report gener

4. **Connection Time** - Lower is better
- Overhead of establishing conator
│ └── cleanup.sh # Cleanup script
├── results/ # Benchmark results (auto-generated)
│ └── YYYYMMDD_HHMMSS/ # Timestamped results
Expand All @@ -31,11 +35,11 @@ benchmark/

## Prerequisites

1. **PostgreSQL** (tested with PostgreSQL 15+)
1. **PostgreSQL** (tested with PostgreSQL 16+)
2. **pgbench** (included with PostgreSQL client tools)
3. **pgpool** (built from this repository)
4. **pgbouncer** (optional, for comparison)
5. **Go 1.22+** (to build pgpool)
4. **pgcat** ([built from git repository](https://github.com/postgresml/pgcat))
5. **pgbouncer** (1.24.0)

### Installation

Expand Down Expand Up @@ -91,18 +95,29 @@ max_clients = 200

Edit `config/pgbouncer.ini` and `config/userlist.txt` with your credentials.


#### pgcat Configuration

Edit `pgcat.toml` with test db and credentials.

### 3. Start Poolers

#### Start pgpool
```bash
# In terminal 1
cd /path/to/pgpool
./pgpool -conf benchmark/config/pgpool.ini -debug
./pgpool -conf benchmark/config/pgpool.ini
```

#### Start pgbouncer (optional)
#### Start pgbouncer
```bash
# In terminal 2
cargo run --release
```

#### Start pgbouncer
```bash
# In terminal 3
cd benchmark/config
pgbouncer -d pgbouncer.ini
```
Expand Down Expand Up @@ -139,7 +154,7 @@ export DB_NAME=postgres

# Pool ports
export PGPOOL_PORT=5433
export PGBOUNCER_PORT=6432
export PGBOUNCER_PORT=6433

# Benchmark configuration
export DURATION=60 # seconds per test
Expand Down Expand Up @@ -171,12 +186,7 @@ The TPC-B workload is automatically initialized by pgbench with the specified sc
- Mean response time
- Overall user experience

3. **P95/P99 Latency** - Lower is better
- Tail latency
- Worst-case performance
- Critical for user experience

4. **Connection Time** - Lower is better
3. **Connection Time** - Lower is better
- Overhead of establishing connections
- Important for connection churn scenarios

Expand Down
2 changes: 1 addition & 1 deletion benchmark/config/pgbouncer.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ postgres = host=127.0.0.1 port=5432 dbname=postgres

[pgbouncer]
listen_addr = 127.0.0.1
listen_port = 6432
listen_port = 6433
auth_type = scram-sha-256
auth_file = userlist.txt

Expand Down
Loading
Loading