[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] httpd, tls, multiple get requests, delays

From: Trampas Stern
Subject: Re: [lwip-users] httpd, tls, multiple get requests, delays
Date: Sun, 10 May 2020 08:21:08 -0400

I have ran into similar issues.  I ended up changing my HTML source files. 

To understand let me start with the background.  I have a web page where ever second I request data from the embedded server and display it.  So in the _javascript_ for the web page I had a 1000ms timeout that requested new data(file).  This worked great on the bench.  However the customer was testing it and complaining about it being slow.  As it turns out the issue was the customer had a slow laptop and when they started a zoom meeting the network traffic on the laptop went up and my device got really really slow.  
What I found was happening is I would make a request for data, it would time out inside chrome which would retry the request.  That is as the requests timed out in the browser it would retry, this meant as time moved forward I would start with browser trying to request one copy of data, then if that timed out it would request it again while my timer in _javascript_ also requested it again, now I had two connections for the same file on the embedded device. Then three, then four... 

The solution was to change the _javascript_ such that it made request and if I did not get a response in 500ms it would time out the request, before I made a second request. This way at any time the browser would only allow one request per file. I also could increase the timeout between requests to match network speed.   I found this also needed to be done with CSS files.  That is sometimes I found that I would get random failure requesting files.  For example at one time my Phy chip was getting too hot and causing random network failures that cause havoc on my system.  I found that this would cause random failures, and retries.  By having the _javascript_ control the time out on the file it helped.  That is with the random failures and the time out for the http connection in lwip I would again get where I had two open connections for the same resource/file.  Hence timing out on _javascript_ would send the close to the server and thus kill one connection before starting a new one.  

This also leads to the other issue, when you use LWIP you have think about how the system handles multiple requests for the same resource.  That is if you are sending out a file can lwip have two open connections to the file?  For example two computers accessing your server at the same time.  This is one reason I implemented authentication system, as it restricts the number of connections, by restricting the number of users. 


On Sat, May 9, 2020 at 5:03 PM Mário Luzeiro <address@hidden> wrote:
Hello all,

I'm looking for some ideas how can I improve an issue I have.
I have a httpd over TLS. As you may know, browsers fire multiple requests at same time to get the resources.

I had a lot of issues related with TLS / LWIP connections to handle this multiple connections but the major are now working ok...
but as you can see in the screenshot, despite most of the requests are handled very quickly but for some reason.. some will take too long to handle.
There is some pattern on this, sometimes a bit random on the time it takes..
The first time the browser connects to the server it takes a lot to initialize the TLS, but its ok because the next ones are very fast.. except that random get requests

Any idea how can it be improved ?

I already support 20 TCP connections ( MEMP_NUM_TCP_PCB is 20 * 2 ) and played with lots of parameters that I tuned for the best results except this last one..

Mario Luzeiro
lwip-users mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]