logoalt Hacker News

lgrapenthintoday at 2:14 AM2 repliesview on HN

"As a rule of thumb, if your application never has 10,000 virtual threads or more, it is unlikely to benefit from virtual threads."

https://docs.oracle.com/en/java/javase/21/core/virtual-threa...


Replies

whaleofatw2022today at 3:24 AM

BEAM threads are kinda magicsauce tho, instructions have a cost and after a certain cost total (quantums) the scheduler can divert to another virt thread to guarantee forward progress. Also the immutability rules etc make it easier to optimize this switching.

show 1 reply
pdimitartoday at 2:16 AM

Obviously. But it's really nice to have the option, and none of us knows the future. I've been bitten by those "0.1% chance" things much more times than I would be not-embarrassed to admit, and I know I a not alone.

show 1 reply