Java Virtual Threads: a Comprehensive Case Study

The release of JDK 21 brought into general availability a much-publicized new function, Java Virtual Threads. This feature marks a significant leap forward in how Java developers can better handle parallelism in their applications. Some of the aims of Java Virtual Threads include:

  • lightweight, scalable, and user-friendly concurrency model
  • efficient utilization of system resources
  • “dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications” (JEP425)

Virtual threads have sparked great interest in the Java developer community, which includes application frameworks, such as , an open-source, modular, cloud-native Java application runtime. As members of the Liberty performance engineering team, we evaluated if this new Java capability could be of benefit to our users, or even potentially replace the current thread pool logic used in the Liberty application runtime itself. At the very least, we wanted to better understand the virtual thread technology and how it performs, so that we could provide informed guidance to Liberty users.