// Module included in the following assemblies:
//
// assembly-management-tasks.adoc

[id='proc-setting-broker-limits-{context}']

= Setting limits on brokers using the Kafka Static Quota plugin

[role="_abstract"]
Use the _Kafka Static Quota_ plugin to set throughput and storage limits on brokers in your Kafka cluster.
You enable the plugin and set limits by configuring the `Kafka` resource.
You can set a byte-rate threshold and storage quotas to put limits on the clients interacting with your brokers.

You can set byte-rate thresholds for producer and consumer bandwidth.
The total limit is distributed across all clients accessing the broker.
For example, you can set a byte-rate threshold of 40 MBps for producers.
If two producers are running, they are each limited to a throughput of 20 MBps.

Storage quotas throttle Kafka disk storage limits between a soft limit and hard limit.
The limits apply to all available disk space.
Producers are slowed gradually between the soft and hard limit.
The limits prevent disks filling up too quickly and exceeding their capacity.
Full disks can lead to issues that are hard to rectify.
The hard limit is the maximum storage limit.

NOTE: For JBOD storage, the limit applies across all disks.
If a broker is using two 1 TB disks and the quota is 1.1 TB, one disk might fill and the other disk will be almost empty.

.Prerequisites

* The Cluster Operator that manages the Kafka cluster is running.

.Procedure

. Add the plugin properties to the `config` of the `Kafka` resource.
+
The plugin properties are shown in this example configuration.
+
.Example Kafka Static Quota plugin configuration
[source,yaml,options="nowrap",subs="+attributes"]
----
apiVersion: {KafkaApiVersion}
kind: Kafka
metadata:
  name: my-cluster
spec:
  kafka:
    # ...
    config:
      client.quota.callback.class: io.strimzi.kafka.quotas.StaticQuotaCallback <1>
      client.quota.callback.static.produce: 1000000 <2>
      client.quota.callback.static.fetch: 1000000 <3>
      client.quota.callback.static.storage.soft: 400000000000 <4>
      client.quota.callback.static.storage.hard: 500000000000 <5>
      client.quota.callback.static.storage.check-interval: 5 <6>
----
<1> Loads the Kafka Static Quota plugin.
<2> Sets the producer byte-rate threshold. 1 MBps in this example.
<3> Sets the consumer byte-rate threshold. 1 MBps in this example.
<4> Sets the lower soft limit for storage. 400 GB in this example.
<5> Sets the higher hard limit for storage. 500 GB in this example.
<6> Sets the interval in seconds between checks on storage. 5 seconds in this example. You can set this to 0 to disable the check.

. Update the resource.
+
[source,shell,subs=+quotes]
kubectl apply -f _<kafka_configuration_file>_

[role="_additional-resources"]
.Additional resources

* xref:con-broker-config-properties-str[Kafka broker configuration tuning]
* xref:user_quotas[Setting user quotas]
