Why prioritize work
A single first in first out queue treats a payment confirmation the same as a nightly report. A priority queue lets high value jobs jump ahead so latency sensitive work is not stuck behind bulk work.
How it is built
- Multiple queues per priority class, with workers draining higher classes first.
- A scored queue where each job carries a priority value and the highest is served next.
The starvation trap
If high priority work never stops arriving, low priority jobs may wait forever.
- Aging raises a job priority the longer it waits, guaranteeing it eventually runs.
- Reserved capacity dedicates a slice of workers to lower classes so they always make progress.
Practical notes
- Keep classes few: two or three priorities are easier to reason about than ten.
- Watch fairness: monitor the wait time of the lowest class to catch starvation early.
Key idea
Priority queues let urgent work pass bulk work, but they need aging or reserved capacity so that low priority jobs do not starve while high priority work keeps flowing.