forkconns

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

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

func NewWorkload

func NewWorkload(config Config, logger log.Logger) (noisia.Workload, error)

NewWorkload creates a new workload with specified config.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL