-
Notifications
You must be signed in to change notification settings - Fork 831
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
Fixed size ThreadPool scheduler #20808
Conversation
f9a3e4e
to
35d0162
Compare
35d0162
to
d2994c5
Compare
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.
Soo much simpler 😍
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
…readPoolScheduler
The longer name exceeded the limit so setting the thread name failed.
|
||
// queue fill grad tracking is currently not implemented for this scheduler | ||
double ThreadPoolScheduler::approximateQueueFillGrade() const { return 0; } | ||
double ThreadPoolScheduler::unavailabilityQueueFillGrade() const { return 0; } |
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.
Note that the queue fill grade may be checked by a load balancer periodically to determine if the instance is still in good shape.
Consider this calling code, which determines the instance's availability for further requests, from a load balancer's perspective:
// if the scheduler's queue is more than x% full, render
// the server unavailable
double unavailabilityFillGrade =
scheduler->unavailabilityQueueFillGrade();
if (unavailabilityFillGrade > 0.0) {
double fillGrade = scheduler->approximateQueueFillGrade();
if (fillGrade >= unavailabilityFillGrade) {
// oops, queue is relatively full
available = false;
}
}
While this code works if the unavailability fill grade is 0, it will lead to more requests being sent to the instance now even if the queue is relatively full.
If this is an intentional change, fine. If not, is it much work to implement the fill grade methods in the new scheduler, or is there a reason why we shouldn't do this?
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.
These are functions defined in the Scheduler interface, but currently only make sense for the SupervisedScheduler (leaky abstraction). We will have to discuss if/how to add this to the new scheduler.
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
Scope & Purpose
This PR implements a new
ThreadPoolScheduler
with a fixed number of threads, and a number of different thread pools. TheThreadPoolScheduler
creates a separate thread pool for each priority lane.We have the following thread pools:
This PR also implements a number of synthetic benchmarks as tests (by default these are disabled so that they do not run durng regular builds). These benchmarks showed, that the WorkStealingThreadPool scales significantly better than the other two thread pools, and also much better then the current SupervisedScheduler.