NanoHTTPD (1.25) を拡張して組み込み Web サーバーを構築しました。Firefox ブラウザが同じマシン内でそのコンテンツを表示するために使用されます。(SuSE11)
Firefox は非常に短い時間 (0.2 秒の更新) で変化するコンテンツを表示する必要があるため、JSON URL を非常に迅速にポーリングし続けます。
setInterval(function() {
$.getJSON("content.json", function(d) {
...
$('#content_div').html(d);
})
.error(function() {
$('#content_div').html("");
});
}, 200);
その結果、多くの未使用の接続が作成され、Web サーバーからの応答が得られないことがあります。
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
TIME_WAIT 接続が非常に多いのはなぜですか? Web サーバーを健全な状態にして、Web サーバーからの応答を確保するにはどうすればよいですか?