WWDC 2012 session 706 - Networking Best Practices explains HTTP Pipelining.
Why might you not want to use it?
Clients SHOULD NOT pipeline requests using non-idempotent methods or non-idempotent sequences of methods (see section 9.1. 2). Otherwise, a premature termination of the transport connection could lead to indeterminate results.
Disadvantages of PipeliningDesigning of the pipelined processor is complex. Instruction latency increases in pipelined processors. The throughput of a pipelined processor is difficult to predict. The longer the pipeline, worse the problem of hazard for branch instructions.
HTTP/1.1 without pipelining: Each HTTP request over the TCP connection must be responded to before the next request can be made. HTTP/1.1 with pipelining: Each HTTP request over the TCP connection may be made immediately without waiting for the previous request's response to return.
HTTP pipelining is a feature of HTTP/1.1 which allows multiple HTTP requests to be sent over a single TCP (transmission control protocol) connection without waiting for the corresponding responses.
For pipelining to work, responses must come back in the order they were requested. A naive server implementation might just send the response as soon as it has been calculated. If multiple requests are sent in parallel, and the first request one takes longer to process (e.g. processing a larger image), then the responses will be out of order.
This is a problem for the client since HTTP is a stateless protocol, the client has no way to match the requests with the responses. It is reliant on the order the responses came back in.
A server MUST send its responses to those requests in the same order that the requests were received.
Even if the server does properly support pipelining, performance issues can arise because all subsequent requests have to wait for the first one to be complete (Head of Line blocking).
This article, talks about performance loss in some circumstances and a potential of denial of service attack.
This article also suggest that pipelining isn't a massive win.
WWDC 2015 - Networking with NSURLSession explains head of line blocking really well. (The solution is to switch to HTTP 2 which support priorities)
So in summary the issues with HTTP pipelining are:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With