Dispatch pools and back-pressure
A dispatch pool (dpl_) is a delivery lane with its own limits. Every dispatch job names a pool
(through its subscription, or directly), and the message router enforces that pool’s limits while
it delivers. Pools are how one consumer’s slowness stays that consumer’s problem.
What a pool sets
Section titled “What a pool sets”| Setting | Meaning |
|---|---|
code, name |
Identity. The code is unique per client. |
concurrency |
How many of the pool’s deliveries may be in progress at once. Default 10. |
rateLimit |
Deliveries per minute, optional. Without it the pool is limited by concurrency alone. |
clientId |
The client that owns the pool, or none for a platform-level pool. |
| owning application | Set when an application’s definition sync created the pool; that application’s syncs may change only pools it owns. |
The router reads the pools from the platform’s router-config document, which it polls every 30 seconds. A changed limit is applied to the running pool in place, without a restart and without dropping anything already buffered.
How a job finds its pool and its queue
Section titled “How a job finds its pool and its queue”The pool. When the dispatch scheduler publishes a job it stamps the pool’s composed code on the message, so the router needs to know nothing about clients:
| The job has | Published pool code |
|---|---|
| A pool owned by a client | {clientIdentifier}-{poolCode}, for example acme-WAREHOUSE |
| A platform-level pool | platform-{poolCode} |
| No pool, and a client | {clientIdentifier}-DEFAULT-POOL |
| Neither | platform-DEFAULT-POOL |
Two clients can each have a pool called FAST, and the prefix keeps them apart. A -DEFAULT-POOL
is created by the router on demand, with concurrency 20 and no rate limit, so every client has a
default lane without configuring one.
The queue. Each client has two queues, DEFAULT and HIGH_PRIORITY (named
{prefix}-{client}-DEFAULT and {prefix}-{client}-HIGH_PRIORITY, with .fifo on SQS). A job
travels on HIGH_PRIORITY when it, or its subscription, asks for it. Queues and pools are
independent: one queue carries messages for many pools, and one pool serves messages from many
queues.
Inside a pool
Section titled “Inside a pool”flowchart LR Q1[[acme-DEFAULT]] --> M[Router: route by pool code] Q2[[acme-HIGH_PRIORITY]] --> M M --> P1[Pool acme-WAREHOUSE<br/>concurrency 2, 60 per minute] M --> P2[Pool acme-DEFAULT-POOL<br/>concurrency 20] P1 --> G1[group order-1042: FIFO] P1 --> G2[group order-1043: FIFO] P2 --> U[ungrouped: in parallel]
The router polls every queue and hands each message to the pool its code names. Inside a pool:
- Messages in an ordered mode with a message group go into that group’s first-in, first-out buffer and are delivered one at a time, in order. Different groups run in parallel.
IMMEDIATEmessages, and messages without a group, are delivered concurrently.- Every delivery takes one of the pool’s concurrency slots, and, when the pool has a rate limit, one token from its rate limiter.
Why one slow consumer cannot starve the others
Section titled “Why one slow consumer cannot starve the others”Give each consumer that might be slow or fragile its own pool. Then:
- its deliveries can occupy at most its own pool’s concurrency, so the other pools keep their slots;
- its rate limit throttles only its own messages;
- and when its pool is full, the router defers its messages instead of blocking the queue they share with other pools.
Deferral when a pool is full
Section titled “Deferral when a pool is full”A pool’s buffer holds max(concurrency × 40, 100) messages. A message for a pool whose buffer is
full is deferred: handed back to the queue to come back later. A deferral is not a failure; it
spends no attempt and does not count against the job.
- Spaced, not a herd. The pool measures how fast it completes work (over the last five minutes) and books each deferred message a slot after the previous one, so they return roughly at the pace the pool can take them, in the order they were deferred.
- A horizon. No deferral asks for more than an hour (
FC_ROUTER_DEFERRAL_MAX_DELAY_SECONDS). A backlog’s tail trickles in over the last quarter of that window. - The queue keeps flowing. The router keeps polling a queue while any pool it feeds has room, and,
with all of them full, while the queue’s deferral budget lasts (15,000 deferred messages,
FC_ROUTER_DEFERRAL_BUDGET). It pauses only when every pool is full and the budget is spent.
Why defer instead of waiting. Before deferral, a queue stopped being polled as soon as any pool it fed was full. One pool with concurrency 1 and a large backlog then parked its client’s whole queue, and every other pool on that queue starved for as long as the backlog took to drain.
What pools do not solve
Section titled “What pools do not solve”Inside one pool, one slow message group can fill the pool’s buffer and delay the other groups in the same pool. That is by design: work that is slow in a different way from its neighbours belongs in a pool of its own.
The rate-limit wait you cannot see
Section titled “The rate-limit wait you cannot see”A pool’s rate limit is a token bucket whose burst is one minute’s worth of messages. A pool at 60 per minute therefore delivers up to 60 messages at once after a quiet spell, then one per second. A pool at 6 per minute delivers a burst of 6, then one every ten seconds. From outside this looks like “ran, then stopped”.
While a message waits for its token it already holds a concurrency slot, and nothing is logged. On
the router dashboard its group shows as draining, it is not listed as mediating, and the job stays
QUEUED in the platform, as do the jobs behind it in the same group.
Pool status holds deliveries
Section titled “Pool status holds deliveries”A pool is ACTIVE, SUSPENDED or ARCHIVED, and the status is enforced:
| Status | Effect |
|---|---|
ACTIVE |
Normal. |
SUSPENDED |
The dispatch scheduler does not claim the pool’s jobs, and the delivery callback returns any that are already queued to PENDING without spending an attempt. They wait. Resuming the pool releases them in order. |
ARCHIVED |
The same hold for existing jobs. In addition no new job or subscription may name the pool: creating a dispatch job or a binding that does answers 409 POOL_ARCHIVED (a batch is refused whole). |
The router-config document still lists every pool, whatever its status. To hold only one consumer’s
deliveries instead, pause the connection the jobs go through
(subscriptions and connections). Held jobs still age: a job that reaches
its maxAgeSeconds limit (24 hours by default) while its pool is suspended becomes EXPIRED instead
of being delivered. See dispatch jobs.
High availability
Section titled “High availability”The router runs active and standby. Pools start only on the router that holds leadership, because a group’s order is kept in that process’s buffers. Concurrency and rate limits are therefore enforced by one process, and mean what they say across the whole installation.
Read next
Section titled “Read next”- Configure pools and connections.
- Runbook: a pool draining slowly and scaling and capacity.
- Message router: consumers, the mediator, circuit breakers and lifecycle.
- Ordering and message groups: what the per-group buffers protect.
- Decision: the router is a poller; a full pool defers.