Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add doc about virtual thread executor. #1737

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/src/main/paradox/typed/dispatchers.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,15 @@ it in `application.conf` and instantiate through an

## More dispatcher configuration examples

### Virtual Threads

Configuring a dispatcher with virtual threads, requires Java 21 or above:

@@snip [DispatcherDocSpec.scala](/docs/src/test/scala/docs/dispatcher/DispatcherDocSpec.scala) { #virtual-thread-dispatcher-config }

With this, an actor will run in a virtual thread, so you may want to configure it further with :
`jdk.virtualThreadScheduler.parallelism` ,`jdk.virtualThreadScheduler.maxPoolSize` and `jdk.unparker.maxPoolSize`.

### Fixed pool size

Configuring a dispatcher with fixed thread pool size, e.g. for actors that perform blocking IO:
Expand Down
8 changes: 7 additions & 1 deletion docs/src/test/scala/docs/dispatcher/DispatcherDocSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ object DispatcherDocSpec {
# Set to 1 for as fair as possible.
throughput = 100
}
//#affinity-pool-dispatcher-config
//#affinity-pool-dispatcher-config

//#virtual-thread-dispatcher-config
virtual-thread-dispatcher {
executor = virtual-thread-executor
}
//#virtual-thread-dispatcher-config

//#fixed-pool-size-dispatcher-config
blocking-io-dispatcher {
Expand Down
Loading