5 ms·
Speeding up HTTP with minimal protocol changes
- pibi 14y agoMaybe better without Slice-Length header for chunked encoding to avoid buffering on web server.
- matthavener 14y agoDoesn't the slice length help the server avoid buffering? You can send a incomplete amount of data out as soon as you've computed it.
- pibi 14y agoI think of dynamic pages. How could the webserver compute the slice length without known chunked length and buffering?
- samwillis 14y agoI like this, it seems so much more clean than SPDY, HTTP really should stay a text based protocol. My understanding for the design of SPDY was that by forcing TLS it ensured that any proxy server in the middle wouldn't interfere or be "confused" with the connection. What would an existing proxy server (i.e. doesn't understand HMURR) do with a connection that looked like this?
- CJefferson 14y agoThat is I think one of the big problems with this suggestion. The world is full of proxies and html-consuming tools that do not bother to check the version number, which would get horribly confused by this, and probably mangle the stream. I was under the impression one of the reasons SPDY is so different is precisely to try to avoid problems with bad proxies. I'm not an expert on this unfortunately, but I'm sure that quite a few bits of the web-proxy standard involved getting around badly behaving proxies, and they had to do a few strange things.
- firebird84 14y agoTo be honest, I wouldn't be surprised. Proxies are precisely one of the reasons the WebSockets protocol has been changed to be such a pain in the ass compared to its original incarnation. I suggest checking out its original proposal and compare it to the draft RFC - it's rather enlightening.
- 0x0 14y agoEven if the tool does not check the version number in the request, wouldn't any proxied response contain a HTTP/1.0 or HTTP/1.1 header? In that case, the client will see all but the first request in a connection stands no chance of being fulfilled, and fall back to HTTP/1.1 behaviour (perhaps caching a NO_HTTP_1_2 flag per hostname for a while) Edit: Or also add an "Upgrade: slices" to the initial request, and if the expected response to the Upgrade: request is missing, continue with HTTP 1.1.
- jgrahamc 14y agoCorrect. Since each connection in my proposal starts with a non-pipelined request the HTTP version number of the response could be examined.
- santaragolabs 14y agoIt depends. A SOCKS proxy would continue to work perfectly; no changes needed there. But most production networks use HTTP proxying; assuming that they do not do MITM attacks (sometimes for legitimate inspection/compliance reasons) on the SSL traffic it will mean that HTTPS will continue to work perfectly too since that normally runs over a simple HTTP CONNECT Proxy which functions the same as a SOCKS proxy. So that leaves the standard HTTP proxying. The HTTP proxy might treat the 2nd to nth request as being the payload of the HTTP request and may insert Content-Length headers. The HTTP proxy might filter out unknown HTTP headers (would be pretty bad; it's like the common example of where strict firewall admins tend to drop all ICMP packets). There will be security issues related to colliding Request-ID's and to the caching of it. Also I don't see why we would need the Slice-Length. Just re-use the Content-Range header, that's what it's for right? (http://www.greenbytes.de/tech/webdav/draft-ietf-httpbis-p5-range-latest.html#rfc.section.4 http://www.greenbytes.de/tech/webdav/draft-ietf-httpbis-p5-r...). The standard HTTP pipelining is quite old and very well specified but afaik none of the major browsers implement it; I'm not sure why though. Maybe it depends on the lack of server support.
- jgrahamc 14y agoI do not propose to use Content-Range or 206 Partial Content because they already have a defined use. 206 Partial Content is used to response to a request for a specific range.
- santaragolabs 14y agoOkay, guess that makes sense; personally I wouldn't mind having this dual usage but maybe it would make the W3 spec people throw a hissy fit. Interesting attempt I must say but I think it will be hard to actually get it out there. Too much legacy stuff in the way. It's a bit like how for a really long time a lot of fancy new VOIP protocols were really hindered by the lack of proper NAT support leading to all these horrible workarounds to do NAT hole punching or more RFC's like STUN and TURN.
- jerf 14y ago
- asdfaoeu 14y agoI don't really see the point. Spdy is already supported by major browsers more than this would ever have. Why have half the features when you can have them all? Also browsers would need new APIs to deal with getting the data from slicing as it doesn't seem to properly support something like web sockets (no multiplexing of the input, does spdy support web sockets?)
- samwillis 14y agoTrue, it doesn't help with web sockets but I think it could work very nicely with "Server-sent events"[1]. I believe that in almost all cases (Except gaming) where people are trying to use web sockets you can achieve the same result with SSE. 1: http://en.wikipedia.org/wiki/Server-sent_events http://en.wikipedia.org/wiki/Server-sent_events
- lucian1900 14y agoTransparent proxies, stupid antivirus software ... There's no end to the amount of crap that interferes with HTTP. These days, the only way one can get anything through is over SSL.
- deleted 14y ago[deleted]
- rwj 14y agoI wonder why no one has defined a multi-part message format. The server would deliver a single file, which would start with the HTML and be followed by images and other assets. This approach should play nice with all the proxies (which would see a single octet stream), and, since the pipelining multiplexes everything on a single connection anyway, deliver similar performance. I understand that no one wants to define a new format, but I don't see how it is more difficult than defining a new protocol.
- jimktrains2 14y agoIt's called MIME. email does it everyday. Why it's never been applied to HTTP is beyond me.
- hobohacker 14y agoWhile intriguing, this suggestion has a number of issues. For one, it implies coalescing a number of resources into a single resource named by a single URL. This means that all resources would have to share the same caching properties. Since it's generally desirable to keep the main document (the HTML) uncacheable to allow site updates, this would imply eliminating the vast majority of web caching, which sounds undesirable.
- rwj 14y agoI may be mistaken, but since everything in SPDY happens over a secure connection, isn't caching already broken? It seams to me that any approach to combining resources to minimize round-tripping will involve a trade-off against the granularity of caching properties.
- graue 14y agoNope. Caching proxies aren't possible, but the browser cache still works fine.
- hobohacker 14y agoI think the source of the confusion is that you are conflating sharing of a [SPDY] connection with sharing of a resource identifier (a URI/URL). This is a misunderstanding. SPDY multiplexes multiple streams over a single connection (or more accurately, a session). Each stream is used in the HTTP layering case to correspond to a request/response pair for fetching a resource at a URL. So, even though a single connection is shared, different resources at different URLs can be simultaneously requested over the same SPDY connection. In short, SPDY does not imply combining resources. Application level combining of resources is a common hack to work around lack of parallelization at the HTTP/1 protocol level, but as noted, it has deficiencies.
- hobohacker 14y agoIt's unclear to me what advantages this proposal has over a HTTP/2.0 proposal using HTTP Upgrade. AFAICT, the client is unable to rely on HTTP/1.2 support in the first roundtrip. Therefore, it cannot begin utilizing the new proposed features. Relying on the HTTP/1.2 HTTP-Version within the Request-Line and Status-Line strikes me as less safe than trying to use the Upgrade header to attempt to upgrade to HTTP/2.0, as it seems much more likely for intermediaries to have broken HTTP-Version parsing than broken Upgrade support. In contrast with this proposal, when using the Upgrade header, there is much more freedom to change the wire level representation of the protocol. And if you're going to do HTTPS anyway, using TLS-NPN to negotiate a completely wire level representation (without an additional roundtrip over the TLS handshake roundtrip[s]) likewise enables more freedom to add features. It seems like the main reason to prefer this proposal is if you do not want to write another parser for HTTP/2.0 and think that new features afforded by a different wire level representation are not worthwhile. Another thing to note is that this proposal effectively adds on multiplexing without prioritization. Prioritization is fairly important, otherwise the client application has to do application layer throttling in order to reduce contention. Adding prioritization would help obviate the need to make the link utilization vs contention tradeoff.
- jgrahamc 14y agoYou could easily modify this proposal to use the Upgrade header for greater safety in interacting with older systems or use TLS-NPN. Can you give an example of prioritization in practice?
- hobohacker 14y agoI see, so your main point really is that you don't think the new features proposed in HTTP/2.0 are worth the change in wire representation. Prioritization: Generally speaking, documents (HTML) > script/stylesheets (JS&CSS) > subresources (e.g. images). https://insouciant.org/tech/resource-prioritization-in-chromium/ https://insouciant.org/tech/resource-prioritization-in-chrom... https://insouciant.org/tech/throttling-subresources-before-first-paint/ https://insouciant.org/tech/throttling-subresources-before-f...
- paulsutter 14y agoPatrick McManus (a Firefox developer) added the following comment directly on the blog posting. An underlying/implied point is that SPDY is already shipped [1]. " Your premise seems to be that SPDY is a complex binary protocol and we don't need that achieve mux. I don't see much evidence for your complexity assertion - especially when compared with HTTP/1. Consider the difference in finding the message boundaries of a SPDY message with an HTTP/1.1 one. To process the SPDY message you * buffer 8 bytes of data * determine that it is a data packet by confirming (buf[0] & 0x80 == 0) * determine the length of the data by ntohl(((uint32_t)buf)[1)& 0x00ffffff * find out if there are more chunks to come by looking at (buf[4] & 1). All done. It is very straightforward, efficient, well bounded, and testable. Contrast that with parsing a HTTP/1 message. * read "enough" data from the network. You don't know how much that is and if you read too much you have to implement some facility for "putting it back" so the next message can use it. This inevitably leads to streaming parsers and their inherent complexity and lack of efficiency. * parse the headers so you can determine which message delimiter is being used. To parse the header you have to implement line folding, implement a tokenizer aware of various rules around quotation marks and colons, and adopt to a number of real-world variations in the use of line endings other than just CRLF. To do this you have to run a state machine against every byte of input rather than directly address fixed offsets. * Implement strategies to deal with conflicts such "Content-Length: 42, 17" and "Content-Length: 95\r\nTransfer-Encoding: chunked\r\n" * you need to implement an ascii to integer conversion routine to determine the status code because some status codes implicitly impact message delimiters (e.g. 304). * now you have to implement no less than 5 message delimiting schemes - chunked encodings, EOF, content-length, implicit (304), and everyone's favorite multibyte/ranges. * If you have content-length or a chunk you'll need to convert a text string to an integer again.. and http/1 doesn't bound the size of the text string so you'll either have a common bug with an overflow or you'll implement an undiscoverable constraint in your implementation leading to cases of failing interop. * you'll still have exposure to a whole class of CRLF injection attacks inherent in the text format. The binary framing is so much less complex and significant improvement. Sure, to the naked eye in a log it may not look that way but that is optimizing for all the wrong things and can be quite misleading - do you really interpret a HTTP header with line folding or \n\r instead of \r\n sequences correctly when eyeballing it?) Now there certainly is some complexity in SPDY but it doesn't come, in my opinion, from the binary framing that you're talking about here. That is a a significant simplification over HTTP/1. " [1] https://hacks.mozilla.org/2012/02/spdy-brings-responsive-and-scalable-transport-to-firefox-11/ https://hacks.mozilla.org/2012/02/spdy-brings-responsive-and...
- FooBarWidget 14y agoNot sufficient. If you look at the SPDY spec you'll see commands for window control, which is necessary in a serious multiplexing protocol. This spec doesn't have it.
- vaxdigitalnh 14y agoI'd like to be able to use pipelining without having to de-chunk. That is, thanks to the the HTTP/1.1 protocol I have never found a server that accepts pipelined requests and delivers unchunked output. Is there a reason they must be linked together? Maybe you could compare this to how SPDY requires header compression; you can't get the other features without accepting the compression feature... the single feature which was the source of the security problems. In sum, why can't we uncouple features that each may have merit on their own?
- patrickmcmanus 14y agoOptional features tend to be broken in practice. So HTTP/2 is trying to have far fewer of them so that implementations will be more robust. Chunked requests and pipelines are good examples. They are rarely used but absolutely supported by the spec. But because they are rarely used they break a lot in practice and are not realistically deployable on Internet scale.