The simple version
The first time you visit a café, you read the whole menu. The second time, you already know what you want. A cache is remembering the menu, but only if you come back.
Ways to cache
- Explicit staging: copy to
/scratch(rsync, cp, sbcast) and read from there. Simple and predictable. - FS-Cache (
cachefilesd) for NFS: transparent local caching of NFS file data. - Lustre Persistent Client Cache (PCC): keeps files on client-local storage under Lustre's control, in newer Lustre releases.
- Dataset cache layers such as Alluxio: a distributed cache in front of object or file storage.
Hit-ratio math
A 1.8 TB dataset at 2.2 GB/s from NFS takes ~14 minutes to warm. After that each epoch reads locally at up to ~7 GB/s per drive. For a 20-epoch job, warming once is cheap; for a single pass, it only adds time.
When caching doesn't help
- The working set is bigger than local space (it thrashes).
- Every node reads different data and never re-reads it.
- Data changes faster than the cache can stay consistent.
Watch for "fast on some nodes, slow on others": that's usually warm vs cold caches (Lab 7.2).
Tools
rsync -a SRC/ /scratch/cache/NAME/Warm a node-local cache explicitly.
cachefilesdFS-Cache daemon for NFS client caching.
df -h /scratchCheck local space before caching.
Quiz
Lab
Lab 7.2 · Cold cache on a new node
The same training job runs on gpu-a with GPUs 100% busy, but on the newly added gpu-f they sit idle more than half the time. On each node the job reads /scratch/cache/video-shards if it exists, otherwise /nas/datasets/video-shards.
Try it now in the simulator (opens with the command ready; press Enter):
$ ls -lh /nas/datasets$ rsync -a /nas/datasets/video-shards/ /scratch/cache/video-shards/$ simtrain --data /scratch/cache/video-shards --workers 8