Repository navigation
perf(daemon): env-gated ZCCACHE_HIT_TRACE dump for hit-path sub-phase data - #470
Merged
Merged
Conversation
) Add `ZCCACHE_HIT_TRACE=1` env var that makes the daemon emit a one-line stderr summary per warm hit through the slow path (hash source + hash headers). Lets the perf harness decompose the dominant "metadata cache (source+hdrs)" phase (995µs/event on the canonical cold-tar-untar-warm/medium scenario, 5.6× larger than the next phase). Output shape: ZCCACHE_HIT_TRACE source_us=12 headers_count=47 headers_us=983 \ hdr_avg_us=20 source_path=/path/to/foo.cc Pipe through `awk '/ZCCACHE_HIT_TRACE/'` over a session's daemon log to histogram which compiles have the highest header count and per-header cost — informs whether the slow path is dominated by header count (parallelism overhead) or per-header rehash work. Also: `ci/perf_local.py` now passes through any `ZCCACHE_*` env var to the Docker container so the in-container daemon inherits the flag. The env check is one `var_os` probe per warm-hit (~50ns); cost is negligible when the flag is unset. Closes #468 Co-Authored-By: Claude Opus 4.7 <[email protected]>
The earlier `let mut hit_trace_headers_count: usize = 0;` at the top of the if/else triggered `value assigned ... is never read` on the context_is_cold branch (the value is only read inside the else block where it's also written). Move the binding inside the else. Co-Authored-By: Claude Opus 4.7 <[email protected]>
zackees
added a commit
that referenced
this pull request
Jun 19, 2026
…#781) First zccache surface that calls the v2 broker API. New module `zccache::ipc::broker_v2` with `connect_v2_broker(wanted_version) -> Result<ClientSession, BrokerV2Error>` wrapping `running_process::broker::client_v2::connect("zccache", ...)`. Also bumps the [patch.crates-io] running-process pin to e64f6ff to pick up running-process #492 (BackendHttpReady plumbing), #493 (GetBrokerHttpEndpoint RPC dispatch), #494 (env overrides), #495 (broker HTTP server scaffold), and #496 (aggregator page top-bar + iframe) — all of which are in-tree but unreferenced by zccache yet. v1 callers are deliberately untouched: v2 ships alongside v1 per the coexistence table in upstream #470. Each subsequent slice replaces one more of zccache's 62 v1 broker references with a v2 path. One unit test covers the typed BrokerV2Error::Dial path with no broker running — the same shape the rest of the migration will pattern-match on. Refs #777 Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Jun 19, 2026
zackees
added a commit
that referenced
this pull request
Jun 20, 2026
…lice 24 of #782) (#857) zccache#782 slice 24 — completes the v1→v2 import migration for broker-side process identity. Five call sites swap their import path from \`running_process::broker::backend_handle::*\` to \`running_process::broker::protocol_v2::backend_handle::*\`: - \`ipc/mod.rs\`: \`running_process_endpoint\`, \`current_backend_identity\`, \`write_backend_identity\`, \`probe_backend_handle\` (4 signatures) - \`daemon/server/state.rs\`: \`backend_identity: DaemonProcess\` field - \`daemon/server/lifecycle.rs\`: \`backend_identity()\` getter Per upstream PR #527 (slice 23-B), the v2 namespace types are TypeId-identical to v1's — these symbols are intentionally cross-version-stable per #470's coexistence design. The migration is a pure import swap with zero behavioural change. ## Why this matters Removes 5 v1 \`broker::backend_handle::*\` import paths from zccache production code. The remaining v1 imports in broker.rs (adopt / client / BrokerClientError) require actual v2 broker scaffold functionality (accept loop, hello router consuming v2 servicedef files) that's still in flight upstream — those are slice 25. After this slice, the only v1 \`broker::backend_handle::*\` reference in zccache is the manifest.rs doc comment, which is informational. ## Pin bump bundled Bumped \`running-process\` pin to \`d0299b3\` (post-#527 main). ## Test plan - [x] \`soldr cargo clippy -p zccache --all-targets -- -D warnings\` clean. - The upstream TypeId-equality test (\`v1_and_v2_backend_handle_types_are_the_same\` in #527) guarantees the swap is behaviour-preserving — zccache's test suite would catch any drift if the upstream types accidentally forked. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
ZCCACHE_HIT_TRACE=1env-gated stderr dump inpipeline.rsthat emits one line per warm hit through the hash-headers slow path withsource_us,headers_count,headers_us,hdr_avg_us, and the source path. Lets the perf harness decompose the dominant 995µsmetadata cache (source+hdrs)phase into actionable sub-components.ci/perf_local.pynow propagates anyZCCACHE_*env var to the in-container daemon, so:```
ZCCACHE_HIT_TRACE=1 uv run python ci/perf_local.py --scenario cold-tar-untar-warm --fixture medium
```
…produces per-hit lines you can pipe through awk/grep to histogram which compiles are paying the most for header re-hashing.
Why
The
metadata cache (source+hdrs)phase (=hash_source_ns + hash_headers_ns) dominates the warm hit budget at 5.6× the next phase. Without sub-phase data we can't tell if the cost is:The dump gives us the per-call shape directly. Findings feed into follow-up issues (#469 already filed: the slow-path is dominating because mtime-precision asymmetry causes stat-verify to fail post-tar/untar).
Cost
One
std::env::var_oscall per warm hit (~50ns) when the env is unset — negligible. When set, oneeprintln!per non-fast-hit compile.Test plan
soldr cargo check -p zccacheZCCACHE_HIT_TRACE=1confirms the env var propagates into the containerCloses #468
🤖 Generated with Claude Code