Store jemalloc allocation samples in trace_log#85438
Conversation
844f903 to
2e0f7a3
Compare
azat
left a comment
There was a problem hiding this comment.
I hope that with jemalloc upgrade there will be no new bugs :)
Do you have any thoughts on how this can be used? I mean after we started tracing malloc's, what is the different between this and MemorySample with max_untracked_memory=0?
The main idea is to avoid dependency on jeprof. Also it will be persistent and we don't have to time flushes.
Deciding when to sample allocation is a really tricky problem and jemalloc has a really good implementation. |
|
So a single run pushed 14mil rows to |
I wish, but, the main benefit of jemalloc profiler (with jeprof), that it shows current state, while it is unlikely that we will be able to insert all this data into
That is a good point |
You can recreate it with a query so this would be similar to jemalloc profiler with accumulation. |
azat
left a comment
There was a problem hiding this comment.
New life for jemalloc profiler 👍
| { | ||
| Jemalloc::getThreadProfileActiveMib().setValue(true); | ||
| Jemalloc::setCollectLocalProfileSamplesInTraceLog(settings[Setting::jemalloc_collect_profile_samples_in_trace_log]); | ||
| } |
There was a problem hiding this comment.
What do you think about adding a setting to flush profile automatically on query end?
There was a problem hiding this comment.
I would prefer to do it in a different PR as it should probably go in QueryScope and I would like to not complicate this PR even more.
But a good idea.
14a6b8a to
60d2652
Compare
|
Also
This is definitely for changelog I would say, it adds new profiling and it updates jemalloc |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Update jemalloc to newer version.
Improve allocation profiling based on jemalloc's internal tooling.
Global jemalloc profiler can now be enabled with config
jemalloc_enable_global_profiler. Sampled global allocations and deallocations can be stored insystem.trace_logunderJemallocSampletype by enabling configjemalloc_collect_global_profile_samples_in_trace_log.Jemalloc profiling can now be enabled for each query independently using setting
jemalloc_enable_profiler. Storing samples insystem.trace_logcan be controlled per query using settingjemalloc_collect_profile_samples_in_trace_log.Documentation entry for user-facing changes