Browse Source

Polish "Mention the Virtual Threads changes in Java 24"

See gh-46547
pull/46752/head
Stéphane Nicoll 5 months ago
parent
commit
f8c5f052b2
  1. 7
      spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/spring-application.adoc

7
spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/spring-application.adoc

@ -400,9 +400,12 @@ Spring Boot can also be configured to expose a xref:api:rest/actuator/startup.ad @@ -400,9 +400,12 @@ Spring Boot can also be configured to expose a xref:api:rest/actuator/startup.ad
[[features.spring-application.virtual-threads]]
== Virtual threads
If you're running on Java 21 or up, you can enable virtual threads by setting the property configprop:spring.threads.virtual.enabled[] to `true`.
Virtual threads require Java 21 or later.
For the best experience, Java 24 or later is strongly recommended.
To enable virtual threads, set the configprop:spring.threads.virtual.enabled[] property to `true`.
We recommend using Java 24 or later as Java 21 have a "Pinned Virtual Threads" issue that happens when entering a `synchronized` block or method; however, before turning on Virtual Threads option for your application, you should consider https://docs.oracle.com/en/java/javase/24/core/virtual-threads.html[reading the official Java virtual threads documentation] In case your code calls a native method or a foreign function inside Virtual Thread, applications can experience lower throughput because of "Pinned Virtual Threads"; this page also explains how to detect such cases with JDK Flight Recorder or the `jcmd` CLI.
Before turning on this option for your application, you should consider https://docs.oracle.com/en/java/javase/24/core/virtual-threads.html[reading the official Java virtual threads documentation].
In some cases, applications can experience lower throughput because of "Pinned Virtual Threads"; this page also explains how to detect such cases with JDK Flight Recorder or the `jcmd` CLI.
NOTE: If virtual threads are enabled, properties which configure thread pools don't have an effect anymore.
That's because virtual threads are scheduled on a JVM wide platform thread pool and not on dedicated thread pools.

Loading…
Cancel
Save