Hello!

We have a setup where clients are not connecting to Kafka directly, but
rather using a middle layer API for both producing and consuming messages.
This layer is centrally managed by the same tech team that is operating
Kafka, so we don't see a use for the Kafka client quotas mechanism.

At the same time, we see that on each of our Kafka brokers a lot of G1GC
Old Generation heap space is used by the Sensor[1] objects with
inactiveSensorExpirationTimeMs=3_600_000 (=1 hour), which are apparently
used for throughput calculation for enforcing quotas.
In a heap dump we find millions of such objects with the total retained
heap size in the order of magnitude of more than a GB.

We know that our API code is responsible for creating consumers more
often than a typical client would do, and we've taken some measures to
improve it (namely, using a pool of consumers where they are needed for a
short time — to be reused later).
That change did improve the heap occupation of the brokers, but we are now
wondering if it is possible to turn off the metrics collection for quotas
completely, if we are not going to use them anyway?

We are using Apache Kafka 3.3.2.

Looking at the code here:
https://github.com/apache/kafka/blob/3.3.2/core/src/main/scala/kafka/server/ClientQuotaManager.scala#L237
and here:
https://github.com/apache/kafka/blob/3.3.2/core/src/main/scala/kafka/server/ClientQuotaManager.scala#L196-L199
the relevant configuration option seems to be this one:
https://kafka.apache.org/33/documentation.html#brokerconfigs_client.quota.callback.class

But there doesn't seem to be a way to disable it, rather only customize,
which will still lead to metrics being collected.
Setting the config to "null" or an empty string didn't work, as the broker
fails to start with the "class not found" error.

Is there any other way that we have missed?


Kind regards,
--
Alex

[1]:
https://github.com/apache/kafka/blob/3.3.2/clients/src/main/java/org/apache/kafka/common/metrics/Sensor.java

Reply via email to