Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When loading a state that contained large numbers of nodes and tasks, but no ready nodes that could accept the tasks, swarmd used large amounts of CPU repeatedly trying to schedule the full set of tasks. The allocator caused many commits on startup (see moby#1286), and this produced a large backlog of commit events, each one of which caused a full scheduling pass. To avoid this pathological behavior, debounce the commit events similarly to how the dispatcher's Tasks loop debounces events. When a commit event is received, that starts a 50 ms countdown to wait for another commit event before running the scheduling pass. If commit events keep being received and resetting this timer, the scheduler will run the scheduling pass anyway after a second. Signed-off-by: Aaron Lehmann <[email protected]>
- Loading branch information