Return to site

Virtual threads BEST practices explained by a Java champion ☕🏆

· java,video

Kablu:

Very informative!! 
Could you please share your thought, when we enable virtual threads in spring boot, how it behave. When we have multiple API call i.e. IO blocking calls, does virtual threads mimic same behaviour as Victor Rentea ( Java

Vincent:

 

When enabling virtual threads in Spring Boot, they handle I/O blocking calls efficiently by suspending the virtual thread and freeing up the OS thread for other tasks. This increases concurrency and resource efficiency, making it ideal for handling multiple API calls (to enable, put in application.properties: "spring.threads.virtual.enabled=true")

See also:"Virtual threads significantly enhanced performance in inter-service blocking HTTP calls, yielding a 3x improvement in the current evaluation." https://medium.com/@sadanandshinde89/java-21-spring-boot-virtual-thread-performance-evaluations-6d859733c840