2015-11-18 06:35:58 +00:00
|
|
|
---
|
2020-02-06 23:45:31 +00:00
|
|
|
layout: docs
|
|
|
|
page_title: Schedulers
|
|
|
|
sidebar_title: Schedulers
|
|
|
|
description: Learn about Nomad's various schedulers.
|
2015-11-18 06:35:58 +00:00
|
|
|
---
|
|
|
|
|
2018-06-22 20:51:41 +00:00
|
|
|
# Schedulers
|
2015-11-18 06:35:58 +00:00
|
|
|
|
2016-10-28 00:36:26 +00:00
|
|
|
Nomad has three scheduler types that can be used when creating your job:
|
|
|
|
`service`, `batch` and `system`. Here we will describe the differences between
|
|
|
|
each of these schedulers.
|
2015-11-18 06:35:58 +00:00
|
|
|
|
|
|
|
## Service
|
|
|
|
|
|
|
|
The `service` scheduler is designed for scheduling long lived services that
|
|
|
|
should never go down. As such, the `service` scheduler ranks a large portion
|
2016-10-11 19:52:50 +00:00
|
|
|
of the nodes that meet the job's constraints and selects the optimal node to
|
2019-05-09 18:53:45 +00:00
|
|
|
place a task group on. The `service` scheduler uses a best fit scoring algorithm
|
|
|
|
influenced by Google's work on [Borg]. Ranking this larger set of candidate
|
|
|
|
nodes increases scheduling time but provides greater guarantees about the
|
|
|
|
optimality of a job placement, which given the service workload is highly
|
|
|
|
desirable.
|
|
|
|
|
2019-05-09 20:01:25 +00:00
|
|
|
Service jobs are intended to run until explicitly stopped by an operator. If a
|
|
|
|
service task exits it is considered a failure and handled according to the job's
|
|
|
|
[restart] and [reschedule] stanzas.
|
2015-11-18 06:35:58 +00:00
|
|
|
|
|
|
|
## Batch
|
|
|
|
|
|
|
|
Batch jobs are much less sensitive to short term performance fluctuations and
|
|
|
|
are short lived, finishing in a few minutes to a few days. Although the `batch`
|
|
|
|
scheduler is very similar to the `service` scheduler, it makes certain
|
|
|
|
optimizations for the batch workload. The main distinction is that after finding
|
2019-05-09 18:53:45 +00:00
|
|
|
the set of nodes that meet the job's constraints it uses the power of two
|
2019-05-10 14:35:21 +00:00
|
|
|
choices described in Berkeley's [Sparrow] scheduler to limit the number of nodes
|
2019-05-09 18:53:45 +00:00
|
|
|
that are ranked.
|
|
|
|
|
2019-05-09 20:01:25 +00:00
|
|
|
Batch jobs are intended to run until they exit successfully. Batch tasks that
|
|
|
|
exit with an error are handled according to the job's [restart] and [reschedule]
|
|
|
|
stanzas.
|
2015-11-18 06:35:58 +00:00
|
|
|
|
|
|
|
## System
|
|
|
|
|
|
|
|
The `system` scheduler is used to register jobs that should be run on all
|
|
|
|
clients that meet the job's constraints. The `system` scheduler is also invoked
|
|
|
|
when clients join the cluster or transition into the ready state. This means
|
|
|
|
that all registered `system` jobs will be re-evaluated and their tasks will be
|
|
|
|
placed on the newly available nodes if the constraints are met.
|
|
|
|
|
|
|
|
This scheduler type is extremely useful for deploying and managing tasks that
|
2016-10-11 19:52:50 +00:00
|
|
|
should be present on every node in the cluster. Since these tasks are
|
2020-03-26 00:10:53 +00:00
|
|
|
managed by Nomad, they can take advantage of job updating,
|
|
|
|
service discovery, and more.
|
2019-01-30 15:24:18 +00:00
|
|
|
|
|
|
|
Since Nomad 0.9, the system scheduler will preempt eligible lower priority
|
|
|
|
tasks running on a node if there isn't enough capacity to place a system job.
|
2019-05-09 18:53:45 +00:00
|
|
|
See [preemption] for details on how tasks that get preempted are chosen.
|
|
|
|
|
2019-05-09 20:01:25 +00:00
|
|
|
Systems jobs are intended to run until explicitly stopped either by an operator
|
|
|
|
or [preemption]. If a system task exits it is considered a failure and handled
|
|
|
|
according to the job's [restart] stanza; system jobs do not have rescheduling.
|
2019-05-09 19:38:43 +00:00
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
[borg]: https://research.google.com/pubs/pub43438.html
|
|
|
|
[sparrow]: https://cs.stanford.edu/~matei/papers/2013/sosp_sparrow.pdf
|
|
|
|
[preemption]: /docs/internals/scheduling/preemption
|
|
|
|
[restart]: /docs/job-specification/restart
|
|
|
|
[reschedule]: /docs/job-specification/reschedule
|