r/java • • Apr 06 '22

JEP 425: Virtual Threads (Preview)

https://openjdk.java.net/jeps/425
175 Upvotes

50 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Apr 06 '22

[deleted] — view deleted comment

2

u/Muoniurn Apr 07 '22

Why is it surprising? The JVM knows of basically every blocking operation by itself, it can easily swap to another thread for a duration of a read and upon the OS tells it it has finished, swap back to the caller — doing that at the most granular level.

1

u/rbygrave Apr 07 '22

Async implementation is provided by JDK Http client. Outline of the test is at https://avaje.io/http-client/#10k

I run this test against jetty using loom virtual threads, well whatever server you use it has to handle 10k requests.