Curriculum / Part 4 · Parallel filesystems
Lesson 19

Metadata at scale

Why ls on a million-file directory hurts, how to measure metadata rates, Lustre DNE, and practical small-file strategies.

⏱ 35 min5-question quiz

The simple version

Finding a book's shelf takes a few seconds. Doing that for a million books takes days, even if each book is tiny. Metadata work is counted in operations, not bytes.

Metadata operations

Opening a file typically involves a lookup, a permission check and an open; reading attributes is a stat; listing a directory is readdir plus, for ls -l, a stat per entry. On a parallel filesystem each can be a network round trip to a metadata server.

time ≈ files × operations per file ÷ metadata ops/s

1.28 M files × 3 ops ÷ 50,000 ops/s ≈ 77 s per pass, before reading a single byte of data.

Cheaper habits

  • ls -f (or ls -U) skips sorting; plain ls -l on a huge directory stats every entry.
  • lfs find uses Lustre-aware lookups and is usually faster than find on Lustre.
  • Don't put millions of files in one directory; spread them, or better, pack them into shards (Lesson 12).

Scaling metadata

Lustre's Distributed Namespace (DNE) spreads metadata across multiple MDTs: whole directories can live on different MDTs, and a single large directory can be striped across several (lfs mkdir -c N). Data-on-MDT keeps very small files on the MDT itself, saving a trip to an OST.

Measure, don't guess: mdtest (part of the IOR benchmark suite) creates, stats and removes many files across many clients and reports operations per second.

Tools

mdtest
Metadata benchmark from the IOR project: create/stat/remove rates.
ls -f / ls -U
List without sorting; avoids per-entry work on huge directories.
lfs find
Lustre-aware find.
lfs mkdir -c N DIR
Create a directory striped across N MDTs (DNE).

Quiz

Lab

Related lab

Lab 3.1 · Starved dataloader

A vision model trains from /lustre/datasets/imagenet-raw: 1.28 million JPEGs averaging 110 KiB. nvidia-smi shows the GPUs mostly idle. The same images also exist as 1,024 tar shards in /lustre/datasets/imagenet-shards.

Start lab 3.1 →

Try it now in the simulator (opens with the command ready; press Enter):

$ ls -lh /lustre/datasets/imagenet-raw$ simtrain --data /lustre/datasets/imagenet-raw --workers 64