waitxacts

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package waitxacts defines implementation of workload which builds a stable queue of blocked sessions behind a single locked table.

One dedicated holder connection cycles an ACCESS EXCLUSIVE lock on ONE table (the first of the top-write tables, or a dedicated fixture table): it holds the lock a random interval in [LocktimeMin..LocktimeMax], rolls back, and re-acquires almost immediately (a flicker, so the blocked-session count never falls to zero between cycles). A rate-limited manager opens N separate client connections, each blocking on that table with a SELECT, so the count of established (and therefore blocked) connections climbs monotonically and — when unbounded or driven fast enough — exhausts max_connections. A connect error (e.g. too-many-clients) is the expected observable: it increments a refused counter, is logged rate-limited, and never crashes the run. A reporter ticker prints a self-report line from atomics.

Workload duration is controlled by a context created outside and passed to Run.

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.
	// It is a secret and must never be logged.
	Conninfo string
	// Fixture forces the dedicated fixture table instead of a real top-write table.
	Fixture bool
	// LocktimeMin defines a lower threshold of the lock hold interval.
	LocktimeMin time.Duration
	// LocktimeMax defines an upper threshold of the lock hold interval.
	LocktimeMax time.Duration
	// Waiters caps the number of blocked waiter connections; 0 means unlimited.
	Waiters uint
	// WaitersRate defines how many waiter connections are opened per second (> 0).
	WaitersRate float64
	// ReportInterval defines the self-report line print cadence (> 0).
	ReportInterval time.Duration
}

Config defines configuration settings for waiting transactions workload.

Jump to

Keyboard shortcuts

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