MEMP_NUM_TCP_PCB effect on TLS and HTTPD

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

MEMP_NUM_TCP_PCB effect on TLS and HTTPD

Mario Luzeiro
Hello all,

I have a HTTPD via mbedTLS all is going OK except I have issues with multiple connections from browser requests (browsers send multiple connection at same time to faster load the website). Sometimes it cannot make the connection and cannot load all external files in the webpage.

I was playing with MEMP_NUM_TCP_PCB and I got some behavior I cannot explain and looking for your help.

MEMP_NUM_TCP_PCB 5
https://i.imgur.com/6oNwz15.png
File loads in 27s

MEMP_NUM_TCP_PCB 12
https://i.imgur.com/c449wIz.png
note: TTFB means Time To First Byte
File loads in 420ms

So if I set an higher MEMP_NUM_TCP_PCB value it all times will take that slow 400ms

does anyone could explain what could MEMP_NUM_TCP_PCB influence in this case?

Mario Luzeiro
_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: MEMP_NUM_TCP_PCB effect on TLS and HTTPD

goldsimon@gmx.de
Am 08.10.2019 um 13:15 schrieb Mário Luzeiro:

> Hello all,
>
> I have a HTTPD via mbedTLS all is going OK except I have issues with multiple connections from browser requests (browsers send multiple connection at same time to faster load the website). Sometimes it cannot make the connection and cannot load all external files in the webpage.
>
> I was playing with MEMP_NUM_TCP_PCB and I got some behavior I cannot explain and looking for your help.
>
> MEMP_NUM_TCP_PCB 5
> https://i.imgur.com/6oNwz15.png
> File loads in 27s
>
> MEMP_NUM_TCP_PCB 12
> https://i.imgur.com/c449wIz.png
> note: TTFB means Time To First Byte
> File loads in 420ms
>
> So if I set an higher MEMP_NUM_TCP_PCB value it all times will take that slow 400ms
>
> does anyone could explain what could MEMP_NUM_TCP_PCB influence in this case?

You should definitively debug this using wireshark to see what's going
on, but I guess the browser still opens multiple connections to load the
single image (as a result of TLS negotiation). Then you might just hit
the limit of parallel connections and new connections must wait until
old connections are closed.

Httpd via https uses altcp, which needs 2 altcp_pcbs per connection
(plus one tcp_pcb). And MEMP_NUM_ALTCP_PCB is defined to
MEMP_NUM_TCP_PCB unless explicitly set. Thus you can only have 2
parallel TLS connections, which migh explain what you see.

Regards,
Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users