Documentation
¶
Overview ¶
Package terminate defines implementation of workload which randomly cancel queries or terminate backends. Application that executes canceled queries or hold terminated connections receive errors.
The workload is implemented as single worker which sends cancel/terminate commands with interval based on Config.Rate and Config.Interval. Exact command to be sent is based on Config.SoftMode, depending on it pg_cancel_backend() or pg_terminate_backend() is used. The workload could be additionally tuned for cancel/terminate processes of exact users, from specific client address, connected to specific databases or which has specific application name.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Conninfo defines connection string used for connecting to Postgres.
Conninfo string
// Interval defines an interval of single round during which the number of backends/queries should be signalled (accordingly to rate).
Interval time.Duration
// Rate defines a rate of how many backends should be terminated (or queries canceled) per interval.
Rate uint16
// SoftMode defines to use pg_cancel_backend() instead of pg_terminate_backend().
SoftMode bool
// IgnoreSystemBackends controls whether system background process should be terminated or not.
IgnoreSystemBackends bool
// ClientAddr defines pattern applied to pg_stat_activity.client_addr
ClientAddr string
// User defines pattern applied to pg_stat_activity.usename
User string
// Database defines pattern applied to pg_stat_activity.datname
Database string
// ApplicationName defines patter applied to pg_stat_activity.application_name
ApplicationName string
}
Config defines configuration settings for backends terminate workload.