# MQTT nodes vs. in-flow processing

**URL:** <https://discourse.nodered.org/t/mqtt-nodes-vs-in-flow-processing/53193>\
**Category:** General\
**Created:** [3 November 2021 21:58 UTC](https://discourse.nodered.org/t/mqtt-nodes-vs-in-flow-processing/53193 "2021-11-03T21:58:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sineos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sineos/32/3440_2.png) [@Sineos](https://discourse.nodered.org/u/Sineos)\
**Post date:** [3 November 2021 21:58 UTC](https://discourse.nodered.org/t/mqtt-nodes-vs-in-flow-processing/53193/1 "2021-11-03T21:58:37Z")

</div>

I'm doing a lot of MQTT message processing (central broker instance) and I'm wondering, what the more efficient approach would be:

1. A lot of MQTT in / out nodes caring for very strict topics
2. Doing all topic filtering / setting in the flow and working with only a minimum of MQTT nodes

Does it make a difference in established connections to the broker or the efficiency in processing?  
Any insight is appreciated.

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [3 November 2021 22:38 UTC](https://discourse.nodered.org/t/mqtt-nodes-vs-in-flow-processing/53193/2 "2021-11-03T22:38:23Z")

</div>

The MQTT nodes are already doing topic filtering to deliver the right message to the MQTT-in node since the connection to the broker is shared by all the nodes that have the same broker config node.

So having MQTT-in nodes per topic is probably more efficient than wildcards and then filtering again.

---

<div class="post-metadata">

**Author:** ![Christian-Me](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian-me/32/10774_2.png) [@Christian-Me](https://discourse.nodered.org/u/Christian-Me)\
**Post date:** [3 November 2021 23:17 UTC](https://discourse.nodered.org/t/mqtt-nodes-vs-in-flow-processing/53193/3 "2021-11-03T23:17:19Z")

</div>

As @hardillb already wrote: By subscribing to topics limiting data you really need the broker only transmit relevant data. This preserves bandwidth. Using many mqtt-innodes only adds subscriptions on the broker.  
So a subscription to the root (#) or to data you only need a part of and have to discard later is not a good idea. The broker software like mosquito is written in C and in general faster than filtering inside node.js Node-Red.

---

<div class="post-metadata">

**Author:** ![Sineos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sineos/32/3440_2.png) [@Sineos](https://discourse.nodered.org/u/Sineos)\
**Post date:** [4 November 2021 15:39 UTC](https://discourse.nodered.org/t/mqtt-nodes-vs-in-flow-processing/53193/4 "2021-11-04T15:39:25Z")

</div>

Thanks this clarifies this topic and confirms my "gut feelings". Appreciated.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 November 2021 15:39 UTC](https://discourse.nodered.org/t/mqtt-nodes-vs-in-flow-processing/53193/5 "2021-11-18T15:39:25Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
