dask distributed 是否使用 Tornado 协程来处理工人任务?

Does dask distributed use Tornado coroutines for workers tasks?

我刚读到distributed documentation

Worker and Scheduler nodes operate concurrently. They serve several overlapping requests and perform several overlapping computations at the same time without blocking.

我一直认为单线程并发编程最适合 I/O 昂贵的,而不是 CPU 绑定的工作。然而,我预计许多 dask 任务(例如 dask.pandasdask.array)是 CPU 密集的。

分布式是否仅使用 Tornado 进行 client/server 通信,使用单独的 processes/threads 到 运行 dask 任务?实际上 dask-worker--nprocs--nthreads 参数,所以我希望是这种情况。

Tornado 协程的并发性和更常见的 processes/threads 处理每个 dask 任务如何在分布式中共存?

你是对的。

每个 distributed.Worker object contains a concurrent.futures.ThreadPoolExecutor 有多个线程。此 ThreadPoolExecutor 上的任务是 运行 以实现并行性能。所有通信和协调任务都由 Tornado IOLoop 管理。

通常,此解决方案允许计算与通信和管理分开进行。这允许在 worker 内进行并行计算,并允许 worker 在计算任务时响应服务器请求。

命令行选项

当您进行以下调用时:

dask-worker --nprocs N --nthreads T

它在单独的 Python 进程中启动 N 单独的 distributed.Worker 对象。这些工作人员中的每一个都有一个带有 T 个线程的 ThreadPoolExecutor。