ethereum / lahja

Lahja is a generic multi process event bus implementation written in Python 3.6+ to enable lightweight inter-process communication, based on non-blocking asyncio
MIT License
394 stars 19 forks source link

The Trio endpoint serializes all messages through a single coro #162

Open lithp opened 4 years ago

lithp commented 4 years ago

In the trio endpoint all broadcast calls add to a queue, _outbound_send_channel, which is then processed by _process_outbound_messages. When _outbound_send_channel blocks it blocks all message sends. This could happen if message handler takes a long time to run, or if a remote process's queue fills up. The queue also makes our back-pressure situation more complicated. If a coro is sending messages which are expensive to handle it will slow down all message sends and the offending coro will be given no feedback. I think both situations could be solved by having the trio endpoint work in the same way as the asyncio endpoint works: immediately attempting to send messages when broadcast is called.