No single garbage collector wins every metric—you always trade Throughput, Tail Latency (Pause Time) and Memory/CPU Overhead. Modern HotSpot lets you switch effortlessly from default G1 to sub-millisecond Generational ZGC or Shenandoah with a single JVM flag.
More lessons in Complete Core Java