I have a Web Server running on a devices under uhttpd.
I have N devices ( N could be 25 ) that send request to the main devices.
Everything works correctly when the main devices is running, but during a reboot and starting up it is slower.
I noticed that the during the boot of the main devices the "netstat -ant | grep ESTABLISHED | wc -l " gives my high number ( 40, 50 ..) and then after a few minutes this number drops to 4-7.
So I think that this could be the problem..?
My max_request on /etc/config/uhttpd is 20
I read Here that the requests are queued until the number drops below the limit.
How can I drop, reject or empty the queue until the system is ready to handles them?
Hope the question is clear enough
If it were me, I’d run a “real” web server, nginx.
Past that, you might try changing the start-up script for uhttpd to later in the sequence
And how exactly would that solve the problem of connections piling up because the backend application is still booting?
If at all, it seems to me that it would even worsen the problem due to a higher resource usage.
Is it possible to drop all the connection till the process is running correctly?
This is hard to answer without knowing exactly how your process is implemented. Is it a CGI program talking to some daemon, or a Lua program embedded in uhttpd?
One approach to avoid the connection pile would be to make your application respond with a 503 HTTP error while your application is unable to serve requests. Right now it sounds to me as if you're accepting, but not answering incoming requests.