Skip to content

Add the pgbench driver and its consistency check - #14

Merged
tamnd merged 6 commits into
mainfrom
pgbench
Oct 7, 2026
Merged

tamnd merged 6 commits into
mainfrom
pgbench

Conversation

@tamnd

@tamnd tamnd commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Part of #1.

What changes

  • src/pg.rs is a small client for protocol 3.0 of PostgreSQL. It uses no crate and connects over a Unix socket or TCP. It supports trust and cleartext password authentication, and the simple query protocol. spec/20 §20.9 names libpq. The harness has no dependencies, so it uses this client.
  • src/pgbench.rs reads the summary that pgbench prints and holds the consistency check of spec/21 §21.4.6. The check needs sum(abalance) = sum(tbalance) = sum(bbalance). The row count of pgbench_history must also equal the transaction count that pgbench printed.
  • rupg-bench pgbench (--unit U | --attach P) does these steps:
    1. Run pgbench -i -q -s N.
    2. Measure the idle base of the server cgroup over 10 s.
    3. Run pgbench -c -j -T and measure the server cgroup over the run.
    4. Run the check.
      A failed check makes the command fail with "wrong answer". --smoke marks the result as a smoke run. --report DIR writes the report files, and a failed run also gets them, with its error.
  • cgroup.rs: when io.stat is missing, the io bytes are now null with the text "not measured". They were 0 before. The first real run showed this: systemd does not turn on the io controller for a unit without IOAccounting=yes, so io.stat was missing and the result showed 0 bytes written.
  • machines/install/postgresql.sh now does three more things:
    • It adds a drop-in with CPUAccounting, MemoryAccounting and IOAccounting for postgresql@19-main only.
    • It makes the role bench (LOGIN, with pg_read_server_files) and the database bench.
    • It adds local all bench trust as the first rule of pg_hba.conf.
  • RUPG_BENCH_COMMIT sets the harness commit for a copy of the tree that has no .git.
  • reports/2026-10-07/de0a7ce2-server3-pgbench-smoke.md and .json are the report of the smoke run below. Their names and their first line mark them as a smoke run.

Test

srvtest passed on server3: clippy is clean and 40 tests pass. shellcheck -x is clean on the install script.

PostgreSQL REL_19_STABLE at 7d3d2db7 was built from source on server3 with machines/install/postgresql.sh. It reports PostgreSQL 19beta4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0, 64-bit.

Smoke run on server3, 7 October 2026, 09:03:45 to 09:04:34 UTC. This is not a baseline. server3 is a shared machine with 8 cores, and its load average was 77 to 84 during the run.

RUPG_BENCH_COMMIT=de0a7ce2 rupg-bench pgbench --unit postgresql@19-main --scale 1 --clients 4 --time 30 --smoke --report /root/work/reports --machine server3
Number Value
transactions 588, 0 failed
tps 19.727433
latency average 202.763 ms
server CPU over the run 2.373 s (user 1.382 s, system 0.991 s) in 31.113 s
server memory.peak 79.45 MiB, since the cgroup was created
server Pss max 56.20 MiB
server io 0.57 MiB read, 4.98 MiB written
idle base, 10 s 0.027 s CPU, 2.30 MiB written
check sums 141710, 141710 and 141710, 588 history rows for 588 transactions: passed

The sampler took 44 samples in 31 s, against 310 at 100 ms. The load of the machine causes the gap, and the result records the count. A run before the io fix also passed its check, with 731 transactions in 30 s.

@tamnd tamnd added kind/feature It does not do something that it must do. area/pgbench pgbench scripts. labels Oct 7, 2026
@tamnd tamnd self-assigned this Oct 7, 2026
@tamnd
tamnd merged commit 297bd19 into main Oct 7, 2026
2 checks passed
@tamnd
tamnd deleted the pgbench branch October 7, 2026 09:11
@tamnd tamnd mentioned this pull request Oct 7, 2026
5 of 17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/pgbench pgbench scripts. kind/feature It does not do something that it must do.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant