Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Backend Integration

The MonadArbiter typeclass separates the core from database libraries. Arbiter provides three adapters: arbiter-simple, arbiter-orville, and arbiter-hasql. Use the adapter for the database library in your application if you want to share connections.

Benchmarks

Jobs/sec with arbiter-hasql, prepared claims, PostgreSQL 18, GHC 9.14.1, Apple M5 Pro. Single-job mode / batched mode (batch size 10).

Pre-loaded queue (1M jobs, 4 pools × 10 workers):

QueueSingleBatched
ungrouped10,49139,918
ungrouped, dormant10,40740,219
50k groups8,11631,559
50k groups, scheduled + backoff2,55022,126
50k groups, dormant8,10630,878

scheduled + backoff: a fifth of jobs scheduled seconds out, a fifth failing once into backoff. dormant: half the backlog parked 30 days out.

Steady state (10 producers inserting continuously, 4 pools × 10 workers):

QueueSingleBatched
ungrouped10,14316,940
ungrouped, OpenTelemetry on9,522
5k groups5,32216,547
5k groups, scheduled + backoff2,30212,685

Group size and skew (300k jobs, 4 pools × 10 workers):

GroupsSingleBatchedGroup triggers, µs/job
1 job/group8,4756,840328 / 429
10 jobs/group8,36435,637353 / 66
100 jobs/group6,80736,867352 / 72
1,000 jobs/group3,20924,857417 / 48
10,000 jobs/group8889,791511 / 60
80/20 skew, 1k groups, 10 hot2,71917,043577 / 87

Admission gating (steady state, 10 producers, 256 keys):

no gaterate limitconcurrencyboth
ungrouped, single, 1 pool4,0272,9462,1621,831
ungrouped, single, 4 pools5,3185,3463,6862,736
ungrouped, batched, 1 pool16,52110,3047,6596,246
5k groups, single, 1 pool831871688661
5k groups, single, 4 pools2,2702,2201,9872,011
5k groups, batched, 1 pool5,5125,1883,7353,379

One pool is 10 workers and one dispatcher.