Option reference¶
Every option of every Bellhop package, with its default and when to change it. The defaults are chosen so that a small deployment, a few nodes and a few thousand jobs a day, runs in production without changing any of them: change one when the statement next to it describes your case, not before.
The tables are checked against the code by a test: an option added to an options type, or a default changed, without its row here fails the docs tests. The Default column gives the value the code sets, as you would write it in configuration (a duration is .NET TimeSpan text, 00:01:00 for one minute, 7.00:00:00 for seven days), and in brackets what it means where that is not plain.
Setting options¶
The node's options are read from the Bellhop configuration section, and the worker's from Bellhop:Worker. A value set in code wins over configuration. The options are validated when the host starts, so a value out of range fails the start with a message that names the option, rather than the first job.
{
"Bellhop": {
"Namespace": "billing",
"RetentionSucceeded": "1.00:00:00",
"DestinationAllowlist": [ "api.example.com" ],
"Worker": {
"Queues": [ "critical", "default" ],
"Concurrency": 8
}
}
}
In code, Configure sets the node's options, AddWorker the worker's, and each store's registration takes its own:
builder.Services.AddBellhop(bellhop => bellhop
.UsePostgres(builder.Configuration.GetConnectionString("Default")!, store => store.Schema = "jobs")
.Configure(options =>
{
options.RetentionSucceeded = TimeSpan.FromDays(1);
options.MaxAttempts = 5;
})
.AddWorker(worker =>
{
worker.Concurrency = 8;
worker.Queues = ["critical", "default"];
}));
Per-call options are given with each call, and a recurring job's when it is declared:
var result = await jobs.EnqueueAsync(
new SyncCustomer(customerId),
new EnqueueOptions
{
Queue = "integrations",
UniqueKey = $"sync-customer:{customerId}",
Tags = ["crm"],
Timeout = TimeSpan.FromMinutes(2),
},
ct);
bellhop.AddRecurring<SendDailyDigest>("daily-digest", "0 8 * * 1-5", options: new RecurringJobOptions
{
TimeMode = TimeMode.Local,
TimeZone = "Europe/Berlin",
MisfirePolicy = MisfirePolicy.Skip,
OverlapPolicy = OverlapPolicy.Queue,
});
Settings with no default¶
A store's connection string has no default, as Bellhop cannot know where your database is. It is an argument of the store's registration, not an option: UsePostgres(connectionString), UseSqlServer(connectionString), UseSqlite(connectionString), UseRedis(connectionString) and UseRedisNotifications(connectionString); the last two also take a multiplexer, or with no argument use the IConnectionMultiplexer registered in your services. Read it from configuration, user secrets while you develop and your host's secret store in production; Bellhop never logs it. Without a store registration a node uses the in-memory store, which keeps nothing across a restart and is meant for tests.
Job types take their settings from attributes ([Queue], [Retry], [Timeout], [Recurring] and the others on the concepts page), and the dashboard from the calls on MapBellhopDashboard (running in production). They belong to one job type or one dashboard and are described there, so they are not listed here, except the options of the dashboard's basic authentication, below. Its users have no default: a dashboard that calls RequireBasicAuth() without any fails the start.
The node: BellhopOptions¶
Package Bellhop, read from the Bellhop configuration section. Set the same values on every node of an application: several of them are judgements one node makes about the others.
| Option | Default | When to change it |
|---|---|---|
Namespace |
default |
When two applications share one store: give each its own. Set it before the first job is stored, and only once every node of every application on the store runs this release; changing it later moves the application to an empty namespace. |
PollInterval |
00:00:01 (1 second) |
Rarely. Stores that wake idle nodes when work arrives (PostgreSQL, Redis) claim at once anyway; on SQL Server and SQLite it bounds how long a new job waits. Raise it to cut idle queries against a busy database, lower it only when a second is too long a wait and you cannot add Redis notifications. A worker also wakes at each due instant of the recurring jobs it triggers, so a schedule faster than PollInterval still runs at each instant, and costs a store read and write per instant whatever PollInterval is. |
LeaseDuration |
00:01:00 (60 seconds) |
Lower it in tests: those that wait for a lease to run out, and those that start or flush a Redis server, which pauses claims for one lease. Raise it when nodes can stall longer than a lease, such as long garbage-collection pauses, at the cost of a longer wait before a crashed node's jobs run again. |
NodeLostAfter |
00:05:00 (5 minutes) |
When a rolling deploy takes longer than this to bring a node back, raise it, so jobs that only that node can run are not marked Unroutable meanwhile. |
UnroutableAfter |
00:05:00 (5 minutes) |
When a job may wait longer than this for the first node that has its handler, as with a worker started on a schedule, raise it. |
AutoMigrate |
true |
When a DBA applies schema changes instead of the nodes: set it to false and apply the store's script before you deploy a new release. |
ClockSkewThreshold |
00:00:05 (5 seconds) |
Leave it. Raise it only to quiet the warning on hosts whose clocks you cannot synchronise; due times and leases follow the store's clock either way. |
MisfireThreshold |
00:01:00 (60 seconds) |
When a recurring job must count as missed sooner or later than a minute after its due time. Keep it well above PollInterval. |
PayloadSoftLimit |
65536 (64 KB) |
When your jobs carry larger payloads on purpose and the warning is noise; keep it below PayloadHardLimit. |
PayloadHardLimit |
1048576 (1 MB; 256 KB on the Redis store) |
When a job type needs a larger payload and the store can hold it. Prefer storing large data elsewhere and passing its key. |
ResultSizeLimit |
1048576 (1 MB) |
When jobs return larger results that callers read with GetResultAsync. |
CapturedLogLevel |
Information |
Set Warning to keep fewer lines per job, Debug while you investigate a job type, or None to keep none. |
CapturedLogLimit |
262144 (256 KB) |
When jobs write more log text than this and you need all of it on the job page. |
MaxAttempts |
5 |
When most of your jobs need more or fewer tries; for one job type, use [Retry] instead. |
RetryDelays |
null (10 s, 1 min, 5 min, 30 min) |
When the services your jobs call recover on another timescale; for one job type, use [Retry]'s delays instead. |
SchedulingLagThreshold |
00:01:00 (60 seconds) |
When jobs are expected to wait longer than a minute in a busy queue, so health is not Degraded during normal peaks. |
DeadLetterGrowthThreshold |
100 |
When this many dead letters in the window is normal for your volume, or when fewer should already degrade health. |
DeadLetterGrowthWindow |
00:15:00 (15 minutes) |
With DeadLetterGrowthThreshold, to judge dead letters over a longer or shorter time. |
FailureThreshold |
50 |
When this many failed attempts in the window is normal for your volume, or when fewer should already degrade health. |
FailureWindow |
00:05:00 (5 minutes) |
With FailureThreshold, to judge failures over a longer or shorter time. |
MinNodesAlive |
1 |
When readiness should fail once fewer than this many worker nodes are alive; leave it at 1 unless one node cannot carry the load. |
HealthyAfterPasses |
3 |
When health should return to Healthy after fewer or more passing runs. |
DefaultJobTimeout |
00:05:00 (5 minutes) |
Give a long job type its own [Timeout] rather than raising this for every job. Raise it only when most of your jobs run longer than five minutes. |
TimeoutGracePeriod |
00:00:30 (30 seconds) |
When handlers need longer to clean up after their token is cancelled. |
ShutdownTimeout |
00:00:30 (30 seconds) |
When your jobs need longer to finish on a deploy, or your orchestrator gives the process less time. When you raise it, raise the host's HostOptions.ShutdownTimeout (also 30 seconds) a few seconds above it; at the two defaults, a job still running at 30 seconds is handed back either way. |
RetentionSucceeded |
7.00:00:00 (7 days) |
When succeeded jobs must be kept longer for audits, or shorter to keep the store small at high volume. |
RetentionCancelled |
7.00:00:00 (7 days) |
As RetentionSucceeded, for cancelled jobs. |
RetentionDeadLettered |
30.00:00:00 (30 days) |
When dead letters must stay requeueable for longer, or are reviewed sooner. |
NodeSampleInterval |
00:00:15 (15 seconds) |
Rarely. When many nodes share one store and their sample writes add up, raise it. Lowering it multiplies the samples stored and the rows an open nodes page reads, whose chart is in five-minute steps anyway. Every running node writes one sample per interval, with or without the worker. |
NodeSampleRetention |
7.00:00:00 (7 days) |
When node metrics must be kept longer for later analysis, or shorter to keep the store small with many nodes. The nodes page charts the last 24 hours either way. |
DestinationAllowlist |
[] (no host) |
When you use HTTP jobs or webhook alert channels: add each host they call. Until then nothing is sent. |
MaxRedirects |
0 |
When an HTTP job's endpoint answers with a redirect to the same host that must be followed. |
NotificationMaxAttempts |
5 |
When a notification channel is often down for longer than the attempts span, about 20 minutes. |
NotificationMaxDeliveriesPerCooldown |
10 |
When one rule should send more, or fewer, notifications before the rest wait for its digest. |
CorrelationIdHeader |
null (none) |
When your requests carry a correlation id in a header, such as X-Correlation-Id, that jobs should carry too. Register an IRequestHeaders with it. |
The worker: BellhopWorkerOptions¶
Package Bellhop, read from the Bellhop:Worker configuration section and set in AddWorker.
| Option | Default | When to change it |
|---|---|---|
Queues |
[] (the default queue alone) |
When your jobs use other queues: list every queue this worker drains, in the order it prefers them. |
Concurrency |
null (2 × the processor count) |
When jobs mostly wait on I/O, raise it; when they are CPU-heavy or the database limits connections, lower it. |
LongRunningLimit |
null (no separate limit) |
When [LongRunning] jobs could take every slot: cap them so short jobs keep running. |
QueueWeights |
{} (strict order) |
When a later queue must not starve while an earlier one is busy: give each queue a weight. |
Per call: EnqueueOptions¶
Package Bellhop. Given with one EnqueueAsync or ScheduleAsync call; a value left null falls back to the job type's attribute, then to the node's option.
| Option | Default | When to change it |
|---|---|---|
Queue |
null (the job type's queue, or default) |
When one call's job must go to another queue than its type's. |
Priority |
null (the job type's priority, or 0) |
When one call's job must be claimed before others in its queue. |
UniqueKey |
null (none) |
When a second job for the same work must not be created while one is active, such as one confirmation per order. |
DuplicatePolicy |
null (the job type's policy, or Ignore) |
When a call with a held unique key must fail (Error), or move the waiting job's time (ReplaceSchedule), instead of returning the existing job. |
Tags |
null (none) |
When the job must be found by a business key, such as a tenant or a customer, in the dashboard or by a requeue. |
Timeout |
null (the job type's timeout, or DefaultJobTimeout) |
When one call's job needs more or less time than its type's. |
MaxAttempts |
null (the job type's number, or MaxAttempts) |
When one call's job needs more or fewer tries than its type's. |
RetryDelays |
null (the job type's delays, or RetryDelays) |
When one call's job needs other waits between tries. |
ConcurrencyKey |
null (the job type's key, or none) |
When jobs that share a resource, such as one customer's account, must not run at the same time. |
Transaction |
null (none) |
When the job must exist only if your database transaction commits. Needs a store with transactional enqueue: PostgreSQL, SQL Server or SQLite. |
A recurring job: RecurringJobOptions¶
Package Bellhop, namespace Bellhop.Scheduling. Given to AddRecurring; [Recurring] has the same settings but the validity window, ActiveFrom and ActiveUntil.
| Option | Default | When to change it |
|---|---|---|
TimeMode |
Utc |
When the schedule follows a place's wall clock, such as 03:00 in Berlin across daylight saving: set Local with a TimeZone. |
TimeZone |
null (none, for Utc) |
With TimeMode Local: the IANA zone id, such as Europe/Berlin. |
MisfirePolicy |
RunOnce |
When missed runs must be skipped (Skip), or each run separately (RunAll). |
MaxRunAllOccurrences |
1 |
With RunAll: how many missed runs one trigger may create. |
OverlapPolicy |
Skip |
When a run that falls due while the previous one runs must wait (Queue), run beside it (Allow) or replace it (CancelPrevious). |
MaxQueuedOccurrences |
1 |
With Queue: how many runs may wait at once. |
OrphanPolicy |
Orphan |
When a recurring job that no running node declares any more must be deleted (Delete) rather than kept as orphaned. |
AllowRuntimeOverride |
false |
When operators may edit the schedule from the dashboard until the declaration changes. |
ActiveFrom |
null (no start) |
When the job must not run before a date, such as a campaign's start. |
ActiveUntil |
null (no end) |
When the job must stop after a date. |
PostgreSQL: PostgreSqlStoreOptions¶
Package Bellhop.PostgreSql, set in UsePostgres.
| Option | Default | When to change it |
|---|---|---|
Schema |
bellhop |
When the database already has a schema of that name, or your conventions name schemas otherwise. Every node that shares the store sets the same. |
SQL Server: SqlServerStoreOptions¶
Package Bellhop.SqlServer, set in UseSqlServer.
| Option | Default | When to change it |
|---|---|---|
Schema |
bellhop |
When the database already has a schema of that name, or your conventions name schemas otherwise. Every node that shares the store sets the same. |
SQLite: SqliteStoreOptions¶
Package Bellhop.Sqlite, set in UseSqlite.
| Option | Default | When to change it |
|---|---|---|
TablePrefix |
bellhop |
When the database file already has tables starting with bellhop_. |
Redis: RedisStoreOptions¶
Package Bellhop.Redis, set in UseRedis. Read the Redis store first.
| Option | Default | When to change it |
|---|---|---|
KeyPrefix |
bellhop: |
When two applications share one Redis server and must not see each other's jobs, or the prefix clashes with your own keys. Every node that shares the store sets the same. |
StaleNodeAge |
null (one LeaseDuration, three heartbeat intervals: 60 seconds) |
Rarely: when nodes miss heartbeats for longer than this in normal operation, such as during long pauses, raise it. |
MemoryDegradedShare |
0.8 (80% of maxmemory) |
When the server runs near maxmemory by design, raise it; to be warned earlier, lower it. |
RecurringReconcileInterval |
00:05:00 (5 minutes) |
Lower it to detect rollbacks to more recent copies of the data, at one write per interval; raise it to write less. |
Redis notifications: RedisNotificationOptions¶
Package Bellhop.Redis, set in UseRedisNotifications, which wakes nodes through Redis when the jobs are kept in another store.
| Option | Default | When to change it |
|---|---|---|
KeyPrefix |
bellhop: |
When two Bellhop installations publish on one Redis server and must not wake each other. Every node that shares the store sets the same. |
Dashboard basic authentication: DashboardBasicAuthOptions¶
Package Bellhop.Dashboard, read from the Bellhop:Dashboard:BasicAuth configuration section and set in RequireBasicAuth(configure). Every dashboard of the application that calls RequireBasicAuth() reads the same section. Running in production shows a configuration and how to make the password hashes.
| Option | Default | When to change it |
|---|---|---|
Users |
[] |
Always: list each user, with a Name, a PasswordHash made by DashboardPasswordHash.Create and a Permission, View (the default) or Operate. |
MaxFailedLogins |
5 |
Lower it to slow password guessing further; raise it, up to 100, when users who mistype are locked out too often. |
LoginLockoutWindow |
00:15:00 (15 minutes) |
Lengthen it, up to a day, to slow guessing further; shorten it when a locked-out user cannot wait that long. |