Hacker News new | ask | show | jobs
by SpikeGronim 4735 days ago
TCP cannot tell what the application wants. If the client application never closes the connection then TCP will keep that connection alive indefinitely (assuming you configured it with keep alives). Each connection consumes some resources on the server (primarily send and receive buffers in memory). So if your application never tells TCP to close the connection then it hogs server resources. There are many malicious DoS tactics that go for the same effect.
3 comments

> There are many malicious DoS tactics that go for the same effect.

One of the most popular is a slowloris attack. It's particularly pernicious if it's distributed and coming from a botnet or something. https://en.wikipedia.org/wiki/Slowloris

Would a sane server not set an upper limit to the lifetime of these connections? In YouTube's case, something like... the length of the longest video? edit: or perhaps even the _exact_ length of the video being requested?

Also, since this is video, why isn't this UDP?

The server can close it though.

Just have the server ignore keep-alives after a certain amount of time or something.