Skip to content

Commit

Permalink
feat: add heap profiling for frontend (#14744)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhao-su authored Jan 23, 2024
1 parent 2fd1c9a commit 33937b3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions src/frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ prometheus = { version = "0.13", features = ["process"] }
rand = "0.8"
risingwave_batch = { workspace = true }
risingwave_common = { workspace = true }
risingwave_common_heap_profiling = { workspace = true }
risingwave_common_service = { workspace = true }
risingwave_connector = { workspace = true }
risingwave_expr = { workspace = true }
Expand Down
8 changes: 8 additions & 0 deletions src/frontend/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ use risingwave_common::telemetry::telemetry_env_enabled;
use risingwave_common::types::DataType;
use risingwave_common::util::addr::HostAddr;
use risingwave_common::util::iter_util::ZipEqFast;
use risingwave_common::util::resource_util;
use risingwave_common::util::runtime::BackgroundShutdownRuntime;
use risingwave_common::{GIT_SHA, RW_VERSION};
use risingwave_common_heap_profiling::HeapProfiler;
use risingwave_common_service::observer_manager::ObserverManager;
use risingwave_common_service::MetricsManager;
use risingwave_connector::source::monitor::{SourceMetrics, GLOBAL_SOURCE_METRICS};
Expand Down Expand Up @@ -365,6 +367,12 @@ impl FrontendEnv {
});
join_handles.push(join_handle);

let total_memory_bytes = resource_util::memory::system_memory_available_bytes();
let heap_profiler =
HeapProfiler::new(total_memory_bytes, config.server.heap_profiling.clone());
// Run a background heap profiler
heap_profiler.start();

Ok((
Self {
catalog_reader,
Expand Down

0 comments on commit 33937b3

Please sign in to comment.