#[non_exhaustive]pub struct ProcessorConfig {
pub num_workers: usize,
pub balance_strategy: BalanceStrategy,
pub queue_configs: BTreeMap<String, QueueConfig>,
}
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.num_workers: usize
The number of Sidekiq workers that can run at the same time. Adjust as needed based on your workload and resource (cpu/memory/etc) usage.
This config value controls how many workers are spawned to handle the queues provided
to Processor::new
. These workers will be shared across all of these queues.
If your workload is largely CPU-bound (computationally expensive), this should probably match your CPU count. This is the default.
If your workload is largely IO-bound (e.g. reading from a DB, making web requests and waiting for responses, etc), this can probably be quite a bit higher than your CPU count.
balance_strategy: BalanceStrategy
The strategy for balancing the priority of fetching queues’ jobs from Redis. Defaults
to BalanceStrategy::RoundRobin
.
The Redis API used to fetch jobs (brpop)
checks queues for jobs in the order the queues are provided. This means that if the first
queue in the list provided to Processor::new
always has an item, the other queues
will never have their jobs run. To mitigate this, a BalanceStrategy
can be provided
to allow ensuring that no queue is starved indefinitely.
queue_configs: BTreeMap<String, QueueConfig>
Queue-specific configurations. The queues specified in this field do not need to match
the list of queues provided to Processor::new
.
Implementations§
Source§impl ProcessorConfig
impl ProcessorConfig
pub fn num_workers(self, num_workers: usize) -> Self
pub fn balance_strategy(self, balance_strategy: BalanceStrategy) -> Self
pub fn queue_config(self, queue: String, config: QueueConfig) -> Self
Trait Implementations§
Source§impl Clone for ProcessorConfig
impl Clone for ProcessorConfig
Source§fn clone(&self) -> ProcessorConfig
fn clone(&self) -> ProcessorConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more