Add CLI flags

This commit is contained in:
Paul Hauner
2023-07-07 14:18:21 +10:00
parent 1157568c0d
commit e03017dfad
7 changed files with 106 additions and 20 deletions

View File

@@ -1131,4 +1131,36 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.takes_value(true)
.possible_values(ProgressiveBalancesMode::VARIANTS)
)
.arg(
Arg::with_name("beacon-processor-max-workers")
.long("beacon-processor-max-workers")
.value_name("INTEGER")
.help("Specifies the maximum concurrent tasks for the task scheduler. Increasing \
this value may increase resource consumption. Reducing the value \
may result in decreased resource usage and diminished performance. The \
default value is the number of logical CPU cores on the host.")
.takes_value(true)
)
.arg(
Arg::with_name("beacon-processor-work-queue")
.long("beacon-processor-work-queue")
.value_name("INTEGER")
.help("Specifies the length of the inbound event queue. Increasing this value \
may prevent messages from being dropped at risk of overwhelming the \
host resources. Decreasing this value may cause messages to be dropped but \
may help resource-constrained hosts.")
.default_value("16384")
.takes_value(true)
)
.arg(
Arg::with_name("beacon-processor-reprocess-queue")
.long("beacon-processor-reprocess-queue")
.value_name("INTEGER")
.help("Specifies the length of the queue for messages requiring delayed processing. \
Increasing this value may prevent messages from being dropped at risk of \
overwhelming the host resources. Decreasing this value may cause messages \
to be dropped but may help resource-constrained hosts.")
.default_value("12288")
.takes_value(true)
)
}

View File

@@ -792,7 +792,7 @@ pub fn get_config<E: EthSpec>(
}
// Backfill sync rate-limiting
client_config.chain.enable_backfill_rate_limiting =
client_config.beacon_processor.enable_backfill_rate_limiting =
!cli_args.is_present("disable-backfill-rate-limiting");
if let Some(path) = clap_utils::parse_optional(cli_args, "invalid-gossip-verified-blocks-path")?
@@ -806,6 +806,20 @@ pub fn get_config<E: EthSpec>(
client_config.chain.progressive_balances_mode = progressive_balances_mode;
}
if let Some(max_workers) = clap_utils::parse_optional(cli_args, "beacon-processor-max-workers")?
{
client_config.beacon_processor.max_workers = max_workers;
}
if client_config.beacon_processor.max_workers == 0 {
return Err("--beacon-processor-max-workers must be a non-zero value".to_string());
}
client_config.beacon_processor.max_work_event_queue_len =
clap_utils::parse_required(cli_args, "beacon-processor-work-queue")?;
client_config.beacon_processor.max_scheduled_work_queue_len =
clap_utils::parse_required(cli_args, "beacon-processor-reprocess-queue")?;
Ok(client_config)
}