Skip to content
Kafka Is FunProgress

IntermediatePerformance

What is the impact of increasing Kafka's JVM heap size?

Reference answer

Larger JVM heap does NOT improve Kafka performance in most cases. Kafka deliberately delegates caching to the OS page cache. Larger heaps mean longer GC pauses (Stop-The-World) which can cause ISR evictions (if GC > replica.lag.time.max.ms). The recommended pattern: small JVM heap (6-8GB) + lots of OS RAM for page cache. Use G1GC or ZGC with tuned pause targets. Monitor GC pauses and set replica.lag.time.max.ms higher than your 99th percentile GC pause.

Expected key concepts: JVM heap, GC pauses, page cache, OS RAM, G1GC, ZGC, Stop-The-World, ISR evictions, replica.lag.time.max.ms, small heap