mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
chore(engine): remove MIN_WORKER_COUNT (#21829)
This commit is contained in:
@@ -8,14 +8,11 @@ pub const DEFAULT_PERSISTENCE_THRESHOLD: u64 = 2;
|
||||
/// How close to the canonical head we persist blocks.
|
||||
pub const DEFAULT_MEMORY_BLOCK_BUFFER_TARGET: u64 = 0;
|
||||
|
||||
/// Minimum number of workers we allow configuring explicitly.
|
||||
pub const MIN_WORKER_COUNT: usize = 32;
|
||||
|
||||
/// Returns the default number of storage worker threads based on available parallelism.
|
||||
fn default_storage_worker_count() -> usize {
|
||||
#[cfg(feature = "std")]
|
||||
{
|
||||
std::thread::available_parallelism().map_or(8, |n| n.get() * 2).min(MIN_WORKER_COUNT)
|
||||
std::thread::available_parallelism().map_or(8, |n| n.get() * 2)
|
||||
}
|
||||
#[cfg(not(feature = "std"))]
|
||||
{
|
||||
@@ -539,9 +536,12 @@ impl TreeConfig {
|
||||
/// Setter for the number of storage proof worker threads.
|
||||
///
|
||||
/// No-op if it's [`None`].
|
||||
pub fn with_storage_worker_count_opt(mut self, storage_worker_count: Option<usize>) -> Self {
|
||||
pub const fn with_storage_worker_count_opt(
|
||||
mut self,
|
||||
storage_worker_count: Option<usize>,
|
||||
) -> Self {
|
||||
if let Some(count) = storage_worker_count {
|
||||
self.storage_worker_count = count.max(MIN_WORKER_COUNT);
|
||||
self.storage_worker_count = count;
|
||||
}
|
||||
self
|
||||
}
|
||||
@@ -554,9 +554,12 @@ impl TreeConfig {
|
||||
/// Setter for the number of account proof worker threads.
|
||||
///
|
||||
/// No-op if it's [`None`].
|
||||
pub fn with_account_worker_count_opt(mut self, account_worker_count: Option<usize>) -> Self {
|
||||
pub const fn with_account_worker_count_opt(
|
||||
mut self,
|
||||
account_worker_count: Option<usize>,
|
||||
) -> Self {
|
||||
if let Some(count) = account_worker_count {
|
||||
self.account_worker_count = count.max(MIN_WORKER_COUNT);
|
||||
self.account_worker_count = count;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ pub struct EngineArgs {
|
||||
pub allow_unwind_canonical_header: bool,
|
||||
|
||||
/// Configure the number of storage proof workers in the Tokio blocking pool.
|
||||
/// If not specified, defaults to 2x available parallelism, clamped between 2 and 64.
|
||||
/// If not specified, defaults to 2x available parallelism.
|
||||
#[arg(long = "engine.storage-worker-count", default_value = Resettable::from(DefaultEngineValues::get_global().storage_worker_count.map(|v| v.to_string().into())))]
|
||||
pub storage_worker_count: Option<usize>,
|
||||
|
||||
|
||||
@@ -1001,7 +1001,7 @@ Engine:
|
||||
Allow unwinding canonical header to ancestor during forkchoice updates. See `TreeConfig::unwind_canonical_header` for more details
|
||||
|
||||
--engine.storage-worker-count <STORAGE_WORKER_COUNT>
|
||||
Configure the number of storage proof workers in the Tokio blocking pool. If not specified, defaults to 2x available parallelism, clamped between 2 and 64
|
||||
Configure the number of storage proof workers in the Tokio blocking pool. If not specified, defaults to 2x available parallelism
|
||||
|
||||
--engine.account-worker-count <ACCOUNT_WORKER_COUNT>
|
||||
Configure the number of account proof workers in the Tokio blocking pool. If not specified, defaults to the same count as storage workers
|
||||
|
||||
@@ -1001,7 +1001,7 @@ Engine:
|
||||
Allow unwinding canonical header to ancestor during forkchoice updates. See `TreeConfig::unwind_canonical_header` for more details
|
||||
|
||||
--engine.storage-worker-count <STORAGE_WORKER_COUNT>
|
||||
Configure the number of storage proof workers in the Tokio blocking pool. If not specified, defaults to 2x available parallelism, clamped between 2 and 64
|
||||
Configure the number of storage proof workers in the Tokio blocking pool. If not specified, defaults to 2x available parallelism
|
||||
|
||||
--engine.account-worker-count <ACCOUNT_WORKER_COUNT>
|
||||
Configure the number of account proof workers in the Tokio blocking pool. If not specified, defaults to the same count as storage workers
|
||||
|
||||
Reference in New Issue
Block a user