Performance¶
How to measure the metadata walk — the process-partitioned structure where the shell is the scheduler and each command resolves one level. This page is the recipe; the numbers belong in the pull request (see the Perf box in the template).
The structure¶
Each command resolves one level and streams its children to the next stage:
$ pqb ls catalogs \
| pqb ls schemas \
| pqb ls tables \
| pqb get table \
| pqb ls files \
| pqb list columns \
| pqb format > columns.txt
The walk narrows to a catalog whose tables are externally readable. A ref the
catalog will not vend for — a system catalog table, a view, a table on managed
default storage — is dropped at the storage-reading stage with the cause, and
that level exits non-zero; scripts/dbx-walk.sh filters the listing to
pqbench_ext and skips information_schema for exactly this reason. Measure a
catalog with many tables, not one big table — the design target is "jobs are
limited not by big tables, but by the number of tables in a catalog".
One pqbench proxy in front of the endpoint caches the leases, tokens, and
catalog GETs the stages resolve and paces them together at 15/s (--rps), so a
wide fan-out queues instead of tripping the endpoint's rate limit; the proxy
never forwards the same request twice.
Point it at a target¶
The walk reads its catalog context from ~/.pqbenchrc (or PQB_ENDPOINT /
PQB_TOKEN in the environment), and external storage from AWS_REGION and the
ambient AWS credentials. See Configuration.
make dbx-walk drives the live Databricks workspace and its external
fixture: pqbench_ext, whose external Delta tables on customer S3 are the
synthetic events/sales/reference plus real sample data copied server-side
from dbx_samples (scripts/dbx-ext/). scripts/dbx-walk.sh runs the whole
walk through Unity Catalog and again through Iceberg REST, prints each level's
record count, checks that both dialects agree on the measured columns, and ends
with the column table and one file's treemap page
(the dbx-walk CI job); make dbx-e2e
runs the live correctness e2e from Python (scripts/dbx_e2e.py), and
make lakehouse drives the compose stand for the file-level commands.
The walk's catalog levels span the whole Unity Catalog; the table levels
descend the one catalog this principal may read outside compute
(PQB_WALK_CATALOG, default pqbench_ext). Unity refuses
EXTERNAL USE SCHEMA on the sample and managed-default catalogs, and a live run
shares the endpoint and is rate-limited, so the walk reads through one
pqbench proxy paced at 15/s and the script retries the walk on a transient
failure.
Run perf¶
scripts/dbx-walk.sh runs both dialects and prints each level's record count;
it profiles nothing, and make dbx-walk builds it debug. To measure, build an
optimized binary and put the walk under perf by hand — perf stat for the
cost of a run, perf record for the hot symbols. Use the events the issue
names — task-clock and context-switches are not valid event names in this
perf build:
$ cargo build --release -p pqbench-cli --features delta-s3,iceberg-s3
$ export PQB=target/release/pqbench
$ perf stat -e cycles,instructions,duration_time -r 3 scripts/dbx-walk.sh
$ perf record -g -o /tmp/perf.data -- scripts/dbx-walk.sh
$ perf report --stdio -i /tmp/perf.data --no-children | head
-r 3 repeats the run and reports the spread. Profile the cold and the warm
path (the first run pays a fresh TLS handshake). For a remote read, record wall
time and bytes read as well.
Read it¶
- Compare
cyclesandinstructionsacross the levels. A level that costs far more than one HTTPS round trip plus process startup is the one to look at. - Expect the walk to be startup-bound, not data-bound. One process per table multiplies the fixed startup — dynamic linking plus the shared HTTP client's certificate-bundle decode — by the number of tables. That is the price of process partitioning, and the numbers should show it.
- Flag obvious latency (retries, serial round trips beyond one per command, whole-object reads) and fix the obvious cause. No micro-optimization.
The proxy: caching and pacing¶
A pqbench command is a stateless HTTP client: it resolves a table's vended
lease when it reads that table and asks again for the next one. Sharing is
what a single process cannot do, so pqbench proxy owns both jobs. Catalog
requests are paced by the proxy (--rps, 15/s by default under Unity, the
catalog's per-endpoint ceiling), which every process the run starts points
PQB_ENDPOINT at: one pacer, one strict interval, so a wide --fan-out queues
instead of answering 429, and a 429 that arrives holds the slot for its
Retry-After.
The proxy is also the cache: a 200 for an OAuth token, a vended credential,
or a read-only catalog GET is held until just before the lifetime the upstream
reported, so a second process's read of the same catalog page — or the same
table's lease — costs no upstream call. An ambient "this catalog does not vend"
(400/403/404/501) is held for a cached GET's TTL too, so a table whose
catalog serves no vending route is asked once per proxy rather than once per
file; a 401 or a 5xx is never cached. It is opt-in: without it each command
is a plain HTTP client. A catalogs/local/… read never vends and never asks
the catalog.
Measure the walk on your own catalog: the proxy turns a per-file question into one upstream call and a burst into a rate the endpoint allows.