// Module included in the following assemblies:
//
// assembly-resource-limits-and-requests.adoc

[id='ref-resource-limits-and-requests-{context}']
= Resource limits and requests

Resource limits and requests are configured using the `resources` property in the following resources:

* `Kafka.spec.kafka`
* `Kafka.spec.zookeeper`
* `Kafka.spec.entityOperator.topicOperator`
* `Kafka.spec.entityOperator.userOperator`
* `Kafka.spec.entityOperator.tlsSidecar`
* `Kafka.spec.KafkaExporter`
* `KafkaConnect.spec`
* `KafkaConnectS2I.spec`
* `KafkaBridge.spec`

.Additional resources
* For more information about managing computing resources on Kubernetes, see {K8sManagingComputingResources}.

== Resource requests

Requests specify the resources to reserve for a given container.
Reserving the resources ensures that they are always available.

IMPORTANT: If the resource request is for more than the available free resources in the Kubernetes cluster, the pod is not scheduled.

Resources requests are specified in the `requests` property.
Resources requests currently supported by Strimzi:

* `cpu`
* `memory`

A request may be configured for one or more supported resources.

.Example resource request configuration with all resources
[source,yaml,subs="attributes+"]
----
# ...
resources:
  requests:
    cpu: 12
    memory: 64Gi
# ...
----

== Resource limits

Limits specify the maximum resources that can be consumed by a given container.
The limit is not reserved and might not always be available.
A container can use the resources up to the limit only when they are available.
Resource limits should be always higher than the resource requests.

Resource limits are specified in the `limits` property.
Resource limits currently supported by Strimzi:

* `cpu`
* `memory`

A resource may be configured for one or more supported limits.

.Example resource limits configuration
[source,yaml,subs="attributes+"]
----
# ...
resources:
  limits:
    cpu: 12
    memory: 64Gi
# ...
----

== Supported CPU formats

CPU requests and limits are supported in the following formats:

* Number of CPU cores as integer (`5` CPU core) or decimal (`2.5` CPU core).
* Number or _millicpus_ / _millicores_ (`100m`) where 1000 _millicores_ is the same `1` CPU core.

.Example CPU units
[source,yaml,subs="attributes+"]
----
# ...
resources:
  requests:
    cpu: 500m
  limits:
    cpu: 2.5
# ...
----

NOTE: The computing power of 1 CPU core may differ depending on the platform where Kubernetes is deployed.

.Additional resources
* For more information on CPU specification, see the {K8sMeaningOfCpu}.

== Supported memory formats

Memory requests and limits are specified in megabytes, gigabytes, mebibytes, and gibibytes.

* To specify memory in megabytes, use the `M` suffix. For example `1000M`.
* To specify memory in gigabytes, use the `G` suffix. For example `1G`.
* To specify memory in mebibytes, use the `Mi` suffix. For example `1000Mi`.
* To specify memory in gibibytes, use the `Gi` suffix. For example `1Gi`.

.An example of using different memory units
[source,yaml,subs="attributes+"]
----
# ...
resources:
  requests:
    memory: 512Mi
  limits:
    memory: 2Gi
# ...
----

.Additional resources
* For more details about memory specification and additional supported units, see {K8sMeaningOfMemory}.
