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

MonadArbiter separates the core from the database library. Three adapters ship: arbiter-simple, arbiter-orville, and arbiter-hasql. Each shares connections with its database library.

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
ungrouped17,47264,823
ungrouped, dormant17,56949,952*
50k groups9,08930,533
50k groups, scheduled + backoff2,53923,743
50k groups, dormant9,58230,887

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

* The workers drain all 500k ready jobs before the 10-second trial ends. The real rate is higher.

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

QueueSingleBatched
ungrouped15,18518,336
ungrouped, OpenTelemetry on15,192
5k groups7,11716,190
5k groups, scheduled + backoff2,30713,499

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

GroupsSingleBatchedGroup triggers, µs/job
1 job/group10,1546,682341 / 410
10 jobs/group10,03133,665363 / 58
100 jobs/group8,10134,529396 / 64
1,000 jobs/group3,66923,664424 / 42
10,000 jobs/group9539,878409 / 48
80/20 skew, 1k groups, 10 hot2,95517,578621 / 86

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

no gaterate limitconcurrencyboth
ungrouped, single, 1 pool3,5943,2442,0251,547
ungrouped, single, 4 pools6,9566,2424,5144,461
ungrouped, batched, 1 pool13,48012,0277,1046,358
5k groups, single, 1 pool936939754750
5k groups, single, 4 pools2,8642,6111,9261,894
5k groups, batched, 1 pool6,8115,2703,7443,572

One pool is 10 workers and one dispatcher.