Java 21 introduces virtual threads through Project Loom, enhancing memory efficiency and garbage collection. Unlike traditional threads, virtual threads utilize minimal memory and create fewer garbage collection pauses, improving performance under high load. Tests reveal significantly reduced heap pressure and enhanced system responsiveness, particularly in I/O-heavy applications.
