Skip to content

Commit 76d8cc1

Browse files
authored
00004: use jemalloc and fix recv_mmmsg batch size hist metric (#9)
1 parent 31dbe8b commit 76d8cc1

File tree

5 files changed

+33
-1
lines changed

5 files changed

+33
-1
lines changed

Cargo.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ tiny_http = "0.12.0"
4646
tokio = "1"
4747
tonic = { version = "0.13", features = ["tls-webpki-roots"] }
4848
tonic-build = "0.13"
49+
tikv-jemallocator = "0.6"
4950

5051
[profile.release]
5152
# thin has minimal overhead vs none (default): https://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html

proxy/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ thiserror = { workspace = true }
4242
tiny_http = { workspace = true }
4343
tokio = { workspace = true }
4444
tonic = { workspace = true }
45+
46+
[target.'cfg(not(target_env = "msvc"))'.dependencies]
47+
tikv-jemallocator = { workspace = true }

proxy/src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ mod server;
3232
mod token_authenticator;
3333
mod prom;
3434

35+
#[cfg(not(target_env = "msvc"))]
36+
use tikv_jemallocator::Jemalloc;
37+
38+
#[cfg(not(target_env = "msvc"))]
39+
#[global_allocator]
40+
static GLOBAL: Jemalloc = Jemalloc;
41+
3542
#[derive(Clone, Debug, Parser)]
3643
#[clap(author, version, about, long_about = None)]
3744
// https://docs.rs/clap/latest/clap/_derive/_cookbook/git_derive/index.html

proxy/src/prom.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ lazy_static::lazy_static! {
2626

2727
static ref RECV_PACKET_COUNT_HIST: Histogram = Histogram::with_opts(
2828
HistogramOpts::new("shredstream_recv_packet_count", "Number of packets in incoming batch (before dedup)")
29-
.buckets(vec![1.0, 5.0, 10.0, 20.0, 50.0, 100.0, 200.0, 500.0, 1000.0])
29+
.buckets(vec![1.0, 2.0, 3.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 64.0, 100.0])
3030
).unwrap();
3131

3232
static ref PACKETS_RECEIVED_TOTAL: Counter = Counter::new(

0 commit comments

Comments
 (0)