I have extended the LWIP HTTP server (pico-sdk\lib\lwip\src\apps\http\httpd.c) to make a wireless web server that serves files from SD cards. It works, but it is slow for large files. For example, I have a web page that embeds an 85 kB jpg image, and it takes 18.86 s to load according to Chrome Developer Tools.
I started with lwipopts.h copied from pico-examples/pico_w/wifi/lwipopts_examples_common.h. With those settings, loading the image took just under 40 s! I made a few changes that cut the time in half:
TCP_SND_BUF (8 * TCP_MSS) to (16 * TCP_MSS)
MEMP_NUM_TCP_SEG 32 to 64
MEM_SIZE 4000 to 8000
HTTPD_LIMIT_SENDING_TO_2MSS to 0
However, I am just stabbing in the dark here. I'm not very familiar with LWIP. Do you have any suggestions?
I started with lwipopts.h copied from pico-examples/pico_w/wifi/lwipopts_examples_common.h. With those settings, loading the image took just under 40 s! I made a few changes that cut the time in half:
TCP_SND_BUF (8 * TCP_MSS) to (16 * TCP_MSS)
MEMP_NUM_TCP_SEG 32 to 64
MEM_SIZE 4000 to 8000
HTTPD_LIMIT_SENDING_TO_2MSS to 0
However, I am just stabbing in the dark here. I'm not very familiar with LWIP. Do you have any suggestions?
Statistics: Posted by carlk3 — Thu Jan 18, 2024 6:50 pm