Java 21 Virtual threads
Java 21 VirtualThreads Recently I was reading over Java 21 release notes and one feature that caught my attention was Virtual Threads. In this blog post I will explore how Virtual threads can be better than platform threads with some examples. The intention of this blog post is more towards trying to benchmark their performance across various tasks. This is to make sure I understand the strengths of virtual threads and where to use them rather than providing any verdict on use of virtual threads. From what I understand from the documentation of JEP 444 (https://openjdk.org/jeps/444), Virtual threads provide greater flexibility in parallelizing workloads since each virtual thread can be mapped to the same OS thread and so have the following main advantages 1) The number of virtual threads that can be spawned is much higher than the number of platform threads enabling thread-per-request style 2) Virtual threads improve scalability with asynchronous styl...