raw lwip socket very slow
Posted: Fri Sep 20, 2019 2:27 pm
I'm working on a project with an esp32-cam that sends images through lwip sockets
The problem is that sending is very slow. I've measured the time that the send function takes for the image buffer obtaining an average bandwidth of 400kb/s.
I've tried to modify some of the socket options, send buffer, wait timeout, etc. with no luck.
Then I decided to test one of the esp32-cam that are on the internet (https://github.com/RuiSantosdotme/ESP32-CAM-Arduino-IDE) and surprisingly it has an average bandwitdh of 2Mb/s, measuring the time that httpd_resp_send_chunk takes for the image buffer, which is the speed I need.
It's strange because this function encodes the image data and should be slower.
I've search in the esp_http_server code for differences between the use of sockets in this library and my project. But I couldn't find them.
I've also analized the traffic with wireshark. In both cases the image buffer is splitted in blocks of 1430 bytes, but with httpd_resp_send_chunk takes much less time.
Does anybody know why httpd_resp_send_chunk is that fast and why I can't reach this transfer speed?
Thanks.
The problem is that sending is very slow. I've measured the time that the send function takes for the image buffer obtaining an average bandwidth of 400kb/s.
I've tried to modify some of the socket options, send buffer, wait timeout, etc. with no luck.
Then I decided to test one of the esp32-cam that are on the internet (https://github.com/RuiSantosdotme/ESP32-CAM-Arduino-IDE) and surprisingly it has an average bandwitdh of 2Mb/s, measuring the time that httpd_resp_send_chunk takes for the image buffer, which is the speed I need.
It's strange because this function encodes the image data and should be slower.
I've search in the esp_http_server code for differences between the use of sockets in this library and my project. But I couldn't find them.
I've also analized the traffic with wireshark. In both cases the image buffer is splitted in blocks of 1430 bytes, but with httpd_resp_send_chunk takes much less time.
Does anybody know why httpd_resp_send_chunk is that fast and why I can't reach this transfer speed?
Thanks.