1

I´m currently working on a project where I have some clients (ESP32) which should communicate over MQTT with my broker. It should be also possible to change some parameters with an app. The easiest way would be to make an node.js server which gets the parameter from the app with an HTTP Post and then send the data parameters as mqtt client to the right ESP.

Is this the right approach for my project? Can one client even handle the traffic if there a 100 devices changing and requesting data from my broker at the same time? Or is there a more simplere solution?

E: Just do be sure you know what i want to do

enter image description here

1 Answer 1

1

There is nothing wrong with that approach.

The NodeJS app doesn't need to subscribe to the messages published by the ESP32 devices if it doesn't need the data, it can quite happily just publish settings change updates, either to a device specific topic or to a shared topic with a device ID in the payload.

The average broker will handle thousands of clients (dependent on message rate and size).

6
  • Hi, thanks for your answer. I´ve already heard that the broker can handle more than 1000 devices without any problems. But i´m not sure if the node.js server can handle so many connections a once. How would be your approach? Mar 27, 2020 at 6:18
  • Without knowing message rate and size this is impossible to answer. You are going to have to test it.
    – hardillb
    Mar 27, 2020 at 7:13
  • Message size would be max 2048 Bytes, the rate is not really important with mqtt, so i would say one message every minute.(can also be optimized) 1000 devices would be a good start. I know that testing would be the best way but its quit hard to test such things. Mar 27, 2020 at 7:45
  • Rate is very important, since nodejs is single threaded. But 2kb every minute is trivial even with 1000 clients assuming that they are evenly distributed across the minute. But you still need to test
    – hardillb
    Mar 27, 2020 at 7:49
  • 2
    Implementation without performance testing is wishful thinking. Mar 27, 2020 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.