Background worker able to kill random connections based on a configurable chance. It's based on Michael Paquier's background worker 'kill_idle'.
The rage backend scan is done using pg_stat_activity.
This worker is compatible with PostgreSQL 9.4 and newer versions.
The installation of pg_rage_terminator is done using the following commands:
USE_PGXS=1 make
sudo make install
After building the background worker you need to change shared_preload_libraries within postgresql.conf:
shared_preload_libraries = 'pg_rage_terminator'
Following configuration options (GUC) controls the behavior of pg_rage_terminator.
-
pg_rage_terminator.chance: chance to kill a random backend. Valid values are 0 to 100. Where 0 means no backend is killed. 100 ensures every backend is killed. Defaults to 10.
-
pg_rage_terminator.interval: defines the interval of "kill" lookups in seconds. Valid values are 0 to 3600. Where 0 disables the lookup process completely. Defaults to 5 (seconds).