What about a mini MQTT broker on the ESP32?

Place your projects here
User avatar
cicciocb
Site Admin
Posts: 2784
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: What about a mini MQTT broker on the ESP32?

Post by cicciocb »

Any news to report?
How the tests proceed?
Monki
Posts: 79
Joined: Mon Feb 27, 2023 12:56 pm
Location: Berlin
Has thanked: 29 times
Been thanked: 18 times

Re: What about a mini MQTT broker on the ESP32?

Post by Monki »

Hello Francesco,
I tested the broker today in parallel with ESP Now > works perfectly.
After that I tested it with 13 Shellys, the program stops after a few minutes without an error message, but it could also be due to a lack of memory, when the program then stops there is only about 20k RAM free. Unfortunately I can only test it on the standard ESP (Atom Lite).
User avatar
cicciocb
Site Admin
Posts: 2784
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: What about a mini MQTT broker on the ESP32?

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Oct 22, 2024 9:16 pm Hello Francesco,
I tested the broker today in parallel with ESP Now > works perfectly.
After that I tested it with 13 Shellys, the program stops after a few minutes without an error message, but it could also be due to a lack of memory, when the program then stops there is only about 20k RAM free. Unfortunately I can only test it on the standard ESP (Atom Lite).
Yes 13 seems too much, considering that the PSRAM is probably required for that purpose.
Anyway, it is a good news that it can fit very little projects with less than 10 devices in MQTT, considering that many can be simply connected using ESP-NOW and routed through the MQTT server via a client module or on the server module itself.

For sure this will not replace a real mosquitto server on a Raspberry Pi with few GB of RAM but it can find its place for a little local network at very low cost and very little power requirement.
Monki
Posts: 79
Joined: Mon Feb 27, 2023 12:56 pm
Location: Berlin
Has thanked: 29 times
Been thanked: 18 times

Re: What about a mini MQTT broker on the ESP32?

Post by Monki »

I reduced the ESPNOW / MQTT Broker combination to 11 MQTT clients this morning and it has been running error-free for 3.5 hours now. I would like to test it on an S3 with more RAM.
User avatar
cicciocb
Site Admin
Posts: 2784
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: What about a mini MQTT broker on the ESP32?

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Wed Oct 23, 2024 8:54 am I reduced the ESPNOW / MQTT Broker combination to 11 MQTT clients this morning and it has been running error-free for 3.5 hours now. I would like to test it on an S3 with more RAM.
Thanks Monki for your testing.
I did some updates on the version that you have, in particular for reporting purposes now the lists of the clients, the subsciptions of the server and all the subscriptions of the clients are available as string result.
Additionally I implemented the last will and improved the connection process when a client disconnect and reconnect again (in the actual implementation the client must wait for the "keep alive time" before being authorized for a new connection).

Probably it worth to publish a general release so that other users can test it and see if there are regressions somewhere.
Monki
Posts: 79
Joined: Mon Feb 27, 2023 12:56 pm
Location: Berlin
Has thanked: 29 times
Been thanked: 18 times

Re: What about a mini MQTT broker on the ESP32?

Post by Monki »

That sounds good,
then I could test how many clients it can support on boards with more RAM like the Atom S3 Lite (qspi connection) and the standard S3
test it out.
Helmut_number_one
Posts: 163
Joined: Fri Dec 09, 2022 10:03 am
Location: Flensburg Deutschland
Has thanked: 114 times
Been thanked: 25 times

Re: What about a mini MQTT broker on the ESP32?

Post by Helmut_number_one »

Please let us know when the version goes online.
User avatar
cicciocb
Site Admin
Posts: 2784
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: What about a mini MQTT broker on the ESP32?

Post by cicciocb »

I'm currently testing with many devices, I confirm that the limit is at 12 devices + the broker.

My "test bench" is composed of 9 tasmota / openbeken modules + 3 ESP32 acting as clients.
The mqtt broker is an ESP32-S3 with PSRAM.

This means 13 MQTT devices (as the broker can also act as a client ) at the same time.

I think is not bad, in particular for a typical home installation

Seems stable so far, I'm forcing an exchange sending a message each 500msec to the modules, stimulating answers and catching them into the ESP32 clients.

The goal now is to run it for at least 24h and see if there are memory leaks.

Wait and see ...
User avatar
cicciocb
Site Admin
Posts: 2784
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: What about a mini MQTT broker on the ESP32?

Post by cicciocb »

Still running without issues since 12H ....
peridot
Posts: 56
Joined: Mon Mar 08, 2021 4:54 am
Has thanked: 9 times
Been thanked: 106 times

Re: What about a mini MQTT broker on the ESP32?

Post by peridot »

I have the new MQTT Broker now replace the external ESP32 broker I was running on my project listed previously in this thread. All seems to be running smoothly , I did have a memory leak initially but it was due to my code (I was not aware of) so I will have to address than. Memory seems stable at around 130K (ESP32-S3).
I am receiving data from approx 30 sensors via UDP in json strings, over 7 topics, I am also monitoring ramfree in another topic so I can graph it.
I have 3 clients the broker, MQTT Explorer and IOT Panel which is fantastic for making quick Display's.
This usage is leaving a reasonable number of Clients and topics available where a dedicated connection is needed.
2024-10-28 19_46_56-What about a mini MQTT broker on the ESP32_ - Page 3 - Annex RDS forum — Mozilla.png
2024-10-28 20_19_02-Iot Panel - Google Drive — Mozilla Firefox.png
You do not have the required permissions to view the files attached to this post.
Post Reply