github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/design/orchestration/10-review-existing-2-nomad.md (about) 1 2 ### Nomad.Job 3 4 https://www.nomadproject.io/docs/job-specification 5 6 ```mermaid 7 erDiagram 8 Job ||..|{ Group : "has" 9 Group ||..|{ Task : "has" 10 Group |{..|| Host : "tasks are placed on the same" 11 12 Group{ 13 count int "the number of these tasks we want" 14 } 15 16 Task{ 17 driver string "docker, exec, java" 18 config map "driver-specific, image = 'hashicorp/web-frontend'" 19 env map "DB_HOST = 'db01.example.com'" 20 resources map "cpu = 500 #MHz, memory = 1024 #MB" 21 } 22 ``` 23 24 ### Nomad.Scheduling 25 26 https://www.nomadproject.io/docs/internals/scheduling/scheduling 27 28 - There are four primary "nouns" in Nomad; jobs, nodes, allocations, and evaluations. 29 - **Jobs** are submitted by users and represent a desired state 30 - A job is a declarative description of tasks to run which are bounded by constraints and require resources 31 - Tasks can be scheduled on nodes in the cluster running the Nomad client 32 - The mapping of tasks in a job to clients is done using **allocations** 33 - An allocation is used to declare that a set of tasks in a job should be run on a particular node. Scheduling is the process of determining the appropriate allocations and is done as part of an evaluation. 34 - An **evaluation** is created any time the external state, either desired or emergent, changes 35 - The desired state is based on jobs, meaning the desired state changes if a new job is submitted, an existing job is updated, or a job is deregistered 36 - The emergent state is based on the client nodes, and so we must handle the failure of any clients in the system. 37 - These events trigger the creation of a new evaluation, as Nomad must evaluate the state of the world and reconcile it with the desired state. 38 39 40 Process: 41  42 43 44 ### Nomad.Schedulers 45 46 > Nomad ships with a service scheduler that optimizes for long-lived services, a batch scheduler that is used for fast placement of batch jobs, system and sysbatch schedulers that are used to run jobs on every node, and a core scheduler which is used for internal maintenance. 47 48 49 ### Concurrency Races 50 51 > Multiple schedulers are running in parallel without locking or reservations, making Nomad optimistically concurrent. As a result, schedulers might overlap work on the same node and cause resource over-subscription. The plan queue allows the leader node to protect against this and do partial or complete rejections of a plan. 52