Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The thing with event loops in python is that they are not a single, all-governing scheduler (as e.g. in the BEAM).

ev loops instead are a mid-layer concept that sits below other infrastructure such as threads and processes. And (perhaps somewhat frustratingly) it is not too uncommon to have multiple ev loops in parallel. See for example the proxy.py project, which offers to run one async loop per process for a speedup.

As a result, there are some incentives to swap out the loop itself, e.g. for faster implementations like uvloop, because they are somewhat pluggable anyways.



Good design dictates that you start one loop and build the whole program around it, no? The docs for asyncio.run say as much.


Yes, that is good design and the event loop should basically be shared process-wide (asyncio objects are usually not thread safe and cannot be shared across event loops). Temporal only does custom event loops in isolated workflows.


> all-governing scheduler (as e.g. in the BEAM).

Does this also mean they have preemptive multitasking like in BEAM?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: