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

Add tcmalloc support to the tikv_alloc crate #4191

brson opened this Issue Feb 10, 2019 · 1 comment


None yet
2 participants
Copy link

brson commented Feb 10, 2019

Today we use the jemalloc allocator, with a stock configuration, encapsulated in the tikv_alloc crate, in components/tikv_alloc.

Modify tikv_alloc to also support tcmalloc, compare benchmarks with jemalloc and tcmalloc (these scripts might be helpful).

This will require adjusting the tikv_alloc features, because they aren't quite right currently: remove the "no-jemalloc" feature, so that disabling jemalloc means setting default-features = false. That will require adjusting the various conditional compiles in like #[cfg(all(unix, not(fuzzing), not(feature = "no-jemalloc")))].

Also remove the no-jemalloc feature from tikv's Cargo.toml, change the tikv_alloc crate to default-features = false, and add tikv_alloc/jemalloc to tikv's default features. That way enabling tcmalloc for tikv means passing `cargo build --no-default-features --features="tikv_alloc/tcmalloc".

I think the above two paragraphs make sense and will work, but I'm not sure.

Then add tcmalloc to tikv_alloc as an optional crate, so that enabling it requires default-features = false and features = ["tcmalloc"]. Then modify to enable tcmalloc when feature = "tcmalloc", following the existing patterns.

Even if tcmalloc doesn't improve performance compared to jemalloc, I'm inclined to check in the feature anyway, to establish the patterns for tikv_allocs allocator abstraction.


This comment has been minimized.

Copy link

ZhangHanDong commented Feb 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.