Reuse Comm objects in Scheduler.broadcast #9083
Merged
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.
This updates Scheduler.broadcast to reuse (i.e. not close) the Comm object that sends the message to the worker. This is motivated by the UCX comms, which are relatively expensive to create and destroy. We noticed that a simple
client.run(which usesScheduler.broadcastinternally) took ~100s of ms to complete with UCX, most of which was spent creating and destroying Comm objects. With this change, subsequentclient.runcalls take <10ms.I've provided a new config option
distributed.scheduler.reuse-broadcast-commfor users who want the previous behavior. But based on https://github.com/dask/distributed/pull/3766/files, folks agreed that this was a better default behavior. That change didn't quite get the desired behavior because of theclose=Truepassed tosend_recv.