Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,16 @@ opentelemetry-semantic-conventions = { version = "0.33" }
tracing-opentelemetry = { version = "0.34", default-features = false }
prometheus = { version = "0.14", default-features = false }
rocksdb = { version = "0.25", default-features = false, features = ["bindgen-runtime", "multi-threaded-cf", "lz4", "zstd"] }
mimalloc = { version = "0.1.52", default-features = false }

# Native RocksDB debug symbols exceed MSVC's PDB limits when linking this crate's
# standalone test binaries. Keep the override scoped to the new backend owner.
[profile.test.package.rocketmq-store-rocksdb]
debug = 0

# Server binaries spend their time in per-message code that crosses many workspace crates
# (protocol, transport, broker, store). Whole-program LTO with one codegen unit lets that code
# inline across crates; it only affects release builds.
[profile.release]
lto = "fat"
codegen-units = 1
16 changes: 12 additions & 4 deletions distribution/config/production-feature-profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
"otlp-metrics",
"otlp-traces",
"otlp-logs",
"tls"
"tls",
"allocator-mimalloc"
],
"resolved_features": [
"allocator-mimalloc",
"default",
"local_file_store",
"otel-logs",
Expand All @@ -62,9 +64,11 @@
"observability",
"otlp-metrics",
"otlp-traces",
"otlp-logs"
"otlp-logs",
"allocator-mimalloc"
],
"resolved_features": [
"allocator-mimalloc",
"default",
"observability",
"otel-logs",
Expand All @@ -84,9 +88,11 @@
"features": [
"metrics-otlp",
"otlp-traces",
"otlp-logs"
"otlp-logs",
"allocator-mimalloc"
],
"resolved_features": [
"allocator-mimalloc",
"default",
"metrics",
"metrics-otlp",
Expand All @@ -105,9 +111,11 @@
"features": [
"otlp-metrics",
"otlp-traces",
"otlp-logs"
"otlp-logs",
"allocator-mimalloc"
],
"resolved_features": [
"allocator-mimalloc",
"cluster-mode",
"default",
"local-mode",
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
--mount=type=cache,target=/usr/local/cargo/git,sharing=locked \
--mount=type=cache,id=rocketmq-service-target-${SOURCE_REVISION},target=/workspace/target,sharing=locked <<EOF
set -eux
cargo build --locked --release --package rocketmq-broker --features otlp-metrics,otlp-traces,otlp-logs,tls --bin rocketmq-broker-rust
cargo build --locked --release --package rocketmq-namesrv --features observability,otlp-metrics,otlp-traces,otlp-logs --bin rocketmq-namesrv-rust
cargo build --locked --release --package rocketmq-controller --features metrics-otlp,otlp-traces,otlp-logs --bin rocketmq-controller-rust
cargo build --locked --release --package rocketmq-proxy --features otlp-metrics,otlp-traces,otlp-logs --bin rocketmq-proxy-rust
cargo build --locked --release --package rocketmq-broker --features otlp-metrics,otlp-traces,otlp-logs,tls,allocator-mimalloc --bin rocketmq-broker-rust
cargo build --locked --release --package rocketmq-namesrv --features observability,otlp-metrics,otlp-traces,otlp-logs,allocator-mimalloc --bin rocketmq-namesrv-rust
cargo build --locked --release --package rocketmq-controller --features metrics-otlp,otlp-traces,otlp-logs,allocator-mimalloc --bin rocketmq-controller-rust
cargo build --locked --release --package rocketmq-proxy --features otlp-metrics,otlp-traces,otlp-logs,allocator-mimalloc --bin rocketmq-proxy-rust
install -d /opt/rocketmq-binaries
for binary in \
rocketmq-broker-rust \
Expand Down
3 changes: 3 additions & 0 deletions rocketmq-broker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ rust-version.workspace = true

[features]
default = ["local_file_store"]
# Use mimalloc as the binary's global allocator (production images enable it).
allocator-mimalloc = ["dep:mimalloc"]
tls = ["rocketmq-transport/tls"]
local_file_store = ["rocketmq-store/local_file_store"]
rocksdb_store = ["rocketmq-store/rocksdb_store", "dep:rocketmq-store-rocksdb"]
Expand Down Expand Up @@ -58,6 +60,7 @@ production = ["local_file_store", "production-observability"]
test-support = []

[dependencies]
mimalloc = { workspace = true, optional = true }
rocketmq-store = { workspace = true }
rocketmq-store-rocksdb = { workspace = true, optional = true }
rocketmq-store-api = { workspace = true }
Expand Down
6 changes: 6 additions & 0 deletions rocketmq-broker/src/bin/broker_bootstrap_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

#![recursion_limit = "512"]

// Message decoding and property handling allocate many short-lived objects per message;
// production images serve them from mimalloc instead of the system allocator.
#[cfg(feature = "allocator-mimalloc")]
#[global_allocator]
static GLOBAL_ALLOCATOR: mimalloc::MiMalloc = mimalloc::MiMalloc;

use std::net::IpAddr;
use std::net::SocketAddr;
use std::path::PathBuf;
Expand Down
3 changes: 3 additions & 0 deletions rocketmq-controller/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ keywords = ["rocketmq", "controller", "raft", "distributed", "messag
categories = ["network-programming", "asynchronous"]

[dependencies]
mimalloc = { workspace = true, optional = true }
rocketmq-auth = { workspace = true }
rocketmq-error = { workspace = true }
rocketmq-model = { workspace = true }
Expand Down Expand Up @@ -128,6 +129,8 @@ harness = false

[features]
default = ["storage-rocksdb"]
# Use mimalloc as the binary's global allocator (production images enable it).
allocator-mimalloc = ["dep:mimalloc"]
storage-rocksdb = ["rocksdb"]
storage-file = []
dev-single = ["storage-file"]
Expand Down
6 changes: 6 additions & 0 deletions rocketmq-controller/src/bin/controller_bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

#![recursion_limit = "256"]

// Message decoding and property handling allocate many short-lived objects per message;
// production images serve them from mimalloc instead of the system allocator.
#[cfg(feature = "allocator-mimalloc")]
#[global_allocator]
static GLOBAL_ALLOCATOR: mimalloc::MiMalloc = mimalloc::MiMalloc;

#[path = "controller_bootstrap/controller_security.rs"]
mod controller_security;

Expand Down
3 changes: 3 additions & 0 deletions rocketmq-namesrv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ rust-version.workspace = true

[features]
default = ["tls"]
# Use mimalloc as the binary's global allocator (production images enable it).
allocator-mimalloc = ["dep:mimalloc"]
tls = ["rocketmq-transport/tls"]
embedded-controller = ["dep:rocketmq-controller"]
observability = ["otel-metrics", "otel-traces"]
Expand All @@ -40,6 +42,7 @@ otlp-traces = ["otel-traces", "rocketmq-observability/otlp-traces"]
otlp-logs = ["otel-logs", "rocketmq-observability/otlp-logs"]

[dependencies]
mimalloc = { workspace = true, optional = true }
rocketmq-model = { workspace = true }
rocketmq-auth = { workspace = true }
rocketmq-error = { workspace = true }
Expand Down
6 changes: 6 additions & 0 deletions rocketmq-namesrv/src/bin/namesrv_bootstrap_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

#![recursion_limit = "512"]

// Message decoding and property handling allocate many short-lived objects per message;
// production images serve them from mimalloc instead of the system allocator.
#[cfg(feature = "allocator-mimalloc")]
#[global_allocator]
static GLOBAL_ALLOCATOR: mimalloc::MiMalloc = mimalloc::MiMalloc;

use std::net::IpAddr;
use std::net::SocketAddr;
use std::path::PathBuf;
Expand Down
3 changes: 3 additions & 0 deletions rocketmq-proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ rust-version.workspace = true

[features]
default = ["cluster-mode", "local-mode"]
# Use mimalloc as the binary's global allocator (production images enable it).
allocator-mimalloc = ["dep:mimalloc"]
cluster-mode = ["dep:rocketmq-proxy-cluster"]
local-mode = ["dep:rocketmq-proxy-local"]
observability = [
Expand All @@ -46,6 +48,7 @@ tieredstore = ["local-mode", "rocketmq-proxy-local/tieredstore"]
tls = ["dep:arc-swap", "dep:parking_lot", "dep:tokio-rustls", "rocketmq-transport/tls", "tonic/tls-aws-lc"]

[dependencies]
mimalloc = { workspace = true, optional = true }
rocketmq-error = { workspace = true }
rocketmq-model = { workspace = true }
rocketmq-protocol = { workspace = true }
Expand Down
6 changes: 6 additions & 0 deletions rocketmq-proxy/src/bin/rocketmq-proxy-rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

#![recursion_limit = "256"]

// Message decoding and property handling allocate many short-lived objects per message;
// production images serve them from mimalloc instead of the system allocator.
#[cfg(feature = "allocator-mimalloc")]
#[global_allocator]
static GLOBAL_ALLOCATOR: mimalloc::MiMalloc = mimalloc::MiMalloc;

use std::path::PathBuf;

use rocketmq_error::CliErrorView;
Expand Down
Loading