github.com/smintz/nomad@v0.8.3/website/source/guides/operating-a-job/resource-utilization.html.md (about) 1 --- 2 layout: "guides" 3 page_title: "Resource Utilization - Operating a Job" 4 sidebar_current: "guides-operating-a-job-resource-utilization" 5 description: |- 6 Nomad supports reporting detailed job statistics and resource utilization 7 metrics for most task drivers. This section describes the ways to inspect a 8 job's resource consumption and utilization. 9 --- 10 11 # Resource Utilization 12 13 Understanding the resource utilization of an application is important, and Nomad 14 supports reporting detailed statistics in many of its drivers. The main 15 interface for seeing resource utilization is the `alloc status` command with the 16 `-stats` flag. 17 18 This section will utilize the job named "docs" from the [previous 19 sections](/guides/operating-a-job/submitting-jobs.html), but these operations 20 and command largely apply to all jobs in Nomad. 21 22 As a reminder, here is the output of the run command from the previous example: 23 24 ```text 25 $ nomad job run docs.nomad 26 ==> Monitoring evaluation "42d788a3" 27 Evaluation triggered by job "docs" 28 Allocation "04d9627d" created: node "a1f934c9", group "example" 29 Allocation "e7b8d4f5" created: node "012ea79b", group "example" 30 Allocation "5cbf23a1" modified: node "1e1aa1e0", group "example" 31 Evaluation status changed: "pending" -> "complete" 32 ==> Evaluation "42d788a3" finished with status "complete" 33 ``` 34 35 To see the detailed usage statistics, we can issue the command: 36 37 ```shell 38 $ nomad alloc status -stats 04d9627d 39 ID = 04d9627d 40 Eval ID = 42d788a3 41 Name = docs.example[2] 42 Node ID = a1f934c9 43 Job ID = docs 44 Client Status = running 45 46 Task "server" is "running" 47 Task Resources 48 CPU Memory Disk IOPS Addresses 49 75/100 MHz 784 KiB/10 MiB 300 MiB 0 http: 10.1.1.196:5678 50 51 Memory Stats 52 Cache Max Usage RSS Swap 53 56 KiB 1.3 MiB 784 KiB 0 B 54 55 CPU Stats 56 Percent Throttled Periods Throttled Time 57 0.00% 0 0 58 59 Recent Events: 60 Time Type Description 61 <timestamp> Started Task started by client 62 <timestamp> Received Task received by client 63 ``` 64 65 Here we can see that we are near the limit of our configured CPU but we have 66 plenty of memory headroom. We can use this information to alter our job's 67 resources to better reflect is actually needs: 68 69 ```hcl 70 resource { 71 cpu = 200 72 memory = 10 73 } 74 ``` 75 76 Adjusting resources is very important for a variety of reasons: 77 78 * Ensuring your application does not get OOM killed if it hits its memory limit. 79 * Ensuring the application performs well by ensuring it has some CPU allowance. 80 * Optimizing cluster density by reserving what you need and not over-allocating. 81 82 While single point in time resource usage measurements are useful, it is often 83 more useful to graph resource usage over time to better understand and estimate 84 resource usage. Nomad supports outputting resource data to statsite and statsd 85 and is the recommended way of monitoring resources. For more information about 86 outputting telemetry see the [telemetry 87 documentation](/docs/agent/telemetry.html). 88 89 For more advanced use cases, the resource usage data is also accessible via the 90 client's HTTP API. See the documentation of the Client's [allocation HTTP 91 API](/api/client.html).