Skip to content

DDIR server: profile, per-operator time labelled by program statement - #989

Open
frankmcsherry wants to merge 1 commit into
master-nextfrom
ddir-profile
Open

frankmcsherry wants to merge 1 commit into
master-nextfrom
ddir-profile

Conversation

@frankmcsherry

Copy link
Copy Markdown
Member

A per-operator readout that survives short-lived programs and names operators by the program statement that built them. It grew out of #983's benchmark, where the resolver is installed and dropped every epoch and the diagnostics dataflow loses the names of operators that live under its 100 ms window.

profile (server, DDIR_PROFILE=1). Each worker records, from Timely's logs, every operator's name, address, and scheduling time, and keeps them after its dataflow is dropped. profile answers one data line per operator, largest first:

ms=121.769 share=25.3% program=res label="best" op=CorgiReduce addr=[3, 8, 18] instances=40
ms=50.152 share=10.4% program=res label="pairs" op=Join addr=[3, 8, 14] instances=40
ms=41.486 share=8.6% program=res label="best" op=CorgiArrange addr=[3, 8, 17] instances=40

ms is the operator's own time (a scope's less its children's), summed over workers and over every install of the program under that name. profile reset forgets the times. It takes Timely's "timely" logger, as the diagnostics dataflow does, so the two are exclusive; with both set, diagnostics win.

Labels (library). Lowering records, for each scope item, the statement it came from (the let, var, or export whose expression built it, or a child scope's name) in Scope::labels; optimize keeps it aligned through compaction. render_tree logs to "ddir/labels", when a logger is registered there, the range of operator identifiers each item built (LabelEvent). An arrangement a join or reduce needs is its statement's. Scopes built without labels (explain's rewrites) render unlabelled, as before. With no logger registered, nothing is logged.

Bench. bench_txn.py --profile N resets the profile after warmup and prints the top N operators over the measured rounds; the txn README's operator table now uses the labels. Overhead with profiling on is about 2% of a cycle.

Checks. cargo test -p interactive -p ddir-server (192 tests), including tests/labels.rs: every item is labelled after optimize, and rendering logs the operators each label built.

Possible follow-ons, not here: one fan-out logger so profiling and diagnostics coexist; keeping operator names in the diagnostics dataflow for short-lived dataflows; labels through explain's rewrites; per-round counts inside recursions; record counts next to times.

🤖 Generated with Claude Code

With DDIR_PROFILE=1 each worker records, from Timely's logs, every operator's
name, address, and scheduling time, and keeps them after its dataflow is
dropped, so a program loaded and dropped each epoch adds up. `profile`
answers each operator's own time (a scope less its children), summed over
workers and installs, grouped by program, statement label, operator, and
address; `profile reset` forgets the times. It takes Timely's logger, so it
is exclusive with DDIR_DIAGNOSTICS=1.

Labels: lowering records, per scope item, the statement it came from (the
`let`, `var`, or `export` whose expression built it, or a child scope's
name) in `Scope::labels`, which `optimize` keeps aligned. `render_tree` logs
to `"ddir/labels"`, when a logger is registered there, the range of operator
identifiers each item built. A row then reads `label="best" op=CorgiReduce`
rather than an address to match against the program by hand. Scopes built
without labels (explain's rewrites) render as before, unlabelled.

The txn bench takes `--profile N` (reset after warmup, print the top N), and
its README's operator table is now labelled.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant