Repository navigation
Add some debug logs to measure system log flush timings - #91472
Conversation
|
Workflow [PR], commit [3f6e32f] Summary: ❌
|
|
@Algunenano can you also remove |
|
I can still see some high numbers in there: 30-40 seconds preparing data. And trace_log also continues to be really slow: |
|
Let's merge with master to include #91579 |
|
Still see high numbers: They are not as high as before, but we are still far from reasonable timings. I'll revisit the query_log to see what else we can improve to reduce it |
|
Timings are still not great, but it's hard to debug. For example, checking one instance: The trace_logs of the thread around that time only shows the insert pipeline, they do not hit the preparation time -> https://pastila.clickhouse.com/?00017678/e74a07bde50d3b20b9b0df712bd28327#6v8gzsBNCd4kkURcMeaTDQ== I think we have a few improvements already, so I'd merge this and iterate in other PRs and keep adding improvements to other system.query_log / system.trace_log (they still need them) or other different system logs. WDYT @azat? |
|
One idea to keep progressing would be to temporarily (or even finally) add query profilers to these flushing threads, so we can have trace reports from CI and see where time is being spent more clearly |
It will be nice to do, but AFAICS we already enable it (in |
|
|
||
| LOG_TRACE( | ||
| log, | ||
| "Flushed system log up to offset {}. Timings: {}/{}/{}/{}/{}", |
There was a problem hiding this comment.
I think it make sense to include number of entries as well, right now you need context to see this, while it can be useful to match it with timings
|
|
||
| LOG_TRACE( | ||
| log, | ||
| "Flushed system log up to offset {}. Timings: {}/{}/{}/{}/{}", |
There was a problem hiding this comment.
| "Flushed system log up to offset {}. Timings: {}/{}/{}/{}/{}", | |
| "Flushed system log up to offset {}. Timings(prepare_table={}ms, reserve_block={}ms, insert_to_block={}ms, execute_insert={}ms, confirm={}ms)", |
| auto value = accessor.getValueString(*this, i); | ||
| key_column.insertData(name.data(), name.size()); | ||
| value_column.insertData(value.data(), value.size()); | ||
| size++; |
There was a problem hiding this comment.
This one is more common in code
| size++; | |
| ++size; |
There was a problem hiding this comment.
Don't ask me why because I don't know, but I've never been a fan of ++i, even though I know that at some point in the distant past it produced better code.
| column_symbols_inner.insert(demangled.get()); | ||
| else | ||
| symbols.emplace_back(std::string_view(symbol->name)); | ||
| column_symbols_inner.insert(std::string_view(symbol->name)); | ||
|
|
||
| lines.emplace_back(AddressToLineCache::get(trace[frame])); | ||
| column_lines_inner.insert(AddressToLineCache::get(trace[frame])); | ||
| } | ||
| else | ||
| { | ||
| symbols.emplace_back(String()); | ||
| lines.emplace_back(String()); | ||
| column_symbols_inner.insert(String()); | ||
| column_lines_inner.insert(String()); |
There was a problem hiding this comment.
Should we also use insertData here to avoid temporary Field creation?
There was a problem hiding this comment.
And maybe use the same getData().push_back for other columns like in query_log as well?
| class BaseSettings : public TTraits::Data | ||
| { | ||
| using CustomSettingMap = std::unordered_map<std::string_view, std::pair<std::shared_ptr<const String>, SettingFieldCustom>>; | ||
| struct StringHash |
There was a problem hiding this comment.
src/Common/StringHashForHeterogeneousLookup.h
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add some trace logs to measure system log flushing timings and slight speed up in sanitizer builds
Related to #91410
Closes #91410
Closes #92089
Documentation entry for user-facing changes