Live data from Hacker News

Stop Wasting Connections, Use HTTP Keep-Alive

lob.com

11–20 of 112 posts

Re: Stop Wasting Connections, Use HTTP Keep-Alive

#11
post #7

My understanding was that with http/1.1 all connections are kept alive until a close is emitted. How is this different?

Based on https://en.wikipedia.org/wiki/HTTP_persistent_connection#HTT... it sounds like your statement is correct.

But the fact that the underlying HTTP connection is kept-alive by default doesn't necessary mean that the client is going to actually re-use that connection for multiple HTTP requests. And, in fact, in Node.js the connection is not reused by default.

Re: Stop Wasting Connections, Use HTTP Keep-Alive

#12

Unfortunately most people's primary computing devices are smart phones and smart phone radios cannot keep a TCP connection open, or won't, because of power usage.

While this might be true for users connection to services there are also a lot of intra-serices connections that can keep TCP connections open and greatly benefit from doing so. For example, a microservice architecture where you have APIs communicating through HTTP with each other.

Re: Stop Wasting Connections, Use HTTP Keep-Alive

#13

Unfortunately most people's primary computing devices are smart phones and smart phone radios cannot keep a TCP connection open, or won't, because of power usage.

This article is talking about server-side services using keep-alive. Which are pretty unlikely to be running on a smart phone ;)

Re: Stop Wasting Connections, Use HTTP Keep-Alive

#14
So I've been writing a web server recently (mostly for learning purposes of HTTP and web stuff again as I've been out of that field for over a decade), and I've discovered that Firefox seems to be the only browser I've tried which still really utilises it fully and respects the headers: Safari sort of does, but only ever once, regardless of the header params, and Chrome never does, again, regardless of what the Connection header item says in the first response from the server.

https://www.chromium.org/developers/design-documents/network...

shows they removed it in Chrome due to issues, and weirdly this Firefox ticket:

https://bugzilla.mozilla.org/show_bug.cgi?id=264354

(last updated 5 years ago), seems to show they're not going to enable keep alive for HTTP 1.1, but Firefox is most definitely utilising it.

Re: Stop Wasting Connections, Use HTTP Keep-Alive

#16
post #14

So I've been writing a web server recently (mostly for learning purposes of HTTP and web stuff again as I've been out of that field for over a decade), and I've discovered that Firefox seems to be the only browser I've tried which still really utilises it fully and respects the headers: Safari sort of does, but only ever once, regardless of the header params, and Chrome never does, again, regardless of what the Conne…

These tickets talk about pipelining, not keep-alive. The chrome link specifically points out why they decided to disable it. Chrome and Firefox still support regular keep-alive and do reuse connections on http 1.1

Re: Stop Wasting Connections, Use HTTP Keep-Alive

#19

Unfortunately most people's primary computing devices are smart phones and smart phone radios cannot keep a TCP connection open, or won't, because of power usage.

Why does the radio have to be on just because there is an open TCP connection?

Are you asking why the radio has to be on or implying there are other reason that the radio could be on for? If you have a TCP connection open but the radio is off how are you going to receive incoming packets?

Re: Stop Wasting Connections, Use HTTP Keep-Alive

#20

Unfortunately most people's primary computing devices are smart phones and smart phone radios cannot keep a TCP connection open, or won't, because of power usage.

I thought the primary use case for this is you could load all of your websites resources on a single connection so you can make 100 file requests at the start and it only makes one connection.
Post reply on HN