# Metric-server cpu and memory units

**URL:** <https://discuss.kubernetes.io/t/metric-server-cpu-and-memory-units/7497>\
**Category:** General Discussions\
**Tags:** metrics-server\
**Created:** [August 9, 2019, 7:17am UTC](https://discuss.kubernetes.io/t/metric-server-cpu-and-memory-units/7497 "2019-08-09T07:17:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![silpa\_viswambaran](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/silpa_viswambaran/32/3393_2.png) [@silpa\_viswambaran](https://discuss.kubernetes.io/u/silpa_viswambaran)\
**Post date:** [August 9, 2019, 7:17am UTC](https://discuss.kubernetes.io/t/metric-server-cpu-and-memory-units/7497/1 "2019-08-09T07:17:04Z")

</div>

Using metrics server I am getting cpu and memory usage of a pod.  
for ex: “usage”:{“cpu”:“576285n”,“memory”:“182792Ki”}  
Wanted to know what is the unit of cpu usage and memory here?  
Is the metric value returned is CPU usage%?

---

<div class="post-metadata">

**Author:** ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)\
**Post date:** [August 9, 2019, 12:53pm UTC](https://discuss.kubernetes.io/t/metric-server-cpu-and-memory-units/7497/2 "2019-08-09T12:53:38Z")

</div>

`n` stands for “nanocores” or “nanoCPU”. Kubernetes CPU metrics are generally “expressed” when a person deals with them in millicores/milliCPU, or 1/1000 of a cpu. a nanocore/nanoCPU is 1/1000000000 (1 billionth) of a cpu. for a little more info the docs have a section on [CPU Units](https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/#cpu-units) but they only really describe millicores/milliCPU.

`Ki` is a [Kibibyte](https://en.wikipedia.org/wiki/Kibibyte). Kubernetes supports both [Binary Units](https://en.wikipedia.org/wiki/Binary_prefix) and [Metric Units](https://en.wikipedia.org/wiki/Metric_prefix) when writing pod specs and such, but for metrics things are emitted as [Binary Units](https://en.wikipedia.org/wiki/Binary_prefix).

---

<div class="post-metadata">

**Author:** ![silpa\_viswambaran](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/silpa_viswambaran/32/3393_2.png) [@silpa\_viswambaran](https://discuss.kubernetes.io/u/silpa_viswambaran)\
**Post date:** [August 12, 2019, 9:41am UTC](https://discuss.kubernetes.io/t/metric-server-cpu-and-memory-units/7497/3 "2019-08-12T09:41:40Z")

</div>

Can we convert this nanocores to CPU usage percentage?

---

<div class="post-metadata">

**Author:** ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)\
**Post date:** [August 14, 2019, 12:09pm UTC](https://discuss.kubernetes.io/t/metric-server-cpu-and-memory-units/7497/4 "2019-08-14T12:09:02Z")

</div>

It sort of is. Millicores came about to be a better approximation of CPU since “true” CPU% or allocation can vary depending on the platform.

Think of cpu usage set to 50%. 50% means different things on a system with 1 core vs 8 cores. With Millicores `1000m` will always equal 1 core. If you see something consuming `750m` you know it is roughly 75% of a **single core**. With that, if you want to approximate CPU %, you would:

`current millicore usage / (cores * 1000)`

Hope that makes sense 😅

---

<div class="post-metadata">

**Author:** ![rata](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/rata/32/18244_2.png) [@rata](https://discuss.kubernetes.io/u/rata)\
**Post date:** [August 15, 2019, 7:53am UTC](https://discuss.kubernetes.io/t/metric-server-cpu-and-memory-units/7497/5 "2019-08-15T07:53:44Z")

</div>

I’d add that for me it was also relevant to know which percentage of the requested to that pod was used by that pod.

So, instead of dividing by cores \*1000, just divide by the requested.

Both numbers might be useful, in my case this one was more useful for developers so they knew they when they were using a big percentage of what was guaranteed and react (either reduce cpu usage or increase the request).

---

<div class="post-metadata">

**Author:** ![silpa\_viswambaran](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/silpa_viswambaran/32/3393_2.png) [@silpa\_viswambaran](https://discuss.kubernetes.io/u/silpa_viswambaran)\
**Post date:** [August 17, 2019, 10:10am UTC](https://discuss.kubernetes.io/t/metric-server-cpu-and-memory-units/7497/6 "2019-08-17T10:10:09Z")

</div>

Thanks @mrbobbytables and @rata. This helped me alot. 🙂
