PostgreSQL under pgbench: no filter and Heimdall's static filter
Lane bench-pg, 2026-11-09. A real container workload, the official PostgreSQL 17.11 image under pgbench, with the server container unfiltered (none) and under Heimdall's static filter (static): a floor that heimdall profile gen generated from LOG runs of this workload, compiled by Heimdall's own builder inside youki. The graph filter's row is pending: the harness refuses --mode graph and writes no number for it.
The harness is dwarves' ci-verbs bench-filter (ci/verbs/src/bench_filter.rs). Every number below comes from the receipts beside this file: results/<host>-<date>/receipts/*.json, one per run, and summary.json / summary.md, written by ci-verbs bench-filter --summarize.
One host, one workload, static filter only. Two hosts were used, one after the other, and their numbers are not mixed: the floor, the LOG runs and the first pairs were made on oden; oden was then taken away, and the bench was repeated in full on build-1, a different and busier host.
Result: build-1, 15 pairs (2026-11-09)
build-1: a VM with 16 vCPUs of an AMD EPYC 9575F, Ubuntu 24.04.5, kernel 6.8.0-147-generic, rootful podman 4.9.3, shared with other lanes. The server on vCPUs 4-11, the client on vCPUs 12-15, nice 10. Load average (1 min) 48 to 99 during the runs. This host is not oden: the numbers below are build-1's only (results/build-1-2026-11-09).
| phase | metric | none (median) | static (median) | static vs none: median of the pairs | range |
| read-write | TPS | 2032.1 | 2044.3 | -0.21 % | -54.11 % to +210.66 % |
| read-write | latency average (ms) | 7.874 | 7.827 | +0.21 % | -67.81 % to +117.91 % |
| read-write | p50 (ms) | 6.592 | 6.789 | +3.78 % | -79.76 % to +119.40 % |
| read-write | p99 (ms) | 27.583 | 25.053 | +13.20 % | -55.33 % to +94.39 % |
| read-write | server CPU per transaction (µs) | 282.7 | 286.2 | +1.09 % | -31.37 % to +52.82 % |
| read-write | of it in the kernel (µs) | 94.7 | 94.3 | +1.82 % | -24.20 % to +25.41 % |
| read-only | TPS | 19603.7 | 19927.5 | -10.46 % | -58.88 % to +98.71 % |
| read-only | latency average (ms) | 0.816 | 0.803 | +11.71 % | -49.68 % to +143.04 % |
| read-only | p50 (ms) | 0.166 | 0.165 | +0.68 % | -40.27 % to +59.85 % |
| read-only | p99 (ms) | 7.776 | 7.907 | +8.89 % | -42.49 % to +98.19 % |
| read-only | server CPU per transaction (µs) | 39.4 | 39.9 | +1.76 % | -28.15 % to +35.48 % |
| read-only | of it in the kernel (µs) | 15.2 | 15.6 | +0.91 % | -22.65 % to +27.36 % |
System calls of the server's cgroup, from one count run per mode after the pairs (perf stat -e raw_syscalls:sys_enter, not timed, not paired): 41 per read-write transaction and 7.4 per read-only transaction, in both modes (none 41.1 and 7.40, static 40.9 and 7.39), the same as on oden.
0 kills in all 32 runs (30 timed, 2 counted): every static run's server had Seccomp: 2 with 1 filter, every none run's Seccomp: 0.
What the numbers say
- The filter's cost is far below what this host can resolve. Every median is within a few percent of zero, and every range is tens of percent wide on both sides: static was slower in 8 of the 15 read-write pairs and 10 of the 15 read-only pairs, faster in the others. That is the host's other work, not the filter.
- The expected cost is about 0.3 % of the server's CPU. A call the floor allows bare costs about 20 ns (
bench/floor-cost; and theddcheck below: +18 to +19 ns). 110 of the floor's 112 calls are bare allows, which the kernel answers from its action cache; onlymmapandmprotectrun the program. Per read-write transaction: 41 calls × ~20 ns ≈ 0.8 µs of about 280 µs of server CPU (≈ 0.3 %). Per read-only transaction: 7.4 calls × ~20 ns ≈ 0.15 µs of about 40 µs (≈ 0.4 %). The measured CPU per transaction, +1.1 % and +1.8 % with ranges of ±30 to 50 %, is consistent with that and cannot confirm or refine it. - TPS and latency move most with the load, CPU per transaction less, but on this VM even CPU per transaction moved by up to ±50 % between the two runs of a pair.
- To resolve a cost of 0.3 %, the bench needs a quiet host (or many more pairs): the next run of the same command on an idle machine is the way to get that number.
Earlier results on oden (partial, not mixed with build-1)
oden: AMD Ryzen Threadripper PRO 3975WX (32 cores, no SMT), Ubuntu 26.04.1, kernel 7.0.0-42-generic, rootless podman 5.7.0, server on CPUs 16-27 (three L3 groups), client on CPUs 28-31, nice 10, load average 34 to 59 during the runs (other lanes compiled at nice 0 on every CPU).
5 pairs with the CPU metric (harness dwarves 3175de2), stopped when oden was taken away; fewer than the 9 pairs a published number needs, so read it as a first look only (results/oden-2026-11-09-partial):
| phase | metric | none (median) | static (median) | static vs none: median of the 5 pairs | range |
| read-write | TPS | 25063.6 | 21540.8 | -16.65 % | -39.08 % to +103.34 % |
| read-write | p99 (ms) | 2.109 | 2.468 | +40.52 % | -58.61 % to +71.57 % |
| read-write | server CPU per transaction (µs) | 251.1 | 254.4 | -0.31 % | -2.79 % to +3.43 % |
| read-write | of it in the kernel (µs) | 63.6 | 66.2 | +4.08 % | -1.08 % to +4.42 % |
| read-only | TPS | 144744.0 | 139717.4 | +7.31 % | -3.47 % to +36.35 % |
| read-only | p99 (ms) | 0.394 | 0.354 | -14.98 % | -55.34 % to +22.61 % |
| read-only | server CPU per transaction (µs) | 40.3 | 40.1 | -0.77 % | -4.51 % to +4.21 % |
| read-only | of it in the kernel (µs) | 11.0 | 11.4 | +0.08 % | -1.39 % to +3.55 % |
In 4 of these 5 pairs static's kernel CPU per read-write transaction was +3.9 to +4.4 % (about +2.6 µs per transaction, some 60 ns per call), more than the ~20 ns per call measured below; read-only showed nothing of the kind. build-1's 15 pairs do not show it (+1.8 %, -24 to +25 %). With 5 pairs on a busy host this is an open question, not a finding: a quiet host would answer it.
Before that, 7 pairs of the first harness version (dwarves 9e069bc, TPS and latency only, no CPU metric) were stopped to add the CPU metric, because one run's TPS moved by tens of percent with the host's other work (results/oden-2026-11-09-aborted-v1; its receipts predate the CPU fields, so --summarize of today's harness refuses them). Over its 6 complete pairs static's read-write TPS was -34 % (median), ranging from -44 % to +44 %: the same spread.
A check outside the harness, on oden in the same containers: dd with 1-byte blocks (10 M read and write calls) took 1.64 and 1.66 s unfiltered and 1.82 and 1.85 s under the floor, +18 to +19 ns per call, the cost bench/floor-cost measured for a call the kernel answers from its action cache.
Limits
- One workload, and one host per result. PostgreSQL 17.11 under pgbench only, one set of parameters (scale 50, 16 clients, 4 threads, the image's default
postgresql.conf). The published 15 pairs ran on build-1; oden's pairs are partial and kept apart. Other programs make other calls at other rates. - Busy, shared hosts. build-1 is a VM shared with other lanes: its 1-minute load average was 48 to 99 on 16 vCPUs during the bench, and the bench ran at nice 10, below most of that work. A vCPU's time can also be taken by the host. oden had a load of 34 to 59 on 32 CPUs. The load average is in every receipt (
host.load_before,host.load_after). The pairs alternate their order, so slow drift of the load falls on both modes alike, but a burst of other work falls on one run only: that is the width of the ranges above. - build-1 is not oden. Another CPU (AMD EPYC 9575F, virtualized), another kernel (6.8), rootful podman 4.9.3 instead of rootless 5.7.0, and fewer CPUs for the bench (8 for the server instead of 12). Its absolute numbers are not comparable with oden's.
- Static filter only. The graph filter's row is pending (see "The graph row" below).
- Data on tmpfs.
fsyncandfdatasynccost almost nothing there, so the server spends more of its time in the calls the filter checks than it would on a disk. On a disk the I/O time would make any filter cost smaller still. This is the harder case for the filter. - Only the server is filtered. The pgbench client runs in its own container, unfiltered and the same in both modes.
- The floor fits this workload only. It holds the 110 calls the two LOG runs saw (plus the kernel-implied base set), nothing else. A path these runs did not take (replication, an extension, crash recovery,
COPY ... PROGRAM,archive_command,pg_dump) may need a call the floor kills. A production floor needs LOG runs of those paths too; this one is for the bench. - The harness changed during the work. oden's first 7 pairs ran without the CPU metric (dwarves 9e069bc); the CPU metric came in 3175de2, root support for build-1 in 6825173. Each result directory names the version it ran with.
- The runtime is a patched youki. youki's own init paths still call libseccomp; the patch (
scripts/youki-heimdall.patch, 72 added lines) adds a backend registration and registers heimdall-youki's backend when the binary is namedyouki-heimdall. Without it, youki would compile the same profile with libseccomp instead of Heimdall's builder. - CPU per transaction is the server's whole cgroup. It includes the backends, the background processes (WAL writer, checkpointer, autovacuum) and the few milliseconds of the client container's start and end inside the window. Other work on the same CPUs still costs the server cache and memory bandwidth, so this number moves too, but far less than TPS.
- Latency percentiles are sampled. pgbench logs 5 % of the transactions (
--sampling-rate 0.05); p50 and p99 are nearest-rank over those samples (tens of thousands of read-write and hundreds of thousands of read-only samples per run). - The system call rate is from separate count runs.
perf stat -e raw_syscalls:sys_enteron the server's cgroup, one run per mode after the pairs. It is never measured in a timed run: the tracepoint puts every task on the slow system call entry path, the path a filtered task takes anyway, and so would hide part of the filter's cost.
Method
Workload
- Image
docker.io/library/postgres@sha256:996e9dc583ba9f0265a2c75547a9c95fb22c251e394749cab205a0a00e1856a1(the official image, PostgreSQL 17.11, Debian 17.11-1.pgdg13+2; local image IDeb0fb2377534…), pinned by digest. pgbench comes from the same image. - One template data directory per bench, made unfiltered: the image's entrypoint runs initdb (
POSTGRES_HOST_AUTH_METHOD=trust), thenpgbench -i -s 50and aCHECKPOINT. Every run starts from a fresh copy of it on tmpfs (build-1:/dev/shm, 32 GB, copied as root; oden:$XDG_RUNTIME_DIR, 50 GB, copied withpodman unshare cp -a). - Per run: read-write (TPC-B-like) warm-up 15 s, read-write measured 60 s (
-n -l --sampling-rate 0.05),CHECKPOINT, read-only (-S) warm-up 15 s, read-only measured 60 s. 16 clients, 4 threads, over the server's Unix socket in a shared directory. - Per measured phase: TPS and the latency average from pgbench's summary, p50 and p99 from its transaction log, and the server's CPU time per transaction from its container cgroup's
cpu.stat(usage_usec, andsystem_usecfor the kernel part), read just before and just after the phase and divided by the phase's transactions. - The server runs with the image's defaults (
shared_buffers128 MB,fsyncon) and no network (--network none).
Containers
- build-1: rootful podman 4.9.3 (as root) on Ubuntu 24.04.5, kernel 6.8.0-147-generic, a VM with 16 vCPUs of an AMD EPYC 9575F, 62 GB, cgroup v2. oden: rootless podman 5.7.0 on Ubuntu 26.04.1, kernel 7.0.0-42-generic. The same binaries on both (sha256 below).
- Runtime
youki-heimdall: youki 0.7.0 from the fork Ignalina/youki, branchfeat/seccomp-backend-trait(5aeca235, the trait of youki PR #3873), withscripts/youki-heimdall.patch, built with--features systemd,v2,seccomp; sha256650339b6a2f6b40cf2d4bc474c40e5587e4bc29b3fa0082a6a1e8c70848048a3. Namedyouki-heimdall, it compiles every container'slinux.seccompwith heimdall-youki (compile_oci_json: the arch check, the x32 kill, the kernel-implied base set, the profile's rules, defaultKILL_PROCESS) and refuses a profile Heimdall does not read. Before the first static run the bench checks this: the runtime must refuse moby's kind of profile (defaultERRNO) with "heimdall seccomp backend", where libseccomp would load it. - Both modes use the same runtime,
--security-opt no-new-privileges(the filter is installed just before the entrypoint's exec) and the same mounts. The server lines differ only inseccomp=unconfined(none) andseccomp=<the floor>(static). Every run reads the server's/proc/<pid>/status: none hasSeccomp: 0, staticSeccomp: 2with 1 filter; a receipt that says otherwise is refused.
Pinning
build-1: the server on vCPUs 4-11, the client on vCPUs 12-15 (12 of 16 in all). oden: the server on CPUs 16-27 (three whole L3 groups of 4 cores), the client on CPUs 28-31 (one L3 group). Both through taskset and nice -n 10, inherited by conmon and the container. Every run reads the server's Cpus_allowed_list and nice value from /proc and refuses a run whose pinning did not hold.
Pairs
15 pairs. Pair p runs none then static when p is even, static then none when it is odd. The summary takes, per pair, static's value against none's (in %), and reports the median of the 15 with its range (min to max), as bench/floor-cost reports its rows. Kills are counted per run from the kernel log (audit type 1326 with sig=31 naming one of the image's programs) and from the server's log (terminated by signal 31); a run with a kill gives no number.
The floor: from LOG runs only
The floor was made by tools from evidence, never by hand:
- LOG runs (
scripts/logrun.sh): the server container under a profile whose default isSCMP_ACT_LOG(scripts/log.json;clone3answeredENOSYSas the floor answers it), with youki's libseccomp backend (the same binary, namedyouki), andheimdall profile probe-logas the kernel's audit daemon, started before the container. Each run covers the container's whole life: initdb and the entrypoint's temporary server, the start,pgbench -i -s 50, read-write, read-only,CHECKPOINT,VACUUM ANALYZE, read-write again (autovacuum ran on three tables), and the shutdown (fast shutdown, with its checkpoint). The client was unfiltered, so only the server container's calls were logged.
| run | pgbench | audit records | distinct calls | records lost |
| log1 | rate-limited (-R 1500 read-write, -R 4000 read-only), 120 s per phase |
19,419,363 | 110 | 0 |
| log2 | full speed, 60 s per phase | 28,610,612 | 110 | 128,053,994 |
log1 lost no record. The reviews print the kernel's lost counter, which counts since the host booted: it read 621,238 after an earlier smoke run and still 621,238 after log1, and 128,675,232 after log2. log2 lost records at full speed, and saw exactly the same 110 calls as log1.
-
Merge and generate (
scripts/genfloor.sh):heimdall profile mergeof the two evidence files intofloor/postgres-pgbench/x86_64-glibc.probe.json, thenheimdall profile gen postgres-pgbench --libc glibc --allow-marked. The floor was made from runs with lost records: both end lines saystopped INCOMPLETE(log2 lost records at full speed; log1's line carries the kernel counter's 621,238 from before it started), sogennames both as marked runs and makes the profile only with--allow-marked, which the script passes on purpose. The result: 113 rules, 112 calls allowed (the 110 seen, plusexitandrestart_syscallof the base set),clone3answeredENOSYS, defaultKILL_PROCESS, 0 near-miss, 0 W|X left out;mmapandmprotectkeep their W|X rule, every other call is a bare allow. The floor isfloor/postgres-pgbench/x86_64-glibc.oci.json, sha25634d0b9422e8e59567cec872a8073563e18da3f2b3bf68acf8e501711ea8518a2. Generating it again from the evidence gives the same bytes. -
Who made the calls: postgres itself 81 of the 110; the other 29 only by the entrypoint's tools and the runtime (gosu:
setuid,setgid,setgroupsand the Go runtime's calls; bash, dash, find, chmod, chown, ls, psql; youki's init after the filter is installed:sendmsg,accept4,statx). One filter covers the whole container, because seccomp is inherited across exec. -
0 kills under enforce before measuring (
scripts/enfrun.sh): the same lifecycle as the LOG runs at full speed, with the server enforced under the floor byyouki-heimdall, once on each host: enf1 on oden (kernel 7.0) and b1-enf1 on build-1 (kernel 6.8, before its pairs). Both: server exit 0,Seccomp: 2with 1 filter, 0 kill records in the kernel log, 0 failed transactions. Every timed run checks again: 0 kills in all 32 build-1 runs and in all of oden's.
The floor was made on oden and used unchanged on build-1. Files: log-runs/log1, log-runs/log2 (the evidence, the probe-log review, the client's and the server's logs), enforce-check/enf1 (oden), enforce-check/b1-enf1 (build-1), floor/postgres-pgbench.
Reproduce
On a Linux host with podman (rootless, with sudo for the audit daemon, dmesg and perf; or as root), cgroup v2 and taskset. The scripts expect the lane layout $L/{heimdall,dwarves,edda,youki,bin,floor,runs,results} (L defaults to ~/lanes/bench-pg; build-1 used L=/work3/bench-pg).
# Heimdall's CLI (heimdall main dab750ca), static musl, in the toolchain container
cargo build --release --locked -p nordisk-heimdall-cli --target x86_64-unknown-linux-musl
# youki-heimdall: Ignalina/youki feat/seccomp-backend-trait 5aeca235 + scripts/youki-heimdall.patch
cargo build --release -p youki --no-default-features --features systemd,v2,seccomp
cp target/release/youki bin/youki-heimdall; cp target/release/youki bin/youki
# the bench verb: dwarves main, ci/verbs (edda beside dwarves)
cargo build --release --manifest-path dwarves/ci/verbs/Cargo.toml
# LOG runs, the floor, the enforce check
scripts/logrun.sh log1 # LOGARGS="throttled 50 16 4 120"
LOGARGS="full 50 16 4 60" scripts/logrun.sh log2
scripts/genfloor.sh runs/log1/evidence.json runs/log2/evidence.json
scripts/enfrun.sh enf1
# the bench: build-1, as root
L=/work3/bench-pg WORK=/dev/shm/bench-filter SCPU=4-11 CCPU=12-15 PAIRS=15 \
scripts/bench.sh /work3/bench-pg/results/2026-11-09-build-1
scripts/bench.sh is this line:
ci-verbs bench-filter --workload postgres-pgbench --mode none,static --runs 15 \
--out <dir> --work /dev/shm/bench-filter \
--image docker.io/library/postgres@sha256:996e9dc583ba9f0265a2c75547a9c95fb22c251e394749cab205a0a00e1856a1 \
--runtime bin/youki-heimdall --floor floor/postgres-pgbench/x86_64-glibc.oci.json \
--heimdall bin/heimdall --heimdall-commit dab750ca0e7e53d84efcf9a39c5d3572438b576a \
--server-cpus 4-11 --client-cpus 12-15 --nice 10 \
--scale 50 --clients 16 --threads 4 --seconds 60 --warmup 15 --sampling-rate 0.05 \
--kernel-log dmesg --count-syscalls perf
(As a rootless user: --kernel-log "sudo -n dmesg" --count-syscalls "sudo -n perf".)
ci-verbs bench-filter --summarize <dir> rewrites summary.json and summary.md from the receipts alone.
The graph row
The 2026-11-10 graph-input checkpoint records the pinned server's C capture, binary scan, real server-only call pairs, order graphs and Heimdall check outputs. The latest source graph retains 65,232 unresolved sites; both source-only and binary-assisted checks refuse import before pair coverage. Source/native binding and dynamic-image admission are also open. Graph construction timing is recorded separately and is not a PostgreSQL filter-performance result.
The harness takes the mode as a parameter. --mode graph is refused before anything runs, and no number is written:
$ ci-verbs bench-filter --workload postgres-pgbench --mode none,static,graph --runs 15 ...
bench-filter: graph mode needs a complete graph of the workload; not wired yet
(exit 2)
The graph row needs a complete graph of this workload (postgres, the entrypoint's tools, gosu and youki's init) and the follower attached to the server's container. When that exists, the places to wire in dwarves ci/verbs/src/bench_filter.rs are refuse_unwired, the Mode::Graph arm of server_command (the floor, plus the follower attached on the server container's cgroup), and validate (a graph receipt must name the graph digest and the follower's violation count). The same command with --mode none,static,graph then gives the third column, paired against the same none runs.