Java Version
You should use the latest update for Java version 1.8 and make sure that G1 garbage collection support is enabled. (G1 support is enabled by default in recent versions of Java.)
Here are several recommended settings for the JVM:
-Xmx6g -Xms6g -XX:MetaspaceSize=96m -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:G1HeapRegionSize=16M -XX:MinMetaspaceFreeRatio=50 -XX:MaxMetaspaceFreeRatio=80
To set JVM heap size for the Kafka broker, export KAFKA_HEAP_OPTS
;
for example:
export KAFKA_HEAP_OPTS="-Xmx2g -Xms2g"
./kafka-server-start.sh