Files
nomad/website/source/docs/job-specification/resources.html.md
Seth Vargo c86a07d834 Separate agent configuration into its own pages
I apologize in advance for the rather long PR, but unfortunately there
is not an easy way to break this up into smaller chunks. This separates
the agent configuration into smaller, more consumable pieces just like
the job specification.
2016-11-02 18:30:00 -04:00

2.2 KiB

layout, page_title, sidebar_current, description
layout page_title sidebar_current description
docs resources Stanza - Job Specification docs-job-specification-resources The "resources" stanza describes the requirements a task needs to execute. Resource requirements include memory, disk space, network, cpu, and more.

resources Stanza

Placement job -> group -> task -> **resources**

The resources stanza describes the requirements a task needs to execute. Resource requirements include memory, disk space, network, cpu, and more.

job "docs" {
  group "example" {
    task "server" {
      resources {
        cpu    = 100
        disk   = 50
        memory = 256

        network {
          mbits = 100
          port "http" {}
          port "ssh" {
            static = 22
          }
        }
      }
    }
  }
}

resources Parameters

  • cpu (int: 100) - Specifies the CPU required to run this task in MHz.

  • disk (int: 200) - Specifies the disk space required in MB.

  • iops (int: 0) - Specifies the number of IOPS required given as a weight between 0-1000.

  • memory (int: 300) - Specifies the memory required in MB

  • network (Network: ) - Specifies the network requirements, including static and dynamic port allocations.

resources Examples

The following examples only show the resources stanzas. Remember that the resources stanza is only valid in the placements listed above.

Disk Space

This example specifies the task requires 100MB of disk space to operate:

resources {
  disk = 100
}

Memory

This example specifies the task requires 2GB of RAM to operate. 2GB is the equivalent of 2000MB:

resources {
  memory = 2000
}

Network

This example shows network constraints as specified in the network stanza which require 1GBit of bandwidth, dynamically allocates two ports, and statically allocates one port:

resources {
  network {
    mbits = 1000
    port "http" {}
    port "https" {}
    port "lb" {
      static = "8889"
    }
  }
}