github.com/mattyr/nomad@v0.3.3-0.20160919021406-3485a065154a/website/source/docs/jobops/resources.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Operating a Job: Resource Utilization" 4 sidebar_current: "docs-jobops-resource-utilization" 5 description: |- 6 Learn how to see resource utilization of a Nomad Job. 7 --- 8 9 # Determining Resource Utilization 10 11 Understanding the resource utilization of your application is important for many 12 reasons and Nomad supports reporting detailed statistics in many of its drivers. 13 The main interface for seeing resource utilization is with the [`alloc-status` 14 command](/docs/commands/alloc-status.html) by specifying the `-stats` flag. 15 16 In the below example we are running `redis` and can see its resource utilization 17 below: 18 19 ``` 20 $ nomad alloc-status c3e0 21 ID = c3e0e3e0 22 Eval ID = 617e5e39 23 Name = example.cache[0] 24 Node ID = 39acd6e0 25 Job ID = example 26 Client Status = running 27 Created At = 06/28/16 16:42:42 UTC 28 29 Task "redis" is "running" 30 Task Resources 31 CPU Memory Disk IOPS Addresses 32 957/1000 30 MiB/256 MiB 300 MiB 0 db: 127.0.0.1:34907 33 34 Memory Stats 35 Cache Max Usage RSS Swap 36 32 KiB 79 MiB 30 MiB 0 B 37 38 CPU Stats 39 Percent Throttled Periods Throttled Time 40 73.66% 0 0 41 42 Recent Events: 43 Time Type Description 44 06/28/16 16:43:50 UTC Started Task started by client 45 06/28/16 16:42:42 UTC Received Task received by client 46 ``` 47 48 Here we can see that we are near the limit of our configured CPU but we have 49 plenty of memory headroom. We can use this information to alter our job's 50 resources to better reflect is actually needs: 51 52 ``` 53 resource { 54 cpu = 2000 55 memory = 100 56 } 57 ``` 58 59 Adjusting resources is very important for a variety of reasons: 60 61 * Ensuring your application does not get OOM killed if it hits its memory limit. 62 * Ensuring the application performs well by ensuring it has some CPU allowance. 63 * Optimizing cluster density by reserving what you need and not over-allocating. 64 65 While single point in time resource usage measurements are useful, it is often 66 more useful to graph resource usage over time to better understand and estimate 67 resource usage. Nomad supports outputting resource data to statsite and statsd 68 and is the recommended way of monitoring resources. For more information about 69 outputting telemetry see the [Telemetry documentation](/docs/agent/telemetry.html). 70 71 For more advanced use cases, the resource usage data may also be accessed via 72 the client's HTTP API. See the documentation of the Client's 73 [Allocation HTTP API](/docs/http/client-allocation-stats.html)