Curriculum / Part 7 · Kubernetes, schedulers and data locality
Lesson 33

Caching layers

Node-local caches for datasets and weights: options, cache-hit math, warm-up, and when caching won't help.

⏱ 30 min5-question quizLab 7.2

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

effective rate ≈ hit × local + (1 − hit) × remote
warm-up time ≈ working set ÷ remote rate

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.
cachefilesd
FS-Cache daemon for NFS client caching.
df -h /scratch
Check 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.

Start lab 7.2 →