| >Also, my belief is that JVM itself adds lots of overhead. The JVM has ~nothing to do with the scheduling of platform threads >and there any benchmarks saying it is couple hundred threads, and not 100k threads?.. It depends greatly on your hardware >couple hundred is about thread per core on modern CPUs.. It depends on the hardware, of course Overall, yes, you could probably run a lot of concurrent processes on a c7i.48xlarge in 2023. But why would you want to do that when, if you used virtual threads (or async), you could do the same work on an c7i.large? That's the whole point of this. There's no reason to waste CPU and memory on kernel context switching overhead. |
I didn't say it schedules platform threads, but JVM has many other performance issues with its GC/object identity/lock monitoring model, which makes it harder choice for ultra-high performance apps, so virtual thread scheduling may improve your app perf by 5%, where other 95% stuck in other bottlenecks
> But why would you want to do that when, if you used virtual threads
because virtual threads are not supported in ecosystem well, and it will take another 10 years for it to catch up, before that most API/libs will use old concepts and you take large risks of fragmentation by introducing virtual threads to your app.
Also, you can avoid all switching with 20 years old ExecutorService, where you have exactly the same m:n mapping between tasks and machine threads.