CephXLI · Metadata Servers (MDS)Metadata Servers (MDS)
The MDS cache and its memory limit
What you'll learn
- Configure the MDS cache memory limit
- Interpret cache pressure warnings
- Diagnose cache-related performance problems
- Size MDS memory for a workload
Prerequisites
None — start here.
Verified against Ceph Tentacle 20.2.x · Ceph Squid 19.2.x (supported previous) · cephadm matches the verified Ceph release · podman 4.x · csi-rbd and csi-cephfs current · RBD / CephFS / RGW current (matches Ceph release) · Linux kernel 5.15+ (5.10 minimum) · Ubuntu 24.04 LTS (Ceph host baseline) · Debian 12 (Bookworm) (Ceph host baseline) · Rocky Linux / RHEL / AlmaLinux 9.x (Ceph host baseline) · Proxmox VE 9.x (cross-course integration) · Kubernetes 1.31+ (cross-course integration) · 2026-08-18
Why this matters in production
Every metadata operation served from cache avoids a metadata pool round trip. Every one served from a miss costs that round trip and occupies the MDS while it waits. The cache size therefore determines MDS throughput more than any other setting, and running it too small is a common and easily corrected mistake.
Configuring
ceph config set mds mds_cache_memory_limit 17179869184 # 16 GiB
ceph config get mds mds_cache_memory_limit
ceph daemon mds.a cache status
{
"pool": { "items": 8412034, "bytes": 14203847168 }
}
The limit is a target, not a hard cap — the MDS trims towards it and can exceed it transiently.
What lives in the cache
| Contents | Notes |
|---|---|
| Inodes | one per file or directory currently referenced |
| Dentries | directory entries |
| Directory fragments | portions of large directories |
| Capability state | per client, per inode |
Capability state is why a client behaving badly affects MDS memory: caps issued to clients are tracked in the MDS, and a client holding millions of them consumes MDS memory it cannot reclaim until the client releases them.
Cache pressure
[WRN] MDS_CACHE_OVERSIZED: 1 MDSs report oversized cache
[WRN] MDS_CLIENT_RECALL: 2 clients failing to respond to cache pressure
The second warning is the important one: the MDS has asked clients to release capabilities so it can trim, and they have not. Common causes:
- A client running a filesystem-wide scan
- A client on an old kernel with recall bugs
- A genuinely busy client legitimately holding a large working set
ceph tell mds.a client ls | \
jq -r '.[] | "\(.id) \(.num_caps) \(.client_metadata.hostname)"' | sort -k2 -rn | head
Bounding client behaviour
ceph config set mds mds_max_caps_per_client 1048576
ceph config set mds mds_recall_max_caps 30000
ceph config set mds mds_recall_max_decay_rate 1.5
The per-client cap limit is the important one. Without it, a single client can drive the MDS out of memory, and the MDS has no recourse but to ask politely.
Sizing
rough guide: 2–4 KB of MDS cache per cached inode
1 million active files ≈ 2–4 GB
plus capability state, plus overhead
Measure rather than estimate:
ceph daemon mds.a cache status
ceph daemon mds.a perf dump | jq '.mds_mem'
ceph daemon mds.a perf dump | jq '.mds.inodes, .mds.inodes_top, .mds.inodes_bottom'
A cache hit rate well below 90% on a workload with a stable working set means the cache is too small.
Quiz
Knowledge check · 4 questions
Q1. The MDS reports MDS_CLIENT_RECALL warnings and its cache stays above the limit. What is happening?
Q2. Setting mds_max_caps_per_client prevents a single client from driving the MDS out of memory.
Q3. Address an MDS that is repeatedly killed by the out-of-memory killer.
An MDS with a 12 GB cache limit is killed by the OOM killer every few days. The host has 32 GB. Before each event, MDS_CLIENT_RECALL warnings appear naming a backup client that scans the whole filesystem nightly.
Q4. Why can the MDS not simply drop cached metadata when it exceeds its limit?
Passing score: 75%. Answers are checked in this browser.
Production discipline
Set mds_max_caps_per_client explicitly on every production
filesystem; the recall mechanism is cooperative and a single scanning
client can otherwise exhaust MDS memory. Monitor cache size against the
limit and treat recall warnings as a precursor to an out-of-memory event
rather than as informational.
Cross-course references
- Kubernetes: an unbounded informer cache exhibits the same unbounded-growth failure
- Linux: NFS delegation recall has the same cooperative, unenforceable character