diff --git a/proxy/src/bin/proxy.rs b/proxy/src/bin/proxy.rs index fa4fb264f2..a555c3e586 100644 --- a/proxy/src/bin/proxy.rs +++ b/proxy/src/bin/proxy.rs @@ -297,6 +297,7 @@ async fn main() -> anyhow::Result<()> { build_tag: BUILD_TAG, }); + proxy::jemalloc::disable_thp()?; let jemalloc = match proxy::jemalloc::MetricRecorder::new() { Ok(t) => Some(t), Err(e) => { diff --git a/proxy/src/jemalloc.rs b/proxy/src/jemalloc.rs index d307d80f4a..4548caf70b 100644 --- a/proxy/src/jemalloc.rs +++ b/proxy/src/jemalloc.rs @@ -9,7 +9,7 @@ use measured::{ text::TextEncoder, LabelGroup, MetricGroup, }; -use tikv_jemalloc_ctl::{config, epoch, epoch_mib, stats, version}; +use tikv_jemalloc_ctl::{config, epoch, epoch_mib, stats, version, Access, AsName, Name}; pub struct MetricRecorder { epoch: epoch_mib, @@ -114,3 +114,8 @@ jemalloc_gauge!(mapped, mapped_mib); jemalloc_gauge!(metadata, metadata_mib); jemalloc_gauge!(resident, resident_mib); jemalloc_gauge!(retained, retained_mib); + +pub fn disable_thp() -> Result<(), tikv_jemalloc_ctl::Error> { + let opt_thp: &Name = "opt.thp".name(); + opt_thp.write("never") +}