brettwooldridge / NuProcess

Low-overhead, non-blocking I/O, external Process implementation for Java
Apache License 2.0
706 stars 84 forks source link

Virtual threads? #155

Open yawaramin opened 3 months ago

yawaramin commented 3 months ago

This is just a question to satisfy my curiosity. Per the readme:

However, when it comes to memory there is a significant difference. The overhead of 500 threads, for example, is quite large compared to the one or few threads employed by NuProcess.

What does the overhead look like with Java's new virtual threads? It should be significantly reduced, iiuc?

altrack commented 1 month ago

I'm super curious about this comparison, I found this blog post https://github.com/marcobehler/marcobehler-guides/blob/main/java-project-loom.adoc#filesystem-calls

To cut a long story short, your file access call inside the virtual thread, will actually be delegated to a (…​.drum roll…​.) good-old operating system thread, to give you the illusion of non-blocking file access.

There is also io_uring feature in new Linux kernels https://github.com/ikorennoy/jasyncfio

How these both compare to NuProcess?