Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust transfer costs in worker_objective #5326

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
12 changes: 8 additions & 4 deletions distributed/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2687,7 +2687,8 @@ def get_comm_cost(self, ts: TaskState, ws: WorkerState) -> float:
nbytes: int = 0
for dts in deps:
nbytes += dts.nbytes
return nbytes / self.bandwidth
# Add a fixed 10ms penalty per transfer. See distributed#5324
return nbytes / self._bandwidth + 0.01 * len(deps)
crusaderky marked this conversation as resolved.
Show resolved Hide resolved

def get_task_duration(self, ts: TaskState) -> float:
"""Get the estimated computation cost of the given task (not including
Expand Down Expand Up @@ -2799,13 +2800,16 @@ def worker_objective(self, ts: TaskState, ws: WorkerState) -> tuple:
"""
dts: TaskState
comm_bytes: int = 0
xfers: int = 0
crusaderky marked this conversation as resolved.
Show resolved Hide resolved
for dts in ts.dependencies:
if ws not in dts.who_has:
nbytes = dts.get_nbytes()
comm_bytes += nbytes
# amortize transfer cost over all waiters
comm_bytes += nbytes / len(dts.waiters)
xfers += 1
Comment on lines +2807 to +2809
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# amortize transfer cost over all waiters
comm_bytes += nbytes / len(dts.waiters)
xfers += 1
nwaiters = len(dts.waiters)
# amortize transfer cost over all waiters
comm_bytes += nbytes / nwaiters
xfers += 1 / nwaiters

@gjoseph92 do you agree?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However this would not be replicable in get_comm_cost above


stack_time: float = ws.occupancy / ws.nthreads
start_time: float = stack_time + comm_bytes / self.bandwidth
stack_time: double = ws.occupancy / ws.nthreads
start_time: double = stack_time + comm_bytes / self.bandwidth + xfers * 0.01
crusaderky marked this conversation as resolved.
Show resolved Hide resolved

if ts.actor:
return (len(ws.actors), start_time, ws.nbytes)
Expand Down