idlexacts

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: 8 Imported by: 0

Documentation

Overview

Package idlexacts defines implementation of workload which creates idle transactions. During the workload, some temporary tables (with ON COMMIT DROP) might be created.

Before starting the workload, looking for tables with most UPDATE and DELETE operations. Then create goroutines in a loop. Single goroutine selects a random victim table from the list and creates a single idle transaction. The number of goroutines depends on Config.Jobs. During the transaction, a temporary table has been created with one row from victim table. This make the transaction writeable and force Postgres to avoid vacuuming the row version used in the transaction. This approach avoid direct write into victim table and at the same time lead to bloat due to idle transaction. If no table is passed transaction do nothing. Next, transaction is keeping idle for some random interval between Config.NaptimeMin and Config.NaptimeMax. After time is out, transaction is rolled back and temporary table is dropped.

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
	// Jobs defines how many concurrent workers and thus idle transactions should be running.
	Jobs uint16
	// NaptimeMin defines lower threshold when transactions being idle.
	NaptimeMin time.Duration
	// NaptimeMax defines upper threshold when transactions being idle.
	NaptimeMax time.Duration
}

Config defines configuration settings for idle transactions workload.

Jump to

Keyboard shortcuts

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