BQ Slot
How Slot Fairness Scheduling Works Internally

BigQuery doesn’t just “assign slots.” It uses a fairness scheduler.
? High-Level Model
Each reservation has:
Slot pool
Job queue
Fairness allocator
Scheduler attempts to balance:
Throughput
Latency
Resource isolation
? Slot Allocation Is Stage-Based
Query → broken into stages
Stage → requests slots
Scheduler grants slots dynamically
Slots are NOT statically bound to a query.
? Fair Share Model
If:
Reservation = 1000 slots
2 queries running
Each initially gets ~500.
If one finishes:
Other gets up to 1000.
? When Many Queries Compete
Example:
1000 slots
10 active queries
Scheduler might:
Give each 100 slots initially
Reallocate as stages finish
Prioritize interactive over batch (if configured)
? Slot Contention Internally
Contention occurs when:
Requested slots > Available slots
Then:
Queries queue
Or stages get fewer slots
Runtime increases
? Hidden Behavior: Elastic Stage Scaling
Within a single query:
Early scan stages may use many slots
Later aggregation uses fewer
Slots are recycled immediately
This maximizes cluster utilization.
? Why Long Queries Hurt Everyone
Because fairness scheduling:
Can’t preempt mid-stage easily
Heavy shuffle stages monopolize slots
Increase queue time for others
Which is why workload isolation matters.
Comments (0)
No comments yet.
