[DNM] Don't queue tasks on workers #6584
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this change, workers are not sent more tasks than they have threads. This eliminates root task overproduction and removes the need for work stealing.
I didn't originally intend to make this change (originally, I wanted to remove queuing of root tasks only, not all tasks). I just discovered that it was the natural outcome of #6560 without co-assignment. I thought that was interesting, so I'm opening this for discussion.
This is the minimal diff to enact this change. There is lots we would change/rip out if we went forward with this. The purpose of this PR is just to try the change on some common workloads and see how performance is affected.
Performance will likely be poor on some workloads without speculative task assignment and root task co-assignment.
I believe there's a relatively simple optimization we could make here that would bring performance about in line with current scheduling (minus co-assignment): do allow queuing extra tasks onto workers when those tasks meet specific criteria. The criteria would match the fan-out style tasks you see in a task-based shuffle,
rechunk
, ormap_overlap
. But that's an optimization to play with later.Why?
I was working on the "ignore root task co-assignment" side of withholding root tasks #6560. Initially I was going to try withholding just root tasks.
ws.nthreads
tasks per worker. All other tasks would end up assigned via the normal logic. So I just removed the co-assign code for simplicity. Now root tasks aren't special anymore.decide_worker
, but if that worker is full, put the task inno-worker
instead". But that raises an obvious question: what if there was a different, not-full worker available we could have picked instead?decide_worker
.decide_worker
to only theidle
workers set, you get this PR.See the test added for an example of an embarrassingly-parallel workload that's currently unrunnable on main (workers repeatedly run out of memory and die), which runs smoothly in a constant amount of memory with this PR.
pre-commit run --all-files