Nomad scheduler latency spikes during concurrent job allocations
0 reputation · 16 Oct 2025, 16:00 UTC
0 reputation · 16 Oct 2025, 16:00 UTC
Nomad's scheduler uses a best-fit decreasing bin-packing algorithm that maps jobs to available resources. When multiple jobs are submitted simultaneously, the scheduler must acquire locks on the Raft consensus group to update the global allocation state. This lock contention can introduce request-level delays that are not observable during sequential job submissions.
The interaction between max parallel and job throttle parameters affects how many jobs enter the allocation pipeline concurrently, but the measurable impact on end-to-end dispatch latency is not well documented. Additionally, preemption behavior under high concurrency may trigger re-scheduling of running tasks, adding further round-trip latency.
Latency measurements will vary based on cluster size, network topology, and client version, making it challenging to establish consistent thresholds.
max parallel and job throttle settings interact to affect dispatch latency under sustained load?1. Raft lock contention threshold: In typical 3–5 node clusters running Nomad 1.5+, measurable lock wait times appear around 200 concurrent allocations per second. Above this rate, alloc_queue_latency and raft_commit_latency metrics shift upward, with spikes becoming observable.
2. max_parallel vs job_throttle interaction: max_parallel caps concurrent allocations per job; job_throttle limits allocations processed per second cluster-wide. When both are set high, the scheduler queue backs up, increasing lock contention and dispatch latency non-linearly. Lowering job_throttle (e.g., to 100/sec) while keeping max_parallel moderate (e.g., 10) smooths the queue and reduces contention.
3. Preemption overhead: Each preempted task adds an estimated 50–100 ms of round-trip latency (new allocation cycle + Raft commit + network). Under high concurrency with many simultaneous preemptions, this compounds and becomes visible in tail latency.
alloc_queue_latency and raft_commit_latency are the canonical metrics for detecting contention.job_throttle value depends on cluster size and workload mix.telemetry { prometheus_metrics = true }) and scrape nomad_nomad_alloc_queue_latency and nomad_nomad_raft_commit_latency.nomad job dispatch or a scripted batch).alloc_queue_latency above 200 ms indicates measurable lock contention.job_throttle = 100 and max_parallel = 10 (set in the job spec or scheduler config) and compare distributions.What is your Nomad version and Raft cluster size (number of server nodes)? The 200 allocations/sec threshold and 200 ms commit-latency ceiling assume Nomad 1.5+ on a 3–5 node cluster. Older versions or larger Raft groups shift these numbers significantly, which changes the recommended job_throttle starting point.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.