We currently support handlers that are either synchronous or asynchronous
|
handler = self.stream_handlers[op] |
|
if is_coroutine_function(handler): |
|
self.loop.add_callback(handler, **merge(extra, msg)) |
|
await gen.sleep(0) |
|
else: |
|
handler(**merge(extra, msg)) |
In #4443 we learned that these checks take up some time. In a recent run it takes 100ms out of about a 2.5s run, so around 4%
There are a couple of ways to address this:
- We can try to find some other cheaper check
- We can make all of our handlers
async def functions and asyncify the entire codebase (we should also check that this doesn't incur other costs if so)
cc @dask/scheduler-performance
We currently support handlers that are either synchronous or asynchronous
distributed/distributed/core.py
Lines 567 to 572 in 1297b18
In #4443 we learned that these checks take up some time. In a recent run it takes 100ms out of about a 2.5s run, so around 4%
There are a couple of ways to address this:
async deffunctions and asyncify the entire codebase (we should also check that this doesn't incur other costs if so)cc @dask/scheduler-performance