Sunday, July 17, 2011

HTTP and Slow ACKs

‹prev | My Chain | next›

I continue to play with Speed Tracer tonight. It is a wonderful visualization tool, but sometimes confuses the hell out of me.

Yesterday, I was able to create a nice, teachable diagram like the following:

It is teachable in SPDY Book because 6 images, 02-08, are downloaded in parallel. That makes it quite obvious that Chrome (and all other browsers) have a maximum of 6 interweb tubes to load resources in parallel.

Today, however, I am seeing graphs like the following:

Images 02-06 look to be downloaded around the same time. The next two images do not start returning to the browser until those first four complete. In other words, it looks like there are four, not six tubes in use.

Maybe I am obsessing over small details, but I hate the idea of not knowing a thing. That personality quirk is only magnified because I am basing content in SPDY Book on this knowledge. I must know. I will have my answer!

To solve any network related problems, I drop to Wireshark.

Hrm... looking closer at those packets, I see that immediately after requesting the first two images, Chrome is setting up the other tubes:

TCP/IP SYN packets are the first part of a TCP/IP handshake. It certainly makes sense that, if I have not visited a site before, that these tubes would have to be established.

A closer look at timing of those packets reveals that it takes a little more than 100ms for the connection to be fully established (from initial SYN, to SYN-ACK from the other side to the final ACK):

Ah… That is the 50ms delay that I have in place on this network device.

Dang it. So everything is working just fine. The first two tubes, previously established by transferring over the single CSS file and jQuery are used for the first two images. The next four images are transferred once four new tubes are established. With a 100ms round trip time, that takes a while. In the meantime, the original two tubes come free to request the next images.

That begs the question of how I managed the screenshot from yesterday. The transfers for CSS and JS were really brief. Perhaps that has something to do with it. More likely, I think, is that I had previously established a connection to the site, reloaded and, thus re-used already established tubes.

I hate to lose that teachable moment in SPDY Book, but better that than faking a connection. The six tubes will just have to be introduced as, "sometimes tubes look like this…".

Day #76

No comments:

Post a Comment