Future for Java: Virtual Thread
Article Summary
Woowa Brothers needed to handle massive I/O in their authentication gateway. Java's traditional threads couldn't keep up, so they explored virtual threads.
This deep dive from Delivery Hero's engineering team examines Java's virtual threads (Project Loom), now official in JDK 21. The team compares performance against traditional threads, Kotlin coroutines, and reactive programming through real load testing.
Key Takeaways
- Virtual threads use 10KB stack vs 2MB for regular threads
- 51% performance boost on I/O tasks, but worse for CPU-bound work
- Virtual threads beat Kotlin coroutines by 37% and reactive by 111%
- No code changes needed: drop-in replacement for traditional threads
- Pinning with synchronized blocks can kill virtual thread performance
Critical Insight
Virtual threads deliver dramatic performance gains for I/O-heavy Java applications without requiring reactive programming's complexity or code rewrites.