github.com/taylorchu/nomad@v0.5.3-rc1.0.20170407200202-db11e7dd7b55/website/source/docs/operating-a-job/resource-utilization.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Resource Utilization - Operating a Job" 4 sidebar_current: "docs-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](/docs/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 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 ``` 40 41 And here is some sample output: 42 43 ```text 44 $ nomad alloc-status c3e0 45 ID = 04d9627d 46 Eval ID = 42d788a3 47 Name = docs.example[2] 48 Node ID = a1f934c9 49 Job ID = docs 50 Client Status = running 51 52 Task "server" is "running" 53 Task Resources 54 CPU Memory Disk IOPS Addresses 55 75/100 MHz 784 KiB/10 MiB 300 MiB 0 http: 10.1.1.196:5678 56 57 Memory Stats 58 Cache Max Usage RSS Swap 59 56 KiB 1.3 MiB 784 KiB 0 B 60 61 CPU Stats 62 Percent Throttled Periods Throttled Time 63 0.00% 0 0 64 65 Recent Events: 66 Time Type Description 67 <timestamp> Started Task started by client 68 <timestamp> Received Task received by client 69 ``` 70 71 Here we can see that we are near the limit of our configured CPU but we have 72 plenty of memory headroom. We can use this information to alter our job's 73 resources to better reflect is actually needs: 74 75 ```hcl 76 resource { 77 cpu = 200 78 memory = 10 79 } 80 ``` 81 82 Adjusting resources is very important for a variety of reasons: 83 84 * Ensuring your application does not get OOM killed if it hits its memory limit. 85 * Ensuring the application performs well by ensuring it has some CPU allowance. 86 * Optimizing cluster density by reserving what you need and not over-allocating. 87 88 While single point in time resource usage measurements are useful, it is often 89 more useful to graph resource usage over time to better understand and estimate 90 resource usage. Nomad supports outputting resource data to statsite and statsd 91 and is the recommended way of monitoring resources. For more information about 92 outputting telemetry see the [telemetry 93 documentation](/docs/agent/telemetry.html). 94 95 For more advanced use cases, the resource usage data is also accessible via the 96 client's HTTP API. See the documentation of the Client's [allocation HTTP 97 API](/docs/http/client-allocation-stats.html).