pub struct LocalQueueConfig {
pub size: usize,
pub ttl: Duration,
pub refetch_delay: Option<RefetchDelayConfig>,
pub queue_count: usize,
}Fields§
§size: usizeMaximum number of jobs each local queue may fetch and hold at once.
When queue_count is greater than 1, this value is per local queue.
For example, size = 1_250 and queue_count = 4 allows up to 5,000
jobs to be locked locally across the worker.
ttl: DurationHow long locally fetched jobs may stay unclaimed before being returned to the database.
refetch_delay: Option<RefetchDelayConfig>Optional delay strategy used when a fetch returns fewer jobs than requested.
queue_count: usizeNumber of independent local queues to run inside this worker.
Multiple queues can improve throughput for very small high-volume jobs by
letting the worker fetch several batches in parallel. This also increases
the maximum number of jobs locked locally to size * queue_count, so keep
size lower when increasing this value.
If this is greater than the worker concurrency, only concurrency queues
are started because every local queue needs at least one worker draining it.
Throughput depends on the job payload, handler cost, PostgreSQL latency, connection pool size, worker concurrency, and local queue settings. There is no universal best value; benchmark realistic workloads before changing this in production.
Defaults to 1, which preserves the original single-local-queue behavior.
Implementations§
Source§impl LocalQueueConfig
impl LocalQueueConfig
pub fn builder() -> LocalQueueConfigBuilder
pub fn with_size(self, size: usize) -> Self
pub fn with_ttl(self, ttl: Duration) -> Self
pub fn with_refetch_delay(self, refetch_delay: RefetchDelayConfig) -> Self
Sourcepub fn with_queue_count(self, queue_count: usize) -> Self
pub fn with_queue_count(self, queue_count: usize) -> Self
Sets how many independent local queues this worker should run.
size is applied to each queue, so total local capacity is
size * queue_count. Higher values increase parallel fetch capacity but
can also lock more jobs locally and increase database load.
If this is greater than worker concurrency, it is capped at concurrency. There is no single best value for all workloads, so benchmark realistic jobs before relying on a throughput tuning.
Trait Implementations§
Source§impl Clone for LocalQueueConfig
impl Clone for LocalQueueConfig
Source§fn clone(&self) -> LocalQueueConfig
fn clone(&self) -> LocalQueueConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LocalQueueConfig
impl Debug for LocalQueueConfig
Auto Trait Implementations§
impl Freeze for LocalQueueConfig
impl RefUnwindSafe for LocalQueueConfig
impl Send for LocalQueueConfig
impl Sync for LocalQueueConfig
impl Unpin for LocalQueueConfig
impl UnsafeUnpin for LocalQueueConfig
impl UnwindSafe for LocalQueueConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more