-
Notifications
You must be signed in to change notification settings - Fork 7.6k
MQTT poor performance #6543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello @FStefanni, are you able to test this on v2.0.3-RC1 as well? Thanks |
Hi, I can, if someone tells me how to do it: it is not available in arduino ide for install. Regards. |
Take a look here: https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html You need to change your link in Preferences in Arduino IDE to development release link. |
Hi, thank you for the hints. NOTE: something strange happens during compiling with 2.0.3-RC1: the first compilation fails, but the second succeeds... maybe something to be adjusted into my project? Nevertheless, as the second consecutive compiling goes fine, I used that to do the check. Regards |
I suggest to turn on debug output using |
Same here #6664 |
Please refer to these two commentaries: |
Hi, regarding issue #6664, I believe in my case it is something different, since it was polling the WiFi status which was degrading the WiFi performance (please refer to the workaround section of this issue). To fix (or understand) my issue, we should look the implementation of the involved methods... and this requires someone who knows that code -- but unfortunately it is not me. Regards |
Without code it's harder to understand what you are doing. Did you tried the event for the wifi status? For the MQTT I did already managed to send fast messages to the Hive broker (not tested from the broker). However this was in SDK 1.0.6, using pubsubclient-master.h. And the message size was not longer than 40bytes. |
Can you please provide more information. What is the topology? Which server? Is there any simple sketch that we can test and see the issue happening?
Ping is something relative to all the elements in the network as well as the current traffic at the time ping is executed. |
Hi,
Not tested (I'll check in the next days if I have time), but I believe you can take any MQTT simple sketch, void wifiLoop()
{
WiFi.RSSI();
WiFi.localIP();
WiFi.SSID();
WiFi.getMode();
} I have seen performance issues also with the I2C (#6553), -- my sketch in the Regards |
Hi, as a small update: I have tested with 2.0.3 and the issue is still there:
Regards. |
Changing the title as it's about MQTT and not Wifi. |
Few days ago, I posted this question in Arduino stackExchange- still now anwer. I'll be happy to help and get help Problem description: Every ~20+ published messages (using terminal), MCU receives that message in a very noticeable delay (mostly ~10 sec, few time it got up to 1 min). Upon receive (printed in Serial monitor), MCU is working as expected. Hardware: ESP32 DEVKIT MCU, Important remark: Code is same for ESP8266 and ESP32.This behavior happens only on ESP32. Question: Does ESP32 has a know issue regarding receiving MQTT messages? is there a workaround? or perhaps- bug in code? What did I do to try isolating the problem:
OUTPUT1- sending "0" and "1" almost simultaneously, almost 15 sec delay
OUTPUT-2: Code
|
2 thoughts:
|
What TD-er says is absolutly right. You also might use the WiFi event to check your internet connection on your ESP and ad some actions in sertain case's. For the MQTT I would do a time check so it doesn't keep hanging in the loop infinitely if it can not connect. |
Appreciate your answers! Putting |
To add a bit of suggestions....
|
@SuGlider |
Not sure... I think it really needs investigation. |
There is a change I've made to WiFi configuration that will be available for Arduino Core 2.0.5. |
@guydvir2 - |
Hello, I close this since this report contains the release we no longer support. Please try the new versions and in case the issue persists, feel free to reopen it. Thanks |
Board
esp32 dev module
Device Description
esp32 devkit c v4
Hardware Configuration
Version
v2.0.2
IDE Name
VS Code + arduino-cli
Operating System
Linux Debian Testing
Flash frequency
default
PSRAM enabled
no
Upload speed
default
Description
Hi,
I try to summarize in the following.
The program
The issue
The reply to the MQTT message can be very slow, till 11 seconds.
Also, the response to a simple network ping is sometimes very slow (more than 1 second).
The workaround
I have found that the calling of the WiFi methods to retrieve the information to display are the origin of the slowdown.
So, if I avoid to call them when I display the page (i.e. I read them only once during the
setup()
and then I show the "preloaded" values), everything works fine (immediate MQTT reply, ping avg near to 300ms).The methods are:
WiFi.RSSI()
WiFi.localIP()
WiFi.SSID()
WiFi.getMode()
WiFi.softAPSSID()
WiFi.softAPIP()
I have seen that the Arduino ESP32 is not a plain wrapper to ESP-IDF methods, but it also adds some logic, so I do not know whether the issue is in the Arduino layer or the ESP-IDF methods.
FYI, also the Arduino ESP32 version 2.0.0 has the same issue, and the same workaround works as well.
Regards.
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: