-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only poll backend state once per scheduled jobs loop rather than per …
…job (#23747) Previously we'd check the backend state model once per running scheduled job. This allowed us to stop scheduled jobs a bit faster if the backend was stopped during the loop. However it also introduced a per running job check to the loop. If we have 19 jobs running and can schedule one more, we'd parse the backend job state doc 20 times to schedule one new job. Not a big deal with lower concurrency limits. As we're playing with increasing concurrency limits higher to 100 or even 1000, this repetitive parsing becomes non-trivial because of the N^2 nature of the scheduled jobs loop. To fix this I've given up on cancelling scheduled jobs during the loop. It should be a matter of milliseconds anyway, so the behavior shouldn't be noticeably different for users. I've also pulled out the inner loop to make this a little easier to tweak. GitOrigin-RevId: 420c36d65ed5f00752a742260de16ac1ac8ebb18
- Loading branch information
Showing
1 changed file
with
75 additions
and
60 deletions.
There are no files selected for viewing
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