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
rt: initial implementation of new threaded runtime #5823
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This patch includes an initial implementation of a new multi-threaded runtime. The new runtime aims to increase the scheduler throughput by speeding up how it dispatches work to peer worker threads. This implementation improves most benchmarks by about ~10% when the number of threads is below 16. As threads increase, mutex contention deteriorates performance. Because the new scheduler is not yet ready to replace the old one, the patch introduces it as an unstable runtime flavor with a warning that it isn't production ready. Work to improve the scalability of the runtime will most likely require more intrusive changes across Tokio, so I am opting to merge with master to avoid larger conflicts.
carllerche
added
A-tokio
Area: The main tokio crate
M-runtime
Module: tokio/runtime
T-performance
Topic: performance and benchmarks
labels
Jun 26, 2023
carllerche
commented
Jun 26, 2023
Can you detail the "speeding up how it dispatches work to peer worker threads. " compared with original impl of threaded runtime? |
@inevity I plan to write about it in detail later. However, I don't expect the implementation currently in the PR to stay as is. |
carllerche
added
R-loom-multi-thread
Run loom multi-thread tests on this PR
R-loom-multi-thread-alt
Run loom multi-thread alt tests on this PR
labels
Jun 29, 2023
Darksonn
approved these changes
Jul 19, 2023
Finally green! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-tokio
Area: The main tokio crate
M-runtime
Module: tokio/runtime
R-loom
Run loom tests on this PR
R-loom-multi-thread
Run loom multi-thread tests on this PR
R-loom-multi-thread-alt
Run loom multi-thread alt tests on this PR
T-performance
Topic: performance and benchmarks
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch includes an initial implementation of a new multi-threaded runtime. The new runtime aims to increase the scheduler throughput by speeding up how it dispatches work to peer worker threads. This implementation improves most benchmarks by about ~10% when the number of threads is below 16. As threads increase, mutex contention deteriorates performance.
Because the new scheduler is not yet ready to replace the old one, the patch introduces it as an unstable runtime flavor, warning it isn't production ready. Work to improve the scalability of the runtime will most likely require more intrusive changes across Tokio, so I am opting to merge with master to avoid more significant conflicts. I don't intend ever to stabilize a new runtime flavor. Instead, once the new scheduler is ready, it will replace the current one.
As an example of benchmarks, here is Hyper hello world: https://gist.github.com/carllerche/7ac6924ad3ab1bb8e1a289fd96043636
I'm not sure if duplicating tests, including loom tests, is the best strategy here.