-
Notifications
You must be signed in to change notification settings - Fork 7.6k
MQTT transmission time #7473
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
Before @SuGlider will start investigating this, can you share your 2 cents on this @david-cermak? Thank you in advance |
@savagerex - it may take some time to be investigated. |
@savagerex - Could you please provide a link to the MQTT libraries used in the sketch of this issue? Thanks. |
link as below |
i just stumbled here, maybe not a solution but i have some projects using mqtt without problems and i always used this library: maybe worth a try. |
@savagerex - I've researched about a similar issue with MQTT that I had seen in the past: Could you please try this new code for the setup() in your testing sketch? void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
delay(10);
// this must be called before WiFi.begin()
WiFi.useStaticBuffers(true); // <<=== This line may change WiFi performance...
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, pass);
Serial.print("Connecting.");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.print("WiFi connected - IP address: ");
Serial.println(WiFi.localIP());
client.begin(mqtt_server, net);
Serial.print("\nconnecting...");
while (!client.connect("arduino", "public", "public")) {
Serial.print(".");
delay(1000);
}
Serial.println("\nconnected!");
}
|
we face the same problem on esp32-s3-wroom-1 n8r8, we use the https://github.com/marvinroger/async-mqtt-client.git and we have aleady add the "WiFi.useStaticBuffers(true); WiFi.mode(WIFI_STA);" to receive the 156KB data from mqtt server, it uses about 2 seconds. |
I worked on the async MQTT library and created my own MQTT library but never experienced such a lag. Not saying the bug isn't there but I cannot believe at this point the fault lies within the library. In cases like this, Wireshark can be useful (dropped packets, retransmission...). In the given example, you try to send 75k data. with a TCP packet size of 1500 this is 50 packets. This takes some time on an ESP32. There's no point in comparing this mcu with a PC. |
when we use the esp-idf directly, we config the wifi parameters follow by https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/wifi.html#using-psram |
Now we use the esp32-arduino-lib-builder with following config modified(in file configs/defconfig.esp32s3)
and then re-generate the esp32-arduino static libs and replace the precompiled libs in "~/.platformio/packages/framework-arduinoespressif32/tools" At last, we can receive the 156KB data from mqtt server in 400ms in the same ENV in the arduino-esp32 project Only one question for us, we should run the board as long as possible to check it stability or not? |
Yes, this is a way to solve this same issue. When using
Which is smaller that the one you suggested with Lib Builder. Unfortunately, Arduino can't define its own WiFi low level configuration. Another way to move forward with its own WiFi setup, would be going with Arduino as IDF Component and changing the |
@savagerex - Let me know if using If not, I think that the way to solve it, would be by moving to Arduino as Component Project and then setting high performance WiFi in the sdkconfig as suggested above. |
Board
ESP32 S3
Device Description
ESP32-S3-DevKitc-1
Hardware Configuration
NONE
Version
v2.0.5
IDE Name
Arduino IDE
Operating System
Windows 10
Flash frequency
80Mhz
PSRAM enabled
yes
Upload speed
921600
Description
I use MQTT lib to transfer data ( '0').
it spend about 5 sec. this is too long.
i test on PC , it need 142ms.
why ESP32 need spend 5 sec???
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: