Skip to content

Do not symbolize trace_log in the flush thread in the performance comparison - #133126

Open
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:perf-trace-log-no-symbolize
Open

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:perf-trace-log-no-symbolize

Conversation

@groeneai

@groeneai groeneai commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #131393

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Description

Performance Comparison (amd_release, ...) fails with Query <test> #<i> time keeps growing with each run on queries that do the same work every run: 8 times in 30 days (e.g. 1, 2, 3), 4 of them on #131393.

perf.py profiles every query whose time changed for 10 s, with the query profilers and allocation sampling into trace_log: 300K-500K rows per flush. trace_log symbolizes every frame in the flush thread by default, and both servers are pinned to the same 8 CPUs, so that thread takes seconds of CPU from the query measured next. In [1], the trace_log flushes cost Block = 292 s / 279 s per server (Insert 13 s), and group_by_fixed_keys #22, with flat UserTime and read_rows, has OSCPUWait 46-55 ms in runs 0-3 and 0.7-1.3 s in runs 4-6, while the two servers flush.

The report never reads those symbols: compare.sh dumps only trace and resolves names with addressToSymbol. So this sets <trace_log><symbolize>false</symbolize></trace_log> in the perf config, as tests/config/config.d/trace_log_no_symbolize.xml does for the coverage and sanitizer jobs. Both servers get it (the left config is a copy of the right one). Trade-off: the perf servers' trace_log rows exported to the CI Logs cluster have empty symbols/lines, as in those jobs; the exported perf_flamegraph_stacks_v1 stacks keep their resolved names.

Validation, on the reference binary of [1] with perf.py's profile-run settings: the largest trace_log flush went from Block=4733ms (433K rows) to Block=133ms, Insert=113ms (359K rows), and addressToSymbol still resolves every row.

This removes a cause of the false trips; #132631 changes the check.


Workflow [PR]
Sync PR [sync-upstream/pr/133126]

…parison

perf.py profiles every query whose time changed for --profile-seconds with
the query profilers at 10 ms and allocation sampling into trace_log, which
gives 300K-500K trace_log rows per flush. trace_log symbolizes every frame
in the flush thread by default (symbol lookup, demangling and DWARF line
lookup per frame), and both perf servers are pinned to the same 8 CPUs, so
that thread takes seconds of CPU from the query measured next. On ClickHouse#131393
(ef42356, shard 6/6) the trace_log flushes cost Block = 292 s / 279 s per
server against Insert = 13 s, and group_by_fixed_keys ClickHouse#22, which does the
same work every run, has OSCPUWait 46-55 ms in runs 0-3 and 0.7-1.3 s in
runs 4-6 while the two servers flush, so the run-trend check reports
"time keeps growing with each run".

The report never reads the symbols: compare.sh dumps only `trace` and
resolves the names itself through addressToSymbol/addressToLine, and the
stacks tables, the flame graphs and perf_flamegraph_stacks_v1 are built
from that. So disable `trace_log.symbolize` in the perf config, as
tests/config/config.d/trace_log_no_symbolize.xml does for the sanitizer
and coverage functional jobs. Both servers get it: the left config is a
copy of the right one. The key exists since 25.1.

Trade-off: the perf servers' trace_log rows exported to the CI Logs
cluster have empty `symbols`/`lines`, as in those functional jobs.

Measured on the reference binary of that job with perf.py's profile-run
settings: the largest trace_log flush went from Block=4733ms (433K rows)
to Block=133ms, Insert=113ms (359K rows); SYSTEM FLUSH LOGS from 2.1-5.0 s
to 0.2 s; addressToSymbol still resolves every row.

Related: ClickHouse#131393

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 1 finding), plus my own cold review (0 findings).

# Sev Finding Verdict Evidence / action
1 ⚠️ release_base comparisons check out tests/performance at the release vintage (ci/jobs/performance_tests.py:3153-3157), so they keep the old config DISAGREE No release_base comparison is scheduled: performance_comparison_with_release_base_jobs (ci/defs/job_configs.py:2150) is used by no workflow, CIDB has no such job since 2026-10-13, and all 9 time keeps growing failures in 30 days are master_head. The vintage picks the key up from the next release branch.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding.

Session id: cron:clickhouse-review-slot-8:20261120-021700

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? For the cost, yes: on the reference binary of the failing job, every 10-s run with perf.py's profile-run settings produced trace_log flushes of 116K-433K rows at Block = 1.4-4.7 s (6/6 flushes, 3/3 runs). The trend failure itself comes from the CI job's own logs (OSCPUWait jumps exactly during the flushes); one local server under box noise does not trip the check.
b Root cause explained? Profile runs write 300K-500K trace_log rows per flush; trace_log symbolizes every frame in the flush thread by default (symbol lookup, demangling, DWARF lines); both perf servers share the same 8 CPUs, so the flush takes seconds of CPU from the next query's later runs, which then grow over the run-trend threshold.
c Fix matches root cause? It removes exactly the in-flush symbolization. Samples, trace addresses, the report and the flame graphs are unchanged; no check, threshold or profiling rate is touched.
d Test intent preserved / new tests added? No test changed. Test-infrastructure change, so no self-test (#119766); validated locally.
e Both directions demonstrated? Same binary and workload, master's config vs this one: largest flush Block=4733ms (433K rows) vs Block=133ms, Insert=113ms (359K rows); SYSTEM FLUSH LOGS 2.1-5.0 s vs 0.2 s; symbolized rows 100% vs 0%.
f Fix is general across code paths? Every copy of the perf config dir gets it (right server, the left server's copy, compare.sh configure, collect_clickhouse_profiles.py, performance_coverage.py, double_check_perf.py); none of them reads symbols/lines.
g Fix generalizes across inputs (params/datatypes/wrappers)? All trace types the profile runs produce (Real, CPU, Memory, MemorySample, MemoryPeak, JemallocSample) are unsymbolized and still resolve through addressToSymbol.
h Backward compatible? (maintainer-approved exception only) CI config only. The symbolize key exists since 25.1, so every reference binary of a supported release accepts it.
i Invariants and contracts preserved? The report reads only trace, so its inputs are the same. Trade-off: perf trace_log rows exported to the CI Logs cluster have empty symbols/lines, as in the sanitizer and coverage functional jobs.

Session id: cron:clickhouse-impl-slot-6:20261120-014700

@clickhouse-gh

clickhouse-gh Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0493157]

Summary: ✅


AI Review

Summary

Disables trace_log.symbolize on both performance-comparison servers to reduce background CPU contention during query measurements. No actionable findings at PR head 049315729ce95e16d84bb5ddd29985f7c6cb1afc. The reported same-binary comparison reduces the largest flush from 4733 ms to 133 ms and verifies that deferred symbol resolution still works; this is sufficient evidence for this CI configuration change. No local benchmark was rerun.

Consumers checked for the resulting empty symbols and lines arrays:

  • compare.sh extracts trace and resolves names through addressToSymbol and addressToLine before building flame graphs.
  • The perf_flamegraph_stacks_v1 upload consumes those resolved stack files.
  • CI log export preserves the rows with empty arrays, the documented diagnostic tradeoff.
  • Performance coverage and PGO/BOLT collection use separate instrumentation outputs and do not read these arrays.
  • The local performance helper copies the same configuration; its perf.py measurements do not consume these arrays.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-ci can be tested Allows running workflows for external contributors labels Nov 20, 2026

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

can be tested Allows running workflows for external contributors comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant