Describe CPU and Memory resources.

This commit is contained in:
Eric Tune 2016-07-08 10:24:10 -07:00
parent 0934c1f71c
commit 389c77b6ac
1 changed files with 26 additions and 0 deletions

View File

@ -40,6 +40,32 @@ about pod resource requests/limits. A *pod resource request/limit* for a partic
type is the sum of the resource requests/limits of that type for each container in the pod, with type is the sum of the resource requests/limits of that type for each container in the pod, with
unset values treated as zero (or equal to default values in some cluster configurations). unset values treated as zero (or equal to default values in some cluster configurations).
### Meaning of CPU
Limits and requests for `cpu` are measured in cpus.
One cpu, in Kubernetes, is equivalent to:
- 1 AWS vCPU
- 1 GCP Core
- 1 Azure vCore
- 1 *Hyperthread* on a bare-metal Intel processor with Hyperthreading
Fractional requests are allowed. A container with `spec.container[].resources.requests.cpu` of `0.5` will
be guaranteed half as much CPU as one that asks for `1`. The expression `0.1` is equivalent to the expression
`100m`, which can be read as "one hundred millicpu" (some may say "one hundred millicores", and this is understood
to mean the same thing when talking about Kubernetes). A request with a decimal point, like `0.1` is converted to
`100m` by the API, and precision finer than `1m` is not allowed. For this reason, the form `100m` may be preferred.
CPU is always requested as an absolute quantity, never as a relative quantity; 0.1 is the same amount of cpu on a single
core, dual core, or 48 core machine.
# Meaning of Memory
Limits and requests for `memory` are measured in bytes.
Memory can be expressed a plain integer or as fixed-point integers with one of these SI suffixes (E, P, T, G, M, K)
or their power-of-two equivalents (Ei, Pi, Ti, Gi, Mi, Ki). For example, the following represent roughly the same value:
`128974848`, `129e6`, `129M` , `123Mi`.
### Example
The following pod has two containers. Each has a request of 0.25 core of cpu and 64MiB The following pod has two containers. Each has a request of 0.25 core of cpu and 64MiB
(2<sup>20</sup> bytes) of memory and a limit of 0.5 core of cpu and 128MiB of memory. The pod can (2<sup>20</sup> bytes) of memory and a limit of 0.5 core of cpu and 128MiB of memory. The pod can
be said to have a request of 0.5 core and 128 MiB of memory and a limit of 1 core and 256MiB of be said to have a request of 0.5 core and 128 MiB of memory and a limit of 1 core and 256MiB of