I have built an embedded web server by extending NanoHTTPD (1.25). It is used for Firefox browser to show its content within the same machine. (SuSE 11)
Since the Firefox needs to show changing content within a very short duration (0.2 sec refreshment), it keeps polling the JSON URLs very quickly.
setInterval(function() {
$.getJSON("content.json", function(d) {
...
$('#content_div').html(d);
})
.error(function() {
$('#content_div').html("");
});
}, 200);
As a result, it creates a lot of unused connections and sometimes cannot get any response from my web server.
netstat -ap |grep "localhost:80" |wc -l
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
2212
Why are there so many TIME_WAIT connections? How can I make my web server healthy and ensure response from my web server?