open-nomad/website/source/docs/job-specification/resources.html.md
Alex Dadgar 1e3c3cb287 Deprecate IOPS
IOPS have been modelled as a resource since Nomad 0.1 but has never
actually been detected and there is no plan in the short term to add
detection. This is because IOPS is a bit simplistic of a unit to define
the performance requirements from the underlying storage system. In its
current state it adds unnecessary confusion and can be removed without
impacting any users. This PR leaves IOPS defined at the jobspec parsing
level and in the api/ resources since these are the two public uses of
the field. These should be considered deprecated and only exist to allow
users to stop using them during the Nomad 0.9.x release. In the future,
there should be no expectation that the field will exist.
2018-12-06 15:09:26 -08:00

90 lines
1.9 KiB
Markdown

---
layout: "docs"
page_title: "resources Stanza - Job Specification"
sidebar_current: "docs-job-specification-resources"
description: |-
The "resources" stanza describes the requirements a task needs to execute.
Resource requirements include memory, network, cpu, and more.
---
# `resources` Stanza
<table class="table table-bordered table-striped">
<tr>
<th width="120">Placement</th>
<td>
<code>job -> group -> task -> **resources**</code>
</td>
</tr>
</table>
The `resources` stanza describes the requirements a task needs to execute.
Resource requirements include memory, network, CPU, and more.
```hcl
job "docs" {
group "example" {
task "server" {
resources {
cpu = 100
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.
- `memory` `(int: 300)` - Specifies the memory required in MB
- `network` <code>([Network][]: <required>)</code> - 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.
### Memory
This example specifies the task requires 2 GB of RAM to operate. 2 GB is the
equivalent of 2000 MB:
```hcl
resources {
memory = 2000
}
```
### Network
This example shows network constraints as specified in the [network][] stanza
which require 1 Gbit of bandwidth, dynamically allocates two ports, and
statically allocates one port:
```hcl
resources {
network {
mbits = 1000
port "http" {}
port "https" {}
port "lb" {
static = "8889"
}
}
}
```
[network]: /docs/job-specification/network.html "Nomad network Job Specification"