Socket slow if data size is above a certain limit #14748
Replies: 3 comments 3 replies
-
Since you read in the loop, the slow-down can as well be caused by the receiver. I have a small script used for testing which just sends. And that one does not slow down with larger data sizes. |
Beta Was this translation helpful? Give feedback.
-
I've further simplified the program (...just sockets with no http), and used a cPython program on the receiving end. The results are still the same; sending a small file (4357 bytes) takes only 2ms everytime, while a slightly larger file (6158 bytes) takes between 30ms to 300ms (...mostly around 200ms to 300ms). The sender program on the ESP32...
The receiver program running on cPython (Linux)...
|
Beta Was this translation helpful? Give feedback.
-
Actually I see similar figures in my little test program, which just uses |
Beta Was this translation helpful? Give feedback.
-
I've implemented a simple webserver on my ESP32 running micropython (...tested on 1.19, 1.21, and 1.22), and noticed that beyond a certain size, the time taken to transmit the data rises significantly. Test results...
test4.jpg (4357 bytes): ~20ms
test3.jpg (6158 bytes): ~200ms
Despite being only 41% larger, the second file takes about 10 times as long to transmit.
The relevant portion of the code is as follows:
Pre-reading the file into a bytes object doesn't improve the transmission time, so the bottleneck isn't in the read().
Timing is done with a simple...
The ESP32 is connected to my router in the above test, but I've observed the same issue when running the ESP32 as an AP and connecting directly to it.
Any ideas what I'm doing wrong here?
Beta Was this translation helpful? Give feedback.
All reactions