feat(rustproxy): use tikv-jemallocator as the global allocator to reduce glibc fragmentation and slow RSS growth; add allocator dependency and enable it in rustproxy, update lockfile, and run tsrust before tests

This commit is contained in:
2026-02-24 23:22:49 +00:00
parent 98089b0351
commit 6114a00fb8
7 changed files with 38 additions and 2 deletions

21
rust/Cargo.lock generated
View File

@@ -936,6 +936,7 @@ dependencies = [
"rustproxy-tls",
"serde",
"serde_json",
"tikv-jemallocator",
"tokio",
"tokio-rustls",
"tokio-util",
@@ -1298,6 +1299,26 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "tikv-jemalloc-sys"
version = "0.6.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd8aa5b2ab86a2cefa406d889139c162cbb230092f7d1d7cbc1716405d852a3b"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "tikv-jemallocator"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0359b4327f954e0567e69fb191cf1436617748813819c94b8cd4a431422d053a"
dependencies = [
"libc",
"tikv-jemalloc-sys",
]
[[package]]
name = "time"
version = "0.3.47"

View File

@@ -91,6 +91,9 @@ libc = "0.2"
# Socket-level options (keepalive, etc.)
socket2 = { version = "0.5", features = ["all"] }
# jemalloc allocator (prevents glibc fragmentation / slow RSS growth)
tikv-jemallocator = "0.6"
# Internal crates
rustproxy-config = { path = "crates/rustproxy-config" }
rustproxy-routing = { path = "crates/rustproxy-routing" }

View File

@@ -39,6 +39,7 @@ hyper = { workspace = true }
hyper-util = { workspace = true }
http-body-util = { workspace = true }
bytes = { workspace = true }
tikv-jemallocator = { workspace = true }
[dev-dependencies]
rcgen = { workspace = true }

View File

@@ -1,3 +1,6 @@
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
use clap::Parser;
use tracing_subscriber::EnvFilter;
use anyhow::Result;