Why do small file size images take long to download?


I find it odd that a 16kb image takes 500 ms to download.

Is this normal?

It’s not unusual (it looks like there are actually 3 different 16K images downloading at the same time). The actual download time on the wire is probably less than that but WebPagetest is measuring when the browser processes the actual data that came in on the wire - you can grab a tcpdump for much more accurate details on the actual data flow.

That said, TCP slow start is something that most web developers should learn about because it has a profound effect on HTTP in particular since the connections are usually short-lived. TCP slowly ramps up the transfer rate across a connection and doesn’t just blast all 16KB. It differes by server but usually it will send 4KB and as each packet gets delivered it will increase the transfer size by the amount that was delivered.

In a simplistic model (assume all of the data is delivered at once) that means to deliver 16KB it actually sends:

4KB - initial congestion window
8KB - increased by the 4kB that was delivered
4KB - remaining image data (congestion window is 16KB)

And takes 3 round trips to deliver the data (with ~100ms RTT to the server that could take 300ms just in round trips).

That said, stack_logo.png is delivered on a connection that is already partially warmed up but it looks like the previous data was only 500 bytes or so so it didn’t really help (connection view will show you what data was downloaded before).

John Rauser gave a great talk at last year’s Velocity conference on the topic. Steve Souders has a write-up on it here: http://www.stevesouders.com/blog/2010/07/13/velocity-tcp-and-the-lower-bound-of-web-performance/ with a link to a video of the presentation.