You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support executor="processes" and the like to Worker #5319
Being able to specify the worker's executor(s) is a neat feature that's probably under-used in part because it's currently a somewhat cumbersome API: you need to create and pass in the executor instance(s) you want to use.
Another thing we should consider cleaning up when we do this is #693. The current memory_limit = MEMORY_LIMIT * min(1, nthreads / total_cores) behavior is built around the assumption that you're running dask-worker multiple times on the same machine to get multiple processes. If dask-worker --nprocs actually just made a ProcessPoolExecutor (debatable if that should actually be the behavior) on one worker, then we wouldn't need to leave room for others.
We should consider inter-process communication costs of using ProcessPoolExecutors though. This would make #4497 a lot more relevant. Since dask-worker --nprocs currently creates multiple complete worker processes, each with their own data, the scheduler essentially handles locality and prefers to run a task in the same process as its dependents (since each process is a separate worker).
Naively swapping ProcessPoolExecutor for ThreadPoolExecutor could lead to terrible performance, as data gets serialized back and forth between worker.data and every task. Worker architecture would need to change quite a bit, either having data be shared memory (maybe more straightforward, but still would probably involve tasks copying results), or having each process have its own process-local data store, some simple locality-based task scheduling on the Worker itself, and logic for moving data between processes (and workers) as necessary.
I suspect that most folks who want a process pool are dealing with
applications that are compute heavy rather than data heavy. That's just a
guess though, and certainly not universal.
Activity
gjoseph92 commentedon Nov 30, 2021
Another thing we should consider cleaning up when we do this is #693. The current
memory_limit = MEMORY_LIMIT * min(1, nthreads / total_cores)behavior is built around the assumption that you're runningdask-workermultiple times on the same machine to get multiple processes. Ifdask-worker --nprocsactually just made a ProcessPoolExecutor (debatable if that should actually be the behavior) on one worker, then we wouldn't need to leave room for others.gjoseph92 commentedon Dec 17, 2021
We should consider inter-process communication costs of using ProcessPoolExecutors though. This would make #4497 a lot more relevant. Since
dask-worker --nprocscurrently creates multiple complete worker processes, each with their owndata, the scheduler essentially handles locality and prefers to run a task in the same process as its dependents (since each process is a separate worker).Naively swapping ProcessPoolExecutor for ThreadPoolExecutor could lead to terrible performance, as data gets serialized back and forth between
worker.dataand every task. Worker architecture would need to change quite a bit, either havingdatabe shared memory (maybe more straightforward, but still would probably involve tasks copying results), or having each process have its own process-local data store, some simple locality-based task scheduling on the Worker itself, and logic for moving data between processes (and workers) as necessary.mrocklin commentedon Dec 17, 2021