Skip to content

Adaptive target duration is scaled by threads_per worker #2709

Description

@willirath

Adaptive Clusters with threads_per_worker > 1 will scale to reach a duration target_duration / threads_per_worker:

from dask.distributed import LocalCluster, Client, Adaptive
from dask import bag as db
from time import time, sleep

cluster = LocalCluster(n_workers=1, threads_per_worker=2, memory_limit=1e9)
ca = cluster.adapt(minimum=1, maximum=10, target_duration="20s", scale_factor=1)

client = Client(cluster)

start = time()
db.from_sequence((0.5 for n in range(100)), npartitions=100).map(sleep).compute()
print(time() - start, "seconds with", len(cluster.workers), "workers")
9.84409236907959 seconds with 3 workers

(Note that I set scale_factor=1 to prevent anything but the target duration from scaling up the cluster.)

With single-threaded workers, we get what we desired (approx. 20s):

[...]
cluster = LocalCluster(n_workers=1, threads_per_worker=1, memory_limit=1e9)
ca = cluster.adapt(minimum=1, maximum=10, target_duration="20s", scale_factor=1)
[...]
18.264188766479492 seconds with 3 workers
  • Should this be documented?
  • Or should behaviour of Adaptive be corrected to include the number of threads per worker in the estimate of the expected target duration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    adaptiveAll things relating to adaptive scaling

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions