Design a Distributed Job Queue, stage 4 of 9: decide
One slow job type
Dropbox's task framework gives each combination of task type and priority its own queue. Slack's relay can rate-limit each job type independently.
System so far· 7 parts
Select a component to see what it is responsible for and which state it owns.
- 1Web servers → Enqueue gateway: Enqueue job
- 2Enqueue gateway → Kafka: Append to topic
- 3Relay → Kafka: Read topics
- 4Relay → Redis queues: Push at a controlled rate
- 5Workers → Redis queues: Lease jobs
- 6Workers → Databases and services: Do the work
What you need to know
Isolation means giving each kind of work its own capacity, so that a problem in one can't consume another's. In a job system that means separate queues, separate worker pools, and separate rate limits per job type or priority.
A priority is different: it changes the order work is taken in, but everything still shares the same workers.
Check
Notifications have high priority and indexing low. All workers are already busy with slow indexing jobs when a notification arrives. When does it run?Isolation also protects downstream systems. If search is degraded, every indexing job makes it worse. A per-type rate limit caps how fast indexing jobs are released, so the degraded search cluster gets room to recover instead of a flood.
Think first
Search is degraded for an hour. Should indexing jobs be dropped, or delayed until it recovers?