-
Notifications
You must be signed in to change notification settings - Fork 186
feat: Enhance virtual thread support #1724
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
Conversation
actor/src/main/scala/org/apache/pekko/dispatch/VirtualThreadSupport.scala
Outdated
Show resolved
Hide resolved
| # When set to `on` but underlying runtime does not support virtual threads, an Exception will throw. | ||
| # Virtualize this dispatcher as a virtual-thread-executor | ||
| # Valid values are: `on`, `off` | ||
| virtualize = off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
behind an option
actor/src/main/scala/org/apache/pekko/dispatch/VirtualThreadSupportReflect.scala
Outdated
Show resolved
Hide resolved
262b627 to
fc2f4d7
Compare
actor/src/main/scala/org/apache/pekko/dispatch/VirtualThreadSupportReflect.scala
Outdated
Show resolved
Hide resolved
|
|
pjfanning
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be written using MethodHandles. #1724 (comment)
This comment was marked as outdated.
This comment was marked as outdated.
75bc885 to
c5fa25a
Compare
Roiocam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no objections to this.
...ests/src/test/scala-jdk21-only/org/apache/pekko/dispatch/ForkJoinPoolVirtualThreadSpec.scala
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| class ForkJoinExecutorServiceFactory( | ||
| val id: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used in createExecutorServiceFactory, some lines below.
|
@Roiocam I have addressed your feedback |
nvollmar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
pjfanning
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
Thanks for review. |
|
@He-Pin do you happen to have any performance comparison between enable virtual threads or not? |
|
It only help when you are working with some blocking.... |
|
got it, thanks! |
Motivation:
Enhances the current virtual thread support which can switch the virtual threads' scheduler.
Modification:
Use the method handle to change the scheduler of virtual threads.
CarrierThreadResult:
Virtualization with virtual threads supported.
We have a user case at $Work, where we are pulling data from a blocking API, With this, I think we can then decrease the Threads number.
based on #1734