Installing and configuring Apache Kafka
Also available as:
PDF

Java Version

With Apache Kafka on HDP 2.5, 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.) If you prefer to use Java 1.7, make sure that you use update u51 or later.

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