Richard Florance's Solution Performance blog

Everything and anything about making Solutions run faster and more efficiently...

The relative speed of I/O

It still amazes me how often I come across dev's who have no appreciation of just how slow hard disks and networks actually are, especially when you compare their latency to the speed of your average Pentium processor. As a result they often break all my golden rules and cause severe pain to their solutions because they have expectations that going to disk or network is relatively inexpensive.

To try and give the person I was talking to a better perspective on just how slow I/O is, I looked up the relative latencies of current state of the art technologies and put together timelines based on the idea of 'if one CPU clock takes one second how long does X take'. Here is what I came up with:

Relative access frequencies of current state of the art:

   CPU                3 GHz              (0.3ns - Current mainstream Intel Pentium IV clock speed)

   Memory           800 MHz         (1.25ns access time – the speed of fast DDR2 memory)

   LAN                500 Hz             (2ms - typical latency on a 1GHz LAN - I'm guessing a bit on this one but it seems reasonable)

   Disk                 200 Hz             (5ms - disk seek time for an average random disk access)

   WAN               25 Hz               (40ms- typical latency on US domestic Internet WAN link)

 

Translating these frequencies into numbers of CPU clock cycles gives:

   1 Memory access = 4 CPU cycles

   1 LAN access = 6,000,000 CPU cycles

   1 Disk access = 15,000,000 CPU cycles

   1 WAN access = 120,000,000 CPU cycles

 

Therefore if one clock cycle on a 3GHz processor takes 1 second then…

   A memory access takes 3.75 seconds

   A network round trip takes 69.4 days

   A disk access takes 173.5 days

   Accessing an internet site takes 3.8 years!

This gives you a pretty good feeling for why caching just about everything is good for performance!

Published Friday, August 12, 2005 12:47 PM by Flo

Comments

 

LarryOsterman said:

I'm not 100% sure about your LAN and WAN numbers - how are you measuring a "cycle" for things like network and disk?

IIRC, the inherent latency on a 10MHz Lan is also about 1 millisecond (that's what it takes to transmit 1568 bytes). So I'm a smidge confused about the 2ms latency for 1GHz ethernet.

And the WAN numbers seem even slower - what's a "typical US domestic Internet WAN link"? An OC12 link is going to be somewhat faster than a 56K dial-up.

In general, the scale of your numbers seems about right, but...
August 12, 2005 10:47 AM
 

LarryOsterman said:

Oh, and one other thing - the critical factor on local area networking is the number of round trips, not the number of bytes transmitted. It takes the same amount of time to transmit 1 byte as it does to transmit 1500 bytes (this depends on the framing size of the network - for example, ATM has a packet size of 70 bytes).

For a modem, on the other hand, the critical factor is the number of bytes transmitted.
August 12, 2005 10:49 AM
 

Flo said:

I agree with your comments. I intentionally took a rather simplisitic approach to this to keep the comparisions simple and in some ways I'm comparing apples with pears here. However what I think it does get across very well is just how slow disk and network I/O is compared to CPU and memory. I'm still amazed at the number of times I come across developers who think it's Ok to do repeat calls to a stored proc or a web service and not bother with caching the data locally - I try to use this data as a stick to point out the error of their ways...
August 15, 2005 9:03 AM
 

Richard Florance s Solution Performance blog The relative speed of I O | Paid Surveys said:

May 29, 2009 4:40 PM
 

Richard Florance s Solution Performance blog The relative speed of I O | debt solutions said:

June 19, 2009 1:58 PM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker