Way back in college, when I was earning my Computer Science degree, the latencies of computer storage were taught like so:
- On CPU register
- CPU L1/L2 cache (this was before L3 existed)
- Main Memory
This question came up
today, so I thought I'd explore it.
The answer is complicated. The advent of Storage Area Networking was made possible because a mass of shared disk is faster, even over a network, than a few local disks. Nearly all of our I/O operations here at WWU are over a fibre-channel fabric, which is disk-over-the-network no matter how you dice it. With iSCSI and FC over Ethernet this domain is getting even busier.
That said, there are some constraints. "Network" in this case is still subject to distance limitations. A storage array 40km from the processing node will still see more storage latencies than the same type of over-the-network I/O 100m away. Our accesses are fast enough these days that the speed-of-light round-trip time for 40km is measurable versus 100m.
A very key difference here is that the 'network' component is handled by the operating system and not application code. For SAN an application requests certain portions of a file, the OS translates that into block requests, which are then translated into storage bus requests; the application doesn't know that the request was served over a network.
For application development the above tiers of storage are generally well represented.
- Registers, unless the programming is in assembly, most programmers just trust the compiler and OS to handles these right.
- L1/2/3 Cache, as above, although well tuned code can maximize the benefit this storage tier can provide.
- Main memory, this is directly handled through code. One might argue that at a low level memory handling constitutes a majority of what code does.
- Disk, This is represented by file-access or sometimes file-as-memory API calls. These tend to be discrete calls from main memory.
- Network, This is yet another completely separate call structure, which means using it requires explicit programming.
Storage Area Networking is parked in step 4 up there. Network can include things like making NFS connections and then using file-level calls to access data, or actual Layer 7 stuff like passing SQL over the network.
For massively scaled out applications, the network has even crept into step 3 thanks to things like memcached and single-system-image frameworks.
Network is now competitive with disk, though so far the best use-cases let the OS handle the network part instead of the application doing it.