Project

General

Profile

Actions

Enhancement #79953

closed
DV DV

mds: account for where a rank's mds_lock time goes (phase times)

Enhancement #79953: mds: account for where a rank's mds_lock time goes (phase times)

Added by Dan van der Ster 3 months ago. Updated about 1 month ago.

Status:
Resolved
Priority:
Normal
Category:
Performance/Resource Usage
Target version:
Due date:
% Done:

0%

Source:
Community (dev)
Backport:
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
MDS
Labels (FS):
Pull request ID:
Tags (freeform):
Fixed In:
v21.3.0-4636-g41d003a0b4
Released In:
Upkeep Timestamp:
2026-10-19T10:26:01+00:00

Description

Nearly everything an MDS rank does is serialized by mds_lock: messages dispatched by the messenger threads, journal completions run by the finisher, the periodic tick, cache trim, client recall and log trim all take it. That makes mds_lock -- rather than any one thread -- the resource a busy rank exhausts first, and it is why a rank rarely uses much more than one core.

Today there is no way to ask how much of the wall clock a rank spends holding mds_lock, or on what. That leaves an operator unable to tell a rank that is serialization-bound on client work (scale out) from one thrashing its cache (scale up) from one merely waiting on the metadata pool (neither will help).

This adds MDSPhaseTracker, which charges exclusive wall time to a phase -- client requests, cap handling, IO completions, subtree import/export, cache trim, client recall, log trim, and so on -- via an RAII timer at the choke points each kind of work already passes through. Timers nest and nested time is subtracted from the parent, so cache_trim is the time actually spent trimming rather than trimming plus whatever it dispatched into. fair_mutex gains opt-in wait/hold accounting so mds_lock utilization is reported directly alongside the phases.

Totals land in a new "mds_phase" perf counters section, and therefore in mgr/prometheus. A `ceph tell mds.X dump phase times` asok command gives the one-shot human view: phases sorted by time spent, each with its share of the wall clock, plus mds_lock utilization.

Off by default (mds_enable_phase_tracker, runtime adjustable). Enabling costs two clock reads per instrumented scope and three per mds_lock acquisition -- a few hundred nanoseconds of serialized work per client request where clock_gettime is a vDSO read. With it off the cost is a relaxed load of a bool per lock acquisition.

DV Updated by Dan van der Ster 3 months ago Actions #1

  • Status changed from New to Fix Under Review
  • Pull request ID set to 71371

VS Updated by Venky Shankar 3 months ago Actions #2

  • Target version set to v22.0.0
  • Source set to Community (dev)

UB Updated by Upkeep Bot about 1 month ago Actions #3

  • Status changed from Fix Under Review to Resolved
  • Merge Commit set to 41d003a0b4070f757850787256b2a2a9f3b937ad
  • Fixed In set to v21.3.0-4636-g41d003a0b4
  • Upkeep Timestamp set to 2026-10-19T10:26:01+00:00
Actions

Also available in: PDF Atom