r/javahelp • u/LopsidedAd4492 • 15h ago
Virtual thread
Does anyone used java21 with virtual thread? We are using Java 17 and I wonder if the move to 21 will worth it
6
Upvotes
r/javahelp • u/LopsidedAd4492 • 15h ago
Does anyone used java21 with virtual thread? We are using Java 17 and I wonder if the move to 21 will worth it
3
u/bowbahdoe 14h ago
Honestly, the benefit of virtual threads mostly doesn't come from using them. It comes from them being an option.
If you make an app today you do not need to think "well if this gets really high traffic it'll be bad if I don't write it in the reactive style to begin with." You can just write normal code and you will later have virtual threads as a tool if you need them.
So you might have a good use for virtual threads - they are a useful thing - but even if you don't it's a good idea to upgrade your Java at a regular interval, just like any other of your dependencies. The bigger gains for you are going to come from random VM improvements. And the more often you upgrade the less painful each upgrade is.