Skip to content

Commit

Permalink
Use jemallocator for bootnode
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiezzel committed May 22, 2024
1 parent ed9ee4e commit cc1d6ac
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
21 changes: 21 additions & 0 deletions Cargo.lock

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

8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ COPY transport ./transport

FROM builder as builder

RUN cargo build --release --bin bootnode --bin keygen
RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
--mount=target=/var/cache/apt,type=cache,sharing=locked \
rm -f /etc/apt/apt.conf.d/docker-clean \
&& apt-get update \
&& apt-get -y install build-essential

RUN cargo build --release --bin bootnode --bin keygen --features tikv-jemallocator

FROM --platform=$BUILDPLATFORM debian:bookworm-slim as base

Expand Down
3 changes: 3 additions & 0 deletions transport/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ observer = ["actors"]
scheduler = ["actors", "request-client", "proto"]
worker = ["actors", "request-server", "proto"]
metrics = ["libp2p/metrics", "prometheus-client"]

[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = { version = "0.5", optional = true }
7 changes: 7 additions & 0 deletions transport/src/bin/bootnode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ use subsquid_network_transport::{
BootNode, Keypair, QuicConfig, TransportArgs,
};

#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;

#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

#[derive(Parser)]
#[command(version, author)]
struct Cli {
Expand Down

0 comments on commit cc1d6ac

Please sign in to comment.