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!