Priority with fairness
Priority picks which job runs first, and a fair share gives every class a minimum of service. With 15 jobs/s in each of two classes, strict priority can stop the low class. A fair share lets the free jobs finish within 110 s.
See it on the board
The same traffic runs on two boards. The simulator measured both when this page was built.
| Measure | Goal | One line in arrival order | Priority with a fair share |
|---|---|---|---|
| Queue lag (Paid) | under 5 s | 30.8 s Fail | 1 s Pass |
| Queue lag (Free) | under 50 s | 30.8 s Pass | 41.8 s Pass |
| Completion time (Free) | under 110 s | 90.77 s Pass | 91.12 s Pass |
| Lost writes | none | 0 Pass | 0 Pass |
| Monthly cost | 8 USD/mo | 8 USD/mo | |
| p99 latency | 92 ms | 92 ms | |
| Error rate | 0% | 0% |
Key numbers
| Number | Value |
|---|---|
| Messages per second, one queue | 20,000 ops/s |
| Queue hop, median | 0.5 ms |
| Default prefetch for each consumer | 20 messages |
4 workers · 3 jobs waiting · wait 33 ms
How it works
One queue often holds more than one kind of work. Paid users and free users send jobs to the same workers. If the queue serves jobs in arrival order, a burst of free jobs makes paid jobs wait behind it.
Priority fixes that. Paid jobs go ahead of free jobs, so paid lag stays low. But strict priority has a problem. When paid jobs keep arriving, free jobs never reach the front. They starve. The average latency can look fine while one class never completes.
Fair scheduling gives each class a minimum share of the workers. Paid jobs still go first in their share, and free jobs still make progress in theirs. When the paid class is quiet, free jobs use the spare capacity.
In the mini board both classes send 15 jobs/s of 1 s each for one minute, and 20 consumers serve them. In order of arrival, paid lag is too high. With priority and fair share, paid lag stays under 5 s, and the free jobs finish within 110 s.
Check each class on its own: lag and completion time. Do not trust one average.
In the levels you set priority and a fair share and read the results for each class.