Skip to content
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(build): use tikv-jemalloc only on Linux #7305

Merged
merged 15 commits into from
Jan 11, 2023
Merged

feat(build): use tikv-jemalloc only on Linux #7305

merged 15 commits into from
Jan 11, 2023

Conversation

ice1000
Copy link
Contributor

@ice1000 ice1000 commented Jan 11, 2023

I hereby agree to the terms of the Singularity Data, Inc. Contributor License Agreement.

What's changed and what's your intention?

Exactly as the title said.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Types of user-facing changes

dep: #7306

fuyufjh
fuyufjh previously approved these changes Jan 11, 2023
/// Jemalloc is not supported on non-Linux OSs, because tikv-jemalloc is not available.
/// See the comments for the macro enable_jemalloc_on_linux!();
#[cfg(not(target_os = "linux"))]
pub async fn run(self: Arc<Self>, _: Arc<BatchManager>, _: Arc<LocalStreamManager>) {}
Copy link
Member

@fuyufjh fuyufjh Jan 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is dangerous. A RisingWave CN instance without memory manager will continue to consume more memory until OOM 🥵

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! That's not good. I guess we should warn users about this for non-Linux? I do not expect production-level usages of RisingWave on Windows/macOS, so I think this behavior might be fine (idk, it would be nice if we can implement it with the default allocator)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible to get rid of jemalloc after the competition of our new memory manager (#7180), because we will only rely on the memory usage collected by ourself (with TaskLocalAlloc)

@fuyufjh fuyufjh dismissed their stale review January 11, 2023 05:28

mistake

@codecov
Copy link

codecov bot commented Jan 11, 2023

Codecov Report

Merging #7305 (31906c8) into main (f0e6513) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #7305   +/-   ##
=======================================
  Coverage   73.05%   73.06%           
=======================================
  Files        1068     1069    +1     
  Lines      170985   170982    -3     
=======================================
+ Hits       124913   124920    +7     
+ Misses      46072    46062   -10     
Flag Coverage Δ
rust 73.06% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/cmd/src/bin/compactor.rs 100.00% <ø> (ø)
src/cmd/src/bin/ctl.rs 100.00% <ø> (ø)
src/cmd/src/bin/frontend_node.rs 100.00% <ø> (ø)
src/cmd_all/src/bin/risingwave.rs 1.38% <ø> (-1.36%) ⬇️
src/common/src/lib.rs 100.00% <ø> (ø)
...rc/compute/src/memory_management/memory_manager.rs 0.00% <ø> (ø)
src/common/src/jemalloc.rs 100.00% <100.00%> (ø)
src/common/src/cache.rs 97.31% <0.00%> (-0.23%) ⬇️
src/storage/src/hummock/compactor/mod.rs 83.33% <0.00%> (-0.16%) ⬇️
src/stream/src/executor/aggregation/minput.rs 96.49% <0.00%> (+0.10%) ⬆️
... and 2 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@st1page st1page requested a review from BugenZhao January 11, 2023 06:22
@TennyZhuang
Copy link
Contributor

Generally LGTM, and remove GlobalMemoryManager on non-production platform seems acceptable to me.

BTW, there are some better solutions:

  1. Find an alternative solution to achieve the global memory usage without the dependency to jemalloc. (hard)
  2. Add a feature jemalloc, and let windows user disable it manually.

Anyway, the PR looks good enough to me, I don’t expect users to run heavy workloads on macOS.

@ice1000
Copy link
Contributor Author

ice1000 commented Jan 11, 2023

It's up to the moderators to decide if this is good to go 😉

Copy link
Member

@fuyufjh fuyufjh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acceptable to me because eventually #7180 will fix it ☺️

@@ -71,6 +71,7 @@ impl GlobalMemoryManager {

/// Jemalloc is not supported on non-Linux OSs, because tikv-jemalloc is not available.
/// See the comments for the macro enable_jemalloc_on_linux!();
// FIXME: remove such limitation after #7180
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mergify mergify bot merged commit 68b0111 into main Jan 11, 2023
@mergify mergify bot deleted the tiz/jemalloc branch January 11, 2023 10:55
@yuhao-su
Copy link
Contributor

The jemalloc issue only mentions the compilation problem on Windows. Should we also allow jemalloc on macOS?

@ice1000
Copy link
Contributor Author

ice1000 commented Jan 12, 2023

The jemalloc issue only mentions the compilation problem on Windows. Should we also allow jemalloc on macOS?

Does tikv jemalloc support macOS? Because I'm not sure about that.

@yuhao-su
Copy link
Contributor

The jemalloc issue only mentions the compilation problem on Windows. Should we also allow jemalloc on macOS?

Does tikv jemalloc support macOS? Because I'm not sure about that.

Yes. It works fine on macOS since the first day we add jemalloc.

@ice1000
Copy link
Contributor Author

ice1000 commented Jan 12, 2023

The jemalloc issue only mentions the compilation problem on Windows. Should we also allow jemalloc on macOS?

Does tikv jemalloc support macOS? Because I'm not sure about that.

Yes. It works fine on macOS since the first day we add jemalloc.

Okay. I'll make another pr.

@BugenZhao
Copy link
Member

Previously I thought there were some new problems on macOS. 😄 RisingWave won't guarantee that it works on a non-Unix system, and risedev requires the bash as well. Please use the cfg(unix) if you think this really matters.

@ice1000
Copy link
Contributor Author

ice1000 commented Jan 12, 2023

I think I saw a user having macOS tikv-jemalloc issues in a community channel...

@yuhao-su
Copy link
Contributor

yuhao-su commented Jan 12, 2023

I think I saw a user having macOS tikv-jemalloc issues in a community channel...

Latest try was to spin up a docker container on ubuntu.20.04 and exec into that. There I could set up the dev env needed and build everything BUT tikv-jemalloc-sys wher I failed on a build script.
error: failed to run custom build command for tikv-jemalloc-sys v0.5.2+5.3.0-patched
Caused by:
process didn't exit successfully: /risingwave/target/debug/build/tikv-jemalloc-sys-c28ff9413adad8ce/build-script-build (exit status: 101)

You mean this? I thought he is having problem compiling on ubuntu..

@ice1000
Copy link
Contributor Author

ice1000 commented Jan 12, 2023

Yes, I meant this. They mentioned macOS in another message

@BowenXiao1999
Copy link
Contributor

Add a data point:

According to the experiment with Mac M1, the number observed in Mac M1 seems have some problem: jemalloc much higher than node memory. Switch to ubuntu fix this.

But I'm not sure Mac Intel.

#7180 (comment)

@ice1000 ice1000 mentioned this pull request Jan 13, 2023
4 tasks
mergify bot pushed a commit that referenced this pull request Jan 16, 2023
Fix the warnings introduced by #7305

Approved-By: st1page
Approved-By: yuhao-su
Approved-By: BugenZhao
Approved-By: BowenXiao1999
Approved-By: ice1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants