Latest run: 2026-11-14, after migration 175
Two changes, measured back to back against the commit before them on the same machine, the same dataset and the same harness:- The overview (
/stats) read the open backlog twice per request, walking every open finding each time. It now readsfinding_open_counts(migration 175): the same counts kept per asset, kind, severity, status and first-seen time by triggers on the findings table, read in one query. - Scan ingest issued four statements per finding (a lock, an insert or update, an event, and in production two more for webhooks and notifications). It now applies a scan in chunks of 1,000 findings with a few set statements each, and asks once per scan whether anything in the organization subscribes to finding changes before announcing any.
With one client the overview is now in line with the findings listings on the
same run (29-64 ms p50), where it was three to seven times slower than them.
With 8 clients on a host this busy every route queues for CPU, and the
overview sits with them (124-304 ms p50 for the listings in the same runs).
A 50,000-finding scan result that took about five minutes to land now takes
under a minute on this machine. The rows written are the same: the lifecycle
tests pass unchanged, and every event is still linked into the
organization’s audit chain in the order the scan produced it.
Repository benchmarks, guarded by
make ci-perf-budget:
BenchmarkFindingIngestApplyScan (1,000 findings) went from about 4.4 s to
1.2 s per op, and BenchmarkOverviewCountsAtScale (100,000 findings, 10,000
assets) reads the overview’s backlog figures in 37 ms.
Previous run: 2026-11-13, after migration 167
Ingest of a 5,000-finding scan: 28.6 s on the first scan (175 findings/s) and
24.2 s on a rescan (206 findings/s). The overview (
/stats) is now the slowest
read route, and ingest rate is unchanged: a 50,000-finding result takes about
five minutes to land.
The rest of this page is the earlier, larger run, taken before migration
167. Its default-order row (459 ms) is the cost that migration removed.
What was measured (2026-11-11, before migration 167)
Because the API and the database share one busy machine, read the numbers as
relative: the same run, before and after a change, on the same host. Runs a
few minutes apart differed by up to 2x on routes no change touched.
Read routes (2026-11-11)
Latency per request, 8 concurrent clients, all responses200.
Scan ingest (2026-11-11)
One image’s scan result applied through the same store the scan worker uses (FindingWriteStore.ApplyScan), in one transaction, with the lifecycle event
and its audit hash chain written per finding.
Most of the time is in the database: each finding’s event row is linked into
the organization’s tamper-evident audit chain, which is per-organization and
therefore serial. The run uses 5,000 findings to make that cost visible; the
time grows with the number of findings in the result.
What these runs changed
Two read paths scanned the whole open backlog on every request:- The asset inventory counted open findings by severity for every asset
in the organization, and then showed 50. It now counts only for the assets on
the page. The query went from 48.7 ms to 4.0 ms (
EXPLAIN ANALYZE, 200,000 findings), the repository benchmarkBenchmarkAssetListAtScalefrom 71.8 to 12.3 ms per page, and the route under load from 349 ms to 73 ms at p50. - The overview grouped the open backlog by severity and again by kind, asset kind and severity. The severity counts are now summed from the second, which removes one of its three backlog-wide aggregates (31 of about 160 ms of database time per request). The load runs cannot separate that from the machine’s noise.
risk as a page
order, so every risk-ordered findings page failed a client that validates
responses. The specification now lists it.
The default backlog order
The findings backlog’s default order (severity, then last seen) was the slowest route measured: about 66 ms of database time per page at 200,000 findings, because no index matched that order and PostgreSQL sorted the organization’s findings for every page. Migration 167 adds an index on the order expression; with it the same query took 0.6 ms in the same database. The 2026-11-11 tables were taken before that migration; in the 2026-11-13 run at the top of this page the default order is 65 ms at p50, in line with the other orders.Reproduce
Run it from
backend/. Seeding takes about 40 seconds; the whole run about
three minutes.