-
Notifications
You must be signed in to change notification settings - Fork 341
Fix new scheduler loop #747
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
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.
Looks good!
// If another thread is already blocked on the reactor, there is no point in keeping | ||
// the current thread around since there is too little work to do. | ||
if sched.polling { | ||
thread::sleep(Duration::from_micros(10)); | ||
continue; | ||
break; | ||
} |
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'm not sure, terminating the thread is a good idea, what will happen when the load is increasing? no new thread will be created
simple sleep like this will end up with single thread with no way to recover the worker thread
task::spawn(async {
loop {
task::sleep(Duration::from_secs(1)).await;
io::stdout().write_all(b"Hello World\n").await.unwrap();
}
})
.await;
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.
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.
We can not go back to the sleep & continue, it regresses performance even further, so we need to find a better solution.
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.
The correct fix as far as I understand is to bring back the dynamic restarting of machines: #748
Even if we do not make use of the progress blocking, we do need to make use of the dynamic restarting of machines as far as I understand. Keeps the perf, while removing the regression from #747
This now matches more closely the logic as implemented in #631, and fixes the performance regression as far as I have observed.
Closes #746