repro-collection/pgsql-workload

PostgreSQL 17 pgbench workload for tracking kernel regressions.

Benchmark Profile

  • Type: Macro

  • Kernel subsystem: Storage I/O, scheduler, memory management, writeback

  • Coverage: Inferred from PostgreSQL transaction throughput and latency

  • Topology: Two roles: sut, loadgen; shared-node or separate-node execution

Overview

Runs the AWS repro-collection PostgreSQL workload with a write-heavy pgbench simple-update profile. The SUT runs PostgreSQL 17, while the loadgen role initializes the pgbench dataset and drives transactions. The roles run in separate containers on either one node or different nodes.

The benchmark fragment defaults to scale 4000, 512 clients, automatic worker threads, and a 600-second measurement. It uses the prepared query protocol and initializes tables with --fillfactor=90. PostgreSQL Huge Pages are off, and the host HugeTLB pool size and transparent huge-page (THP) policy are left unchanged by default.

CPU Allocation and pgbench Workers

The default sut_nr_cpus: auto uses the logical CPU IDs allowed by the process’s affinity mask, including restrictions from CPU sets or the kernel’s online CPU allocation. IDs are selected in ascending order and can start above zero or contain gaps.

When both roles share a node, automatic sizing assigns the first half of the allowed CPU IDs to the SUT, rounded down, and the remainder to the load generator. An explicit sut_nr_cpus selects that many IDs for the SUT. Both role containers must start with the same CPU affinity mask for this partitioning. At least two CPUs must be available, and an explicit SUT allocation must leave at least one CPU for the load generator.

On separate nodes, auto lets the SUT use all its allowed CPUs. An explicit count limits the SUT to that many allowed IDs. The load generator inherits its own allocation, and its CPU count does not limit the requested SUT allocation. Requests exceeding the available SUT count are rejected.

For example, shared roles with allowed IDs 8-15 and auto use 8-11 for the SUT and 12-15 for the load generator. A SUT on its own node with the same allowed IDs uses all eight CPUs with auto.

Automatic pgbench threads use the load generator’s available CPU count after affinity is applied, capped at pgbench_clients. For example, a load generator allocated 16 CPUs with 512 clients uses 16 workers; with eight clients it uses eight workers. An explicit worker count is retained when it is positive and no greater than the client count. Larger explicit counts are rejected before workload startup.

Sampling

The benchmark fragment requests two sessions and three measured repeats per session, with no separate Fastpath warmup run. Each repeat recreates the PostgreSQL cluster and initializes fresh pgbench tables before the measurement. The 600-second duration covers the measured pgbench phase; storage setup, database initialization, and cleanup take additional time. The fragment’s two-hour timeout applies to each role’s complete execution.

The SUT executes configure, run, and cleanup. The load generator executes configure, run, results, and cleanup:

  1. The SUT prepares and verifies storage, saves the host settings that the workload can change, initializes the cluster, and starts PostgreSQL.

  2. The roles exchange readiness and CPU-count information. The load generator creates the pgbench dataset using pgbench_scale and pgbench_init_extra_args.

  3. pgbench runs the selected built-in transaction script with the configured clients, workers, protocol, and duration.

  4. The load generator extracts the measurements. Normal cleanup stops PostgreSQL, restores saved host settings, and removes temporary load-generator logs.

If configuration, measurement, result extraction, or normal cleanup fails, the adapter attempts separate PostgreSQL cleanup without masking the original failure. Successful host restoration includes the saved network sysctl values, HugeTLB settings, and THP policy. Inspect the role logs if cleanup reports a failure; forced container termination can prevent it from completing. Removing the container can also discard the saved host settings. If restoration could not complete, reboot the host before running other benchmarks.

Database and Host Settings

The bundled workload sizes PostgreSQL shared_buffers at one quarter of the memory reported by /proc/meminfo and effective_cache_size at one half. These settings use the SUT’s reported memory, independently of the CPU split between roles. They are bundled server settings rather than extra parameters exposed by the benchmark fragment.

The huge-page parameters control different settings: pg_huge_pages selects PostgreSQL’s use of HugeTLB pages, pg_system_nr_hugepages controls allocation of the host’s static page pool, and system_transparent_huge_pages controls the host THP policy. For the latter two parameters, off means leave the current host setting unchanged. Quote values such as "off" and "on" in YAML so they remain strings rather than being read as booleans.

Before PostgreSQL starts, the workload verifies the applied network sysctls, HugeTLB group, and any explicitly requested THP policy. A read failure, mismatched setting, or insufficient requested huge-page allocation fails the repeat before measurement. These checks validate the requested configuration; they do not recover original host settings when a saved snapshot has been lost.

Storage Requirements

Use a dedicated benchmark SUT with disposable storage and sufficient space for the pgbench dataset and PostgreSQL write-ahead log. Creating a RAID0 array formats its selected disks, and each repeat recreates the cluster in /var/lib/pgsql/data.

The workload reuses storage mounted at /var/lib/pgsql. Otherwise, it reuses an available XFS RAID0 array or creates one from eligible unused disks. If no disks are available, it uses the filesystem containing /var/lib/pgsql, which can be the container’s writable filesystem. Compare kernel results using the same storage configuration.

Initialization Options

pgbench_init_extra_args supplies additional arguments to pgbench -i during dataset creation. The default is --fillfactor=90. For multiple options, provide one YAML string, for example:

pgbench_init_extra_args: '--fillfactor=90 --foreign-keys'

To pass no additional initialization options:

pgbench_init_extra_args: ""

Execution Logs

Each role’s collected artifacts include output/exec.log for adapter progress, the framed command, and exit status. Detailed workload output and errors are saved in output/sut.log or output/ldg.log, with terminal colour codes removed. Bash pipefail preserves a nonzero workload exit through the log-filter pipeline so Fastpath reports failure.

The selected storage and setup workflow are recorded in output/exec.log.

The load generator writes parsed measurements to output/results.json. Fastpath’s adapter converts the primary measurements into results.csv. The JSON also records the client count, worker count, and duration reported by the completed pgbench run. Missing, malformed, or nonpositive primary measurements prevent successful result conversion.

Fastpath Parameters

Name

Description

workload

Default: postgresql. Workload selected by repro-collection. Must be postgresql for this benchmark.

sut_nr_cpus

Default: auto. Positive SUT CPU count, or auto to use the allocation described above. Shared-node execution reserves CPUs for the load generator.

pgbench_scale

Default: 4000. Positive dataset scale factor passed to pgbench -s during initialization.

pgbench_clients

Default: 512. Positive number of concurrent database sessions, passed with -c.

pgbench_threads

Default: auto. Positive worker count no greater than the client count, or auto to use the load generator’s available CPU count capped at the client count.

pgbench_duration

Default: 600. Positive measured duration in seconds, passed with -T.

pgbench_builtin

Default: simple-update. Built-in transaction script: tpcb-like, simple-update, or select-only.

pgbench_protocol

Default: prepared. Query protocol: simple, extended, or prepared.

pgbench_init_extra_args

Default: --fillfactor=90. Additional initialization arguments, or an empty string for none. See the initialization-option examples above.

pg_huge_pages

Default: off. PostgreSQL huge_pages mode: off, try, or on.

pg_system_nr_hugepages

Default: off. off leaves vm.nr_hugepages unchanged. on sizes the host’s static 2 MiB HugeTLB pool from PostgreSQL’s shared_buffers.

system_transparent_huge_pages

Default: off. off leaves the host THP policy unchanged. Other accepted values are always, never, inherit, and madvise; the selected policy must be supported by the running kernel.

Result Classes

The load generator reports the following primary result classes:

Name

Unit

Improvement

transaction rate

transactions/sec

bigger

average latency

ms

smaller

transaction rate is pgbench throughput excluding initial connection time. average latency is the average transaction latency reported by pgbench. The adapter requires both primary values to be positive.

References

Fastpath Metadata

Field

Value

Suite

repro-collection

Name

pgsql-workload

Type

database

Container Image

registry.gitlab.arm.com/tooling/fastpath/containers/repro_collection:v2.2

Documentation Path

documentation/user-guide/benchmarkcatalog/repro-collection-pgsql-workload.rst

Documentation URL

https://fastpath.docs.arm.com/en/latest/user-guide/benchmarkcatalog/repro-collection-pgsql-workload.html