Documentation
¶
Overview ¶
Package forkconns defines implementation of workload which creates many short-lived database connections which forces Postgres to fork children processes. Postgres is based on fork-based process model and creating a lot of children processes is not cheap - it requires CPU and memory resources, initializing and allocating internal resources, etc.
For creating a workload, workers are spawned. Each worker in a loop, with defined interval makes a connection to Postgres and perform simple query to pg_class relation and then close the connection. The number of workers depends on Config.Jobs. Interval between creating connections is based on Config.Rate and calculated on per-second manner.
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
// Rate defines a rate of how many connections should be established per interval.
Rate uint16
// Jobs defines how many workers should be created for producing connections.
Jobs uint16
}
Config defines configuration settings for 'forkconns' workload.