Documentation
¶
Overview ¶
Package hotrowcontention defines implementation of workload which deliberately drives row-lock and buffer-content contention on a PostgreSQL instance.
It is the deliberate INVERSE of wal-flood. Where wal-flood partitions UPDATEs over DISJOINT id ranges so writers never serialize on row locks (maximizing aggregate WAL throughput), hot-row-contention makes the opposite choice: it seeds a tiny table of HotRows "hot" rows and fans out --jobs autocommit UPDATE-churn workers that SHARE those rows (multiple sessions per row). The many `UPDATE counter = counter + 1` statements serialize on a single row-lock and contend on LWLock:BufferContent, saturating server CPU and collapsing TPS. The result is degradation observable from the OUTSIDE — not the death of the instance.
There is no payload and no rate limiter: the goal is maximum contention, so UPDATEs run at full speed. The workload self-reports honestly from in-process atomics (attempts written and live sessions); it never polls server state. Each worker owns its own connection (no shared pool, so the pool default max_conns cannot cap parallelism below --jobs). 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 ¶
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
// Jobs defines how many concurrent churn workers (sessions) to run, taken from the
// global --jobs flag. Workers SHARE the hot rows; must satisfy Jobs >= 2*HotRows.
Jobs uint16
// HotRows defines the number of shared hot rows (focuses) contended over (>= 1).
HotRows int
// ReportInterval defines the report panel print cadence.
ReportInterval time.Duration
}
Config defines configuration settings for hot-row-contention workload.