I have a Kafka broker (2.7.1) running on Java 11.
I noticed that the broker is slow because of the G1 old generation collections.
Taking a heap dump reveled that about 30% of heap is used by a ConcurrentHashMap$Node which retains 1000s of org.apache.kafka.common.metrics.Sensor objects.
Why does Kafka keeps so many Sensor objects?
Looking at the Kafka log, I see that a Sensor is mentioned only twice.
INFO Created ConnectionAcceptRate sensor, quotaLimit=2147483647 (kafka.network.ConnectionQuotas)
INFO Created ConnectionAcceptRate-PLAINTEXT sensor, quotaLimit=2147483647 (kafka.network.ConnectionQuotas)
Is there a Kafka configuration that can change to reduce the amount of memory usage?