soakwork

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BatchSize       int           // accounts per iteration (default 10)
	DeleteThreshold int           // delete oldest 10% of txns when count exceeds this (0 = never delete)
	ReportInterval  time.Duration // how often to call reportFn (default 10s)
}

Config controls the soak workload parameters.

type Report

type Report struct {
	Iteration    int
	AccountCount int64
	TxCount      int64
	Stats        memcheck.Stats
	OpsPerSec    float64
	Elapsed      time.Duration
}

Report holds per-iteration statistics.

type Workload

type Workload struct {
	// contains filtered or unexported fields
}

Workload drives a sustained CRUD workload against a pglike database.

func New

func New(db *sql.DB, cfg Config, monitor *memcheck.Monitor) *Workload

New creates a Workload.

func (*Workload) Run

func (w *Workload) Run(ctx context.Context, reportFn func(Report)) error

Run loops RunIteration until ctx is cancelled or the memory monitor trips. It calls reportFn at ReportInterval with the latest report.

func (*Workload) RunIteration

func (w *Workload) RunIteration() (Report, error)

RunIteration executes one CRUD round and returns a report.

func (*Workload) Setup

func (w *Workload) Setup() error

Setup creates the schema tables.

Jump to

Keyboard shortcuts

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