Skip to content

Commit

Permalink
allow override memory_manager_target_bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
fuyufjh committed Nov 20, 2024
1 parent 2ca8c88 commit 20ddc77
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/cmd_all/src/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ mod test {
enable_barrier_read: None,
temp_secret_file_dir: "./frontend/secrets/",
frontend_total_memory_bytes: 34359738368,
memory_manager_target_bytes: None,
},
),
compactor_opts: None,
Expand Down
7 changes: 7 additions & 0 deletions src/compute/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ pub struct ComputeNodeOpts {
#[clap(long, env = "RW_RESERVED_MEMORY_BYTES")]
pub reserved_memory_bytes: Option<usize>,

/// Target memory usage for Memory Manager.
/// If not set, the default value is `total_memory_bytes` - `reserved_memory_bytes`
///
/// It's strongly recommended to set it for standalone deployment.
#[clap(long, env = "RW_MEMORY_MANAGER_TARGET_BYTES")]
pub memory_manager_target_bytes: Option<usize>,

/// The parallelism that the compute node will register to the scheduler of the meta service.
#[clap(long, env = "RW_PARALLELISM", default_value_t = default_parallelism())]
#[override_opts(if_absent, path = streaming.actor_runtime_worker_threads_num)]
Expand Down
15 changes: 7 additions & 8 deletions src/compute/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,14 @@ pub async fn compute_node_serve(
batch_mem_limit(compute_memory_bytes, opts.role.for_serving()),
));

// NOTE: Due to some limits, we use `compute_memory_bytes + storage_memory_bytes` as
// `total_compute_memory_bytes` for memory control. This is just a workaround for some
// memory control issues and should be modified as soon as we figure out a better solution.
//
// Related issues:
// - https://github.com/risingwavelabs/risingwave/issues/8696
// - https://github.com/risingwavelabs/risingwave/issues/8822
let target_memory = if let Some(v) = opts.memory_manager_target_bytes {
v
} else {
compute_memory_bytes + storage_memory_bytes
};

let memory_mgr = MemoryManager::new(MemoryManagerConfig {
target_memory: compute_memory_bytes + storage_memory_bytes,
target_memory,
threshold_aggressive: config
.streaming
.developer
Expand Down

0 comments on commit 20ddc77

Please sign in to comment.