2023-06-23 07:25:18 +00:00
# pgidler
Create idle postgres connections for testing
2023-06-23 09:36:08 +02:00
## Introduction
2023-06-23 07:25:18 +00:00
2023-06-23 09:36:08 +02:00
This program start a number of idle (or idle in transaction) sessions
on a postgres database for testing purposes. It uses go routines (like
threads) to execute independent clients. Each client executes a number
of harmless SELECT's and then stops doing anything. The clients then
hang either forever or until a specified timeout is reached.
2023-06-23 07:25:18 +00:00
2024-09-25 13:08:14 +02:00
This is an implementation of a tool described at [AWS Blog: Performance impact of idle PostgreSQL connections ](https://aws.amazon.com/blogs/database/performance-impact-of-idle-postgresql-connections/ ).
2023-06-23 09:36:08 +02:00
## Building
2023-06-23 07:25:18 +00:00
2023-06-23 09:36:08 +02:00
Run `make` to compile. You'll need Golang. The repo contains a
pre-compiled binary for linux amd.
2023-06-23 07:25:18 +00:00
## Usage
2023-06-23 09:36:08 +02:00
`pgidler` offers two idle modes:
2023-06-23 07:25:18 +00:00
2023-06-23 09:36:08 +02:00
- **idle**: create normal idle sessions
- **idle in transaction**: create sessions hanging in a transaction
2023-06-23 07:25:18 +00:00
2023-06-23 09:36:08 +02:00
The following commandline options are available:
```
Usage of ./pgidler:
-c, --client int Number of concurrent users (default 500)
-d, --database string Database (default "postgres")
-i, --idletransaction Wether to stay in idle in transaction state
-p, --password string Password of the database user
-P, --port int TCP Port (default 5432)
-s, --server string Server (default "localhost")
-t, --timeout int Wether to stop the clients after N seconds
-u, --user string Database user (default "postgres")
```
2025-11-05 19:32:43 +01:00
# Report bugs
[Please open an issue ](https://codeberg.org/scip/pgidler/issues ). Thanks!
# License
This work is licensed under the terms of the General Public Licens
version 3.
# Author
Copyleft (c) 2024 Thomas von Dein