Wednesday, July 13, 2011

Firefox Pipelined!

‹prev | My Chain | next›

Last night I unsuccessfully tried to explore HTTP pipelining in Firefox. Pipelining, the sending multiple requests before the web server has replied to the first request, is major feature of SPDY. Pipelining is actually a feature of HTTP/1.1 only no one supports it.

That's not 100% true. Opera supports it, though only under certain circumstances. Currently Firefox only supports it with an about:config change. Still, there is active work with pipelining ongoing in Firefox so it seemed worth checking out.

Except it did not work.

That seemed crazy to me. There are all sort of discussions about Firefox and pipelining to be found. How could it simply not work?

So I did a bit more research and finally read the second sentence of the fifth paragraph in Mozilla's HTTP/1.1 Pipelining FAQ:
We also should not pipeline requests on a new connection, since it has not yet been determined if the origin server (or proxy) supports HTTP/1.1. Hence, pipelining can only be done when reusing an existing keep-alive connection.
Aaahh...

That's not quite how RFC 2616 reads:
Clients which assume persistent connections and pipeline immediately after connection establishment SHOULD be prepared to retry their connection if the first pipelined attempt fails.
But what the hey? I can still test that.

I create a pre-pipelining page. After accessing pre-pipeline.html and then waiting for a 5-count, a subsequent request of pipeline.html should pipeline that resource and everything referenced inside:
<p><img src="pipeline01.png"/></p>
<p><img src="pipeline02.png"/></p>
<p><img src="pipeline03.png"/></p>
<p><img src="pipeline04.png"/></p>
<p><img src="pipeline05.png"/></p>
<p><img src="pipeline06.png"/></p>
<p><img src="pipeline07.png"/></p>
<p><img src="pipeline08.png"/></p>
<p><img src="pipeline09.png"/></p>
<p><img src="pipeline10.png"/></p>
They should be pipelined, only they are not. Firefox requests pipeline01.png only after the server's response for pipeline.html is complete as seen in Wireshark:



And the requests for pipeline02.png - pipeline06.png go out on separate interweb tubes (as evidenced by the ACKs to different ports):



Finally, Firefox does not issue a request for pipeline07.png until it has fully received one of the other images:


(The response is complete at the top, followed by additional packets for the other 5 images in transit, and finally the request for pipeline07.png is at the bottom)

Presumably it does the same for pipeline08.png, pipeline09.png, and pipeline10.png as well. Except...

I cannot find those requests. I examine each of the packets after the request for pipeline07.png individually. Twice. And do not see the requests for any of those images.

Eventually, I look closer a the request for pipeline07.png... And notice the request for pipeline08.png right next to it in the same packet! Scrolling through the contents of the packet I see a GET for pipeline07.png all the way through pipeline10.png:



So Firefox does pipeline after all. It just takes a really long time for it to kick-in. Well that's not exactly competing with SPDY for fast page load times, but it should definitely help subsequent resource loads.

I will pick back up tomorrow by analyzing the eventual-pipelined stream. For now, I'm off to write some more of SPDY Book!

Day #72

No comments:

Post a Comment