Repository navigation
Add stateful storage memory profiler - #115675
Conversation
Bundle the stateful profiler in clickhouse-examples and add a separate report job that reuses the parser memory check's stack correlation and flamegraph helpers. Related: ClickHouse#96199 Reference report: https://s3.amazonaws.com/clickhouse-test-reports/PRs/96199/cd143e56627fbed82d9a5295e4733fe6c060efa5/parser_memory_check/parser_memory_report.html
|
Workflow [PR], commit [e12888a] Summary: ✅
AI ReviewSummaryThis PR adds a stateful Missing context / blind spots
Findings
|
Use memory-tracked argument storage, keep the multipart-query container explicitly annotated for its fixed API, replace direct standard streams, and forward-declare the context types used by the header. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115675&sha=9072a506700ff5ca3914c44d3c3769d66ec67166&name_0=PR&name_1=Style%20check
Let temporary-directory cleanup errors propagate instead of catching every exception. This also satisfies the catch-all style check.\n\nCI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115675&sha=e99851d9cad8efd3be568f8f0c2686d685f2ea28&name_0=PR&name_1=Style%20check\n\nRelated: ClickHouse#115675
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Object file sizes3 object files changed (+175.84 KiB total), 1 added.
737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units91 translation units recompiled, 207 s compile time in total, 90 of them have a recent master baseline. Median compile-time ratio to the baselines is ×1.06 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. Translation units without a recent master baseline:
|
Keep a persistent session context across scenario statements, wait for index and projection materialization, and initialize the dedicated MergeTree jemalloc arena before loading storage state.\n\nRelated: ClickHouse#115675
| } | ||
| fmt::print(stdout, "\n#\ncheckpoint\tallocated_bytes\tdiff_from_start\tdiff_from_prev\n"); | ||
|
|
||
| /// Initial measurement |
There was a problem hiding this comment.
The profiler records the start checkpoint before it has executed any query at all. That means after_01_create_table also pays all the one-time executeQuery/parser/analyzer/interpreter initialization that is triggered by the first statement in the process, so the first scenario is no longer measuring only storage-state allocations.
That breaks the attribution this report is supposed to provide: a PR that changes generic query-framework memory can show up as a "create table" regression here. parser_memory_profiler already had to add an explicit warmup for exactly this reason. Please run and discard a trivial warmup query before taking the initial heap dump so the scenario deltas start from a warmed execution path.
| </div> | ||
| <div class="summary-item"> | ||
| <span class="summary-label">Queries</span> | ||
| <span class="summary-label">{html_escape(item_label)}s</span> |
There was a problem hiding this comment.
This helper still serves parser_memory_check, and with the default item_label="Query" this now renders Querys in the summary header. Appending "s" is not safe once the label became configurable.
Please pass the plural form explicitly (for example a separate item_label_plural parameter) instead of deriving it with f"{item_label}s".
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=6 K_base=20 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
aea04d6
Run the stateful storage scenarios as a separate check while reusing the existing parser memory reporting helpers and the clickhouse-examples artifact. Related: ClickHouse#115675
Adds a stateful storage memory profiler alongside the existing AST memory profiler in
clickhouse-examples. The newstorage_memory_profilerkeeps one ClickHouse context alive while it executes ordered SQL scenarios and records a jemalloc heap checkpoint after each scenario.The separate
storage_memory_check.pycompares each master/PR checkpoint transition and reuses the existing batch symbolization, stable stack canonicalization, cross-version diff, flamegraph, and HTML report implementation. The scenarios cover table creation, inserts, skip indexes, projections, dictionaries, multiple tables, 1,000 active parts, system metadata, and cleanup.This implementation PR intentionally does not wire the job into public or private CI configuration. After it merges and the command is present in the published master
clickhouse-examplesartifact, a short-lived follow-up PR will contain only the CI configuration changes.Related: #96199
Reference report: https://s3.amazonaws.com/clickhouse-test-reports/PRs/96199/cd143e56627fbed82d9a5295e4733fe6c060efa5/parser_memory_check/parser_memory_report.html
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not applicable.
Workflow [PR]
Sync PR [sync-upstream/pr/115675]