views:

306

answers:

3

For several years, I've been facing problems with HTTP 1.1 pipelining & continued to ask the server to send the HTTP Header:

Connection: close

I want to revisit this decision. Does your native mobile apps use HTTP pipelining ? Some problems with HTTP pipelining I've faced:

  • Server not releasing TCP connections
  • My client is receiving multiple replies from one HTTP connection
A: 

One of the requirements for clients/servers to be compatible with HTTP/1.1 is the support of pipelining. So I don't see how using it would be a problem... I would rather think it would be encouraged. Using pipelining you cut down on creating new resources, network bandwidth, etc.

All modern web servers support pipelining and any reasonably complete client library should, so I'm not sure what the problem could be... perhaps if you ask about specific errors we could help you with them.

fiXedd
A: 

HTTP "pipelining" does not only mean to keep the TCP connection open between consecutive requests/responses. It describes a user agent behaviour where it sends the next HTTP request even without waiting for the pending response to the last request.

In my experience almost any HTTP server supports persistent connections. Using pipelining additionally is less stable. Firefox implements this feature but diables it by default.

mkoeller
+1  A: 

That's exactly what persistent connections and pipelining are for: keeping the TCP connection open until the timeout expires (or the browser closes), and sending multiple requests down the same pipe.

You might want to consider removing persistent connections if your server serves a high number of clients (you might run out of workers, RAM, or even free ports, raising response time for new requests)

If you want to read further, a pointer about persistent connection behaviour

ptor
So is returning a "Connection: close" a bad thing ?
Jacques René Mesrine
it will close the current stream, freeying up resources. If you know you won't need it in the next second or so, it's actually a very good thing; in all other cases it still might be good
ptor