-
Notifications
You must be signed in to change notification settings - Fork 833
Refactor poller tracking from tasklist to poller package #6777
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
service/matching/poller/manager.go
Outdated
StartPoll(pollerID string, cancelFunc context.CancelFunc, info *Info) | ||
EndPoll(pollerID string) | ||
CancelPoll(pollerID string) bool | ||
HasGroupAfter(isolationGroup string, earliest time.Time) bool |
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.
HasPollerFromIsolationGroupAfter
is a better name
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.
Done
service/matching/poller/manager.go
Outdated
EndPoll(pollerID string) | ||
CancelPoll(pollerID string) bool | ||
HasGroupAfter(isolationGroup string, earliest time.Time) bool | ||
HasAnyAfter(after time.Time) bool |
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.
HasPollerAfter
is a better name, I think
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.
Done
Address a longstanding TODO, moving outstanding poller tracking to the poller package. This simplifies task_list_manager and consolidates outstanding poller tracking with the poller history. Improve the calculation of whether there are recent pollers for a given isolation group. Currently we calculate the number of pollers for every isolation group and then check whether the value for a given isolation group is greater than zero. This requires iterating through the entire recent pollers cache. Given it has a maximum size of 5000, this isn't a great thing to do for every single task we dispatch. Instead we can store the number of outstanding pollers by group and the last time a poll for the group ended, making it a consistently quick check. Additionally optimize HasAnyAfter to use a similar mechanism, although the frequency at which that is used makes that less important. Fix the double counting of getRecentPollersByIsolationGroup by tracking in the poller history whether a poller is outstanding. Currently we iterate through the poller history then through the outstanding pollers, but if a poller began its poll within the TaskIsolationPollerWindow it gets counted twice. The accuracy of this function isn't particularly important, but we should err on the side of correctness.
Address a longstanding TODO, moving outstanding poller tracking to the poller package. This simplifies task_list_manager and consolidates outstanding poller tracking with the poller history.
Improve the calculation of whether there are recent pollers for a given isolation group. Currently we calculate the number of pollers for every isolation group and then check whether the value for a given isolation group is greater than zero. This requires iterating through the entire recent pollers cache. Given it has a maximum size of 5000, this isn't a great thing to do for every single task we dispatch. Instead we can store the number of outstanding pollers by group and the last time a poll for the group ended, making it a consistently quick check.
Additionally optimize HasAnyAfter to use a similar mechanism, although the frequency at which that is used makes that less important.
Fix the double counting of getRecentPollersByIsolationGroup by tracking in the poller history whether a poller is outstanding. Currently we iterate through the poller history then through the outstanding pollers, but if a poller began its poll within the TaskIsolationPollerWindow it gets counted twice. The accuracy of this function isn't particularly important, but we should err on the side of correctness.
What changed?
Why?
How did you test it?
Potential risks
Release notes
Documentation Changes