EpicEric / pony-mqtt

:horse: MQTT client in Pony
https://epiceric.github.io/pony-mqtt-docs/mqtt--index/
MIT License
6 stars 1 forks source link

Different actors for sending/receiving messages #13

Closed EpicEric closed 6 years ago

EpicEric commented 6 years ago

Currently, MQTTConnection is in charge of both receiving/parsing incoming messages and building/sending outgoing packets, and these two actions very rarely interact with one another.

Thanks to the actor model, all TCP communication is being performed by a single-thread, resulting in a loss of performance due to potential decoupling of these tasks.

We should use at least two actors -- one of which is invisible to the user --, so that we can send messages from the user and receive data from the broker simultaneously.

EpicEric commented 6 years ago

This is probably not a huge advantage in terms of performance, since new actors incur in GC and message queuing (source). Since there are already two actors in place (TCPConnection and MQTTConnection), perhaps it is not much of an impact to justify the extra development.

Marking as closed until a better reason for this appears.