Skip to content

Commit 89bc084

Browse files
authored
Continuous memory profiling (#4572)
## Motivation For debugging production memory issues, ideally we'll have continuous memory profiling always on. ## Proposal This exposes a couple endpoints: * One that generates a pprof and returns it once the endpoint is queried * One that generates a flamegraph and returns it once the endpoint is queried The former will be used by Alloy on the deployment side, to generate profiles every 30 seconds or so. It shows no visible performance regression. ## Test Plan Deployed a network with this and the `linera-infra` changes, saw the memory flamegraphs on Pyroscope, and managed to curl the flamegraph endpoint and get a memory profile svg returned to me. ![Screenshot 2025-09-06 at 02.27.50.png](https://app.graphite.dev/user-attachments/assets/f5c2407e-af25-4b8c-b43a-9e56258a9373.png) ## Release Plan - Nothing to do / These changes follow the usual release cycle.
1 parent f4bb825 commit 89bc084

File tree

15 files changed

+467
-92
lines changed

15 files changed

+467
-92
lines changed

Cargo.lock

Lines changed: 163 additions & 11 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
@@ -136,6 +136,7 @@ indexed_db_futures = "0.4.1"
136136
insta = "1.36.1"
137137
is-terminal = "0.4.12"
138138
itertools = "0.14.0"
139+
jemalloc_pprof = "0.8.1"
139140
js-sys = "0.3.70"
140141
k256 = { version = "0.13.4", default-features = false, features = [
141142
"ecdsa",

docker/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ARG binaries=
2525
ARG copy=${binaries:+_copy}
2626
ARG build_flag=--release
2727
ARG build_folder=release
28-
ARG build_features=scylladb,metrics
28+
ARG build_features=scylladb,metrics,memory-profiling
2929
ARG rustflags="-C force-frame-pointers=yes"
3030

3131
FROM rust:1.74-slim-bookworm AS builder
@@ -39,7 +39,8 @@ ARG rustflags
3939
RUN apt-get update && apt-get install -y \
4040
pkg-config \
4141
protobuf-compiler \
42-
clang
42+
clang \
43+
make
4344

4445
COPY examples examples
4546
COPY linera-base linera-base

linera-faucet/server/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use linera_execution::{
4242
Committee, ExecutionError, Operation,
4343
};
4444
#[cfg(feature = "metrics")]
45-
use linera_metrics::prometheus_server;
45+
use linera_metrics::monitoring_server;
4646
use linera_storage::{Clock as _, Storage};
4747
use serde::{Deserialize, Serialize};
4848
use tokio::sync::{oneshot, Notify};
@@ -662,7 +662,7 @@ where
662662
let index_handler = axum::routing::get(graphiql).post(Self::index_handler);
663663

664664
#[cfg(feature = "metrics")]
665-
prometheus_server::start_metrics(self.metrics_address(), cancellation_token.clone());
665+
monitoring_server::start_metrics(self.metrics_address(), cancellation_token.clone());
666666

667667
let app = Router::new()
668668
.route("/", index_handler)

0 commit comments

Comments
 (0)