-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: auto heap dump by default if MALLOC_CONF=prof:true
#12186
Conversation
convert(total_memory_bytes as _), | ||
MIN_COMPUTE_MEMORY_MB | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know why MIN_COMPUTE_MEMORY_MB
was not checked anywhere, so I added it by the way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
src/common/src/config.rs
Outdated
@@ -1131,7 +1127,7 @@ pub mod default { | |||
|
|||
pub mod auto_dump_heap_profile { | |||
pub fn dir() -> String { | |||
"".to_string() | |||
".".to_string() // current directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll suggest putting it in ./.risingwave/profiling/auto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"."
is not perfect but ./.risingwave
is only used by risedev (for developers), it seems even worse.
Let me try to make it configurable by env var, so that kube-bench
or risedev
can set a proper output directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually not just used by risedev.
risingwave/src/storage/src/memory.rs
Line 106 in 840114a
create_dir_all("./.risingwave/sled").expect("should create"); |
But an env for the prefix will be great. It can be useful for putting all kinds of local files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the ci failed because of this change. You need to update the example.toml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually not just used by risedev.
risingwave/src/storage/src/memory.rs
Line 106 in 840114a
create_dir_all("./.risingwave/sled").expect("should create"); But an env for the prefix will be great. It can be useful for putting all kinds of local files.
Hmm, this is not persuasive. memory
storage is just for test and playground, and it is never used in production.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least put it in a directory? Output heap profile in a root directory looks ugly to me. Also we will have a directory for manually dumped in the dashboard pr.
Anyway, I think an env var for the local file prefix would be great. Maybe we can do it in later prs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized the "env var" actually already exist - MALLOC_CONF
Now it will dump memory profile to prof.prefix
if server.auto_dump_heap_profile.dir
is absent. Please take a look. 🥰
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov Report
@@ Coverage Diff @@
## main #12186 +/- ##
==========================================
- Coverage 69.76% 69.75% -0.02%
==========================================
Files 1407 1407
Lines 235565 235576 +11
==========================================
- Hits 164351 164317 -34
- Misses 71214 71259 +45
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 9 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -1130,6 +1127,10 @@ pub mod default { | |||
} | |||
|
|||
pub mod auto_dump_heap_profile { | |||
pub fn enabled() -> bool { | |||
true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where will we read the env var MALLOC_CONF
? 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let prof_prefix_mib = jemalloc_prof::prefix::mib().unwrap();
let prof_prefix = prof_prefix_mib.read().unwrap();
It's actually read from jemalloc
lib as its option.
Note that the auto-dump is enabled by default, but if jemalloc
's profiling is disabled (which is also the default), nothing happens except the log line mentioned in the PR description.
@@ -46,7 +46,11 @@ workspace-hack = { path = "../workspace-hack" } | |||
task_stats_alloc = { path = "../utils/task_stats_alloc" } | |||
|
|||
[target.'cfg(unix)'.dependencies] | |||
tikv-jemallocator = { git = "https://github.com/yuhao-su/jemallocator.git", features = ["profiling", "stats", "unprefixed_malloc_on_supported_platforms"], rev = "a0911601bb7bb263ca55c7ea161ef308fdc623f8" } | |||
tikv-jemallocator = { git = "https://github.com/risingwavelabs/jemallocator.git", features = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about making it a workspace dependency?
Line 62 in 8841892
[workspace.dependencies] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us do it in future PRs. cc. @yuhao-su
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
As title.
By default, as long as
MALLOC_CONF=prof:true
is set, auto heap dump will be produced. Otherwise, a line of log will be printedThis makes it easier to use auto heap dump and also facilitates https://linear.app/risingwave-labs/issue/CLOUD-1791/feature-enable-auto-heap-dump.
The default dump path is inherited from
prof.prefix
inMALLOC_CONF
, but you may override it by the optionserver.auto_dump_heap_profile.dir
. For example:Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.