Version v0.1 · dotnet
Worker Options
Configure worker identity, polling cadence, and throughput behavior.
Worker Options
Worker options control how aggressively each process claims and executes work.
These settings are the primary levers for throughput and load distribution.
Key options
WorkerName: unique worker identity for lease ownership and diagnostics.PollInterval/PollIntervalSeconds: base polling cadence.PollJitterEnabledandPollJitterRatio: randomize poll timing to distribute claim pressure.BatchSize(ClaimBatchSize): max runs claimed per poll.MaxConcurrentRuns: max in-flight runs executed concurrently per worker.JobActivation: DI activation model (ScopedPerExecutionorRootProvider).
Example
using DurableStack.Core.Options;
builder.Services.AddDurableStackPostgres(connectionString, options =>
{
options.WorkerName = $"billing-api-{Environment.MachineName}-{Environment.ProcessId}";
options.PollIntervalSeconds = 5;
options.PollJitterEnabled = true;
options.PollJitterRatio = 0.2;
options.BatchSize = 50;
options.MaxConcurrentRuns = 10;
options.JobActivation = DurableStackJobActivationMode.ScopedPerExecution;
});
How to tune
- Increase
MaxConcurrentRunsbefore aggressively increasingBatchSize. - Keep poll jitter enabled in multi-worker deployments.
- Use unique, stable worker names per process instance.
- Keep
ScopedPerExecutionunless you intentionally avoid scoped dependencies.
Common pitfalls
- Reusing the same
WorkerNameacross containers. - Setting very low poll intervals without jitter in large clusters.
- Setting high concurrency without validating database and dependency capacity.