Skip to main content

Task Queue Priority and Fairness - Interactive Walkthrough

The core idea of Task Queue Priority and Fairness is that when tasks from different workloads compete for the same Workers, Priority controls which ones get picked first, and Fairness ensures no single tenant can run away with all the capacity.

Priority

Every task carries a priorityKey from 1 (critical) to 5 (batch), with 3 as the default. When a Worker polls, it always picks the lowest-numbered task first regardless of arrival time. This lets you share a single Worker pool across very different workloads and guarantee that time-sensitive work never waits behind low-urgency jobs.

Fairness

Without Fairness, tasks at the same priority dispatch strictly FIFO, so a backlog-heavy tenant can block everyone else at that level indefinitely. Fairness groups tasks by fairnessKey and dispatches proportionally by fairnessWeight. A key with weight 5 gets roughly 5x more dispatches than a key with weight 1, but no key is ever completely locked out.

Use both together when you need SLA ordering across workload types and fair distribution across tenants within each tier.

P1 · Critical
P2 · High
P3 · Normal (default)
P4 · Low
P5 · Batch