Β§50.1–50.3AFS Version 1: Whole-File Caching and Improving the Protocol

Part III OSTEP pp. 639–642 Β· ~6 min read

  • andrew file system
  • whole-file caching
  • volume

The Andrew File System (AFS, CMU, 1980s) was built around one goal: scale β€” how many clients can a single server support? Where NFS makes clients constantly poll the server to validate caches (burning server CPU), AFS is designed to minimize server interaction. It also made understandable consistency a first-class concern: on open(), a client generally just gets the latest consistent copy.

50.1 AFS Version 1

The defining idea, present in every AFS version, is whole-file caching on the client’s local disk:

Whole-file caching in AFS. Fetch the entire file to local disk on open, work locally, and flush it back on close β€” network traffic only at the ends.
Client (Venus)local-disk cache(filling…)reads/writes hit the cached copyServer (Vice)disk: file FFetch: whole file β†’

1open(): Fetch the whole file

The AFS client (Venus) sends a Fetch to the server (Vice), which ships the ENTIRE file back. Venus writes it to the client's local disk cache.

step 1 / 4

The client-side code is called Venus; the servers are collectively Vice. Note the sharp contrast with NFS:

Two caching philosophies. AFS trades many small server trips for a few big ones.
NFSAFS
caches whatindividual blockswhole files
caches whereclient memoryclient local disk (+ memory)
read/write costmay hit the server on a block misspurely local after the initial fetch
on closeflush dirty blocks (flush-on-close)flush the whole file if modified (Store)
server tripsmany small onesa few big ones (fetch/store whole files)
Dotted-underlined cells have explanations β€” click one.

The AFSv1 protocol is small (directories were kept only at the server in this version):

Figure 50.1: AFSv1 protocol highlights.
what it does
Fetchfetch the contents of a file (given its whole pathname)
Storestore this file on the server
TestAuthtest whether a file has changed (used to validate cached entries)
GetFileStatget the stat info for a file
SetFileStatset the stat info for a file
ListDirlist the contents of a directory
Dotted-underlined cells have explanations β€” click one.

Tip: Measure Then Build (Patterson’s Law)

Before building a new system to fix a problem, measure the old one and demonstrate the problem with experimental evidence. You gain proof you’re solving something real β€” and a ready-made way to show the new system is better.

50.2 Problems with Version 1

The AFS team measured their prototype and found two protocol problems that capped scalability:

  • Path-traversal cost. Because Fetch/Store send the whole pathname (e.g. /home/remzi/notes.txt), the server must walk the directory tree from the root on every request. With many clients, the server burned most of its CPU just traversing paths.
  • Too many TestAuth messages. Just like NFS’s GETATTR flood, clients constantly asked β€œhas my cached file changed?” β€” and most of the time it hadn’t. The server spent much of its time answering β€œno”.

(Two lesser problems: load imbalance across servers β€” fixed by introducing volumes , movable units of files an admin can shift between servers β€” and per-client server processes, whose context-switching was fixed by moving to threads in v2.)

50.3 Improving the Protocol

Together these made the server CPU the bottleneck: each server could handle only about 20 clients before choking on TestAuth traffic and path traversal.

The Crux: How To Design a Scalable File Protocol

How can we redesign the protocol to minimize the number of server interactions (especially TestAuth messages) β€” and make the interactions that remain efficient? Fixing both is the path to a far more scalable AFS.

Check yourself: AFSv1 and whole-file caching

1.What was AFS's overriding design goal, and how does it shape the protocol?

2.What is whole-file caching, AFS's core mechanism?

3.How does AFS's caching differ from NFS's?

4.Measurement revealed two protocol problems that limited AFSv1's scale. What were they?

5.AFSv1 also suffered load imbalance across servers. What mechanism fixed it?

6.The AFS designers followed 'Patterson's Law' before redesigning. What does it say?

6 questions