[Question] Scaling while listening to a mqtt topic
Closed this issue · 1 comments
Hi, thanks a lot for this project and helping people bootstrapping an HA Node-Red instance. I have a question in mind: My idea is to subscribe with node-Red over mqtt to several thing shadows (aws iot digital twin). How is a load balancing possible when using a pub/sub connection protocol like mqtt as a trigger?
Thanks for your feedback,
Patrick
Hey. So if you're using MQTT each instance will act independently so unless you share state on the EFS or via some other means (eg Redis cache) you will need to be able to function in a stateless way. Often this is no issue as each invocation of your flow is independent from any other, so you just need to figure out what makes sense for your use case. The flows on each instance will still do things like make connections to the MQTT topics they care about, you just won't necessarily be able to predict which one will process the messages that appear. QoS comes into it as well, because if you have QoS 1 and at least once delivery you may have the same message processed on multiple instances.
Does that help?