Better introspection of in-memory caches#81023
Merged
azat merged 16 commits intoClickHouse:masterfrom Jun 3, 2025
Merged
Conversation
Contributor
Previously most of the caches was exposed via system.asynchronous_metrics, but it is easy to forget to write some extra code in the ServerAsynchronousMetrics, and there were such places already. So this patch introduce more general interface for them, adds CurrenMetrics for each cache, via CacheBase and their policies. Also show summary cache sizes in /dashboard.html (And also `*Size` had been renamed to `*Bytes`)
Member
Author
Otherwise this will not allow us to share the same counter, i.e. for page cache we have one counter that is used for multiple cache shards.
Likely this is the reason of CI failures for 03277_prewarm_cache_2, where we have 2 more in MarkCacheFiles, since previously it was not accounted at all in asynchornouse_metrics, while now, since it shares metric they does CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=81023&sha=b140973235744f0fea34daa6272cfa4602d72a5b&name_0=PR&name_1=Fast+test&name_2=Tests
/home/ubuntu/actions-runner/_work/clickhouse-private/clickhouse-private/src/Common/LRUCachePolicy.h:47:9: error: Call to virtual method 'LRUCachePolicy::clear' during destruction bypasses virtual dispatch [clang-analyzer-optin.cplusplus.VirtualCall,-warnings-as-errors]
47 | clear();
| ^
/home/ubuntu/actions-runner/_work/clickhouse-private/clickhouse-private/src/Storages/StorageSharedMergeTree.cpp:4020:1: note: Calling '~LRUCachePolicy'
4020 | }
| ^
/home/ubuntu/actions-runner/_work/clickhouse-private/clickhouse-private/src/Common/LRUCachePolicy.h:47:9: note: Call to virtual method 'LRUCachePolicy::clear' during destruction bypasses virtual dispatch
47 | clear();
| ^~~~~~~
Member
Author
|
@antaljanosbenjamin this one should be ready now (private build should OK as well) |
azat
added a commit
to azat/chdig
that referenced
this pull request
May 31, 2025
Note, that this query adopted for all version, it takes into respect all metrics like VectorSimilarityIndexCacheSize/IcebergMetadataFilesCacheSize, but also new metrics after ClickHouse/ClickHouse#81023 Fixes: #109
…CACHE In 61fb538 I missed the SYSTEM DROP INDEX MARK CACHE (sigh). Thanks to @antaljanosbenjamin
Member
Author
Unrelated
|
Merged
via the queue into
ClickHouse:master
with commit Jun 3, 2025
a7558d3
116 of 123 checks passed
1 task
azat
added a commit
to azat/ClickHouse
that referenced
this pull request
Jul 14, 2025
azat
added a commit
to azat/ClickHouse
that referenced
this pull request
Jul 14, 2025
Previous all the following metrics was using metric without `Index` prefix: - `IndexUncompressedCacheBytes` - `IndexUncompressedCacheCells` - `IndexMarkCacheBytes` - `IndexMarkCacheFiles` Follow-up for: ClickHouse#81023
azat
added a commit
to azat/ClickHouse
that referenced
this pull request
Jul 14, 2025
Previous all the following metrics was using metric without `Index` prefix: - `IndexUncompressedCacheBytes` - `IndexUncompressedCacheCells` - `IndexMarkCacheBytes` - `IndexMarkCacheFiles` Follow-up for: ClickHouse#81023
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.

Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Better introspection of in-memory caches (expose information about caches in
system.metricsover incompletesystem.asynchronouse_metrics). Add in-memory caches size (in bytes) intodashboard.html.VectorSimilarityIndexCacheSize/IcebergMetadataFilesCacheSizehas been renamed toVectorSimilarityIndexCacheBytes/IcebergMetadataFilesCacheBytes.Previously most of the caches was exposed via
system.asynchronous_metrics, but it is easy to forget to write some extra code in theServerAsynchronousMetrics.cpp, and there were such places already.So this patch introduce more general interface for them, adds
CurrenMetricsfor each cache, viaCacheBaseand their policies.Also show summary cache sizes in
/dashboard.html