Skip to content

Commit 0abf63a

Browse files
MichaelCuevasmeta-codesync[bot]
authored andcommitted
nfs: Add inflight request depth instrumentation
Summary: Add lightweight instrumentation to measure NFS thread pool queue depth at request arrival time. A new `nfs.inflight_at_request` counter records the number of requests currently inside dispatchRpc as each new request enters. This produces `nfs.inflight_at_request.avg.60` (average queue depth at request arrival), `.count.60` (request arrival rate), and `.sum.60` in ODS. These signals are needed to validate the JUKEBOX backpressure threshold during rollout — specifically to detect false positives (JUKEBOX firing during low queue depth) and confirm the threshold is well-calibrated. Reviewed By: giorgidze Differential Revision: D100398610 fbshipit-source-id: 9c485a4e7606e47e6364922a29a0a087789a7540
1 parent 6966a21 commit 0abf63a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

eden/fs/nfs/Nfsd3.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ class Nfsd3ServerProcessor final : public RpcServerProcessor {
218218
*/
219219
std::chrono::nanoseconds longRunningFSRequestThreshold_;
220220
bool fastPathRPCs_;
221+
std::atomic<size_t> inflightRequests_{0};
221222
// Used to check rate limiting. Set once in constructor via setFsChannel().
222223
// Nulled in onShutdown() before Nfsd3 destruction. The backpressure check
223224
// in dispatchRpc tests for nullptr before dereferencing.
@@ -2246,6 +2247,10 @@ ImmediateFuture<folly::Unit> Nfsd3ServerProcessor::dispatchRpc(
22462247
return folly::unit;
22472248
}
22482249

2250+
auto depth = inflightRequests_.fetch_add(1, std::memory_order_relaxed);
2251+
dispatcher_->getStats()->increment(
2252+
&NfsStats::nfsInflightAtRequest, depth + 1);
2253+
22492254
auto& handlerEntry = kNfs3dHandlers[procNumber];
22502255
FB_LOGF(
22512256
*straceLogger_,
@@ -2301,8 +2306,11 @@ ImmediateFuture<folly::Unit> Nfsd3ServerProcessor::dispatchRpc(
23012306
}
23022307
return res;
23032308
})
2304-
.ensure([liveRequest = std::move(liveRequest),
2305-
context = std::move(context)]() {});
2309+
.ensure([this,
2310+
liveRequest = std::move(liveRequest),
2311+
context = std::move(context)]() {
2312+
inflightRequests_.fetch_sub(1, std::memory_order_relaxed);
2313+
});
23062314
}
23072315

23082316
void Nfsd3ServerProcessor::onShutdown(RpcStopData data) {

eden/fs/telemetry/EdenStats.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ struct NfsStats : StatsGroup<NfsStats> {
350350

351351
// Backpressure
352352
Counter nfsBackpressureJukebox{"nfs.backpressure_jukebox"};
353+
Counter nfsInflightAtRequest{"nfs.inflight_at_request"};
353354

354355
// Phase timing (aggregate across all NFS procedures)
355356
Duration nfsPhaseAccept{"nfs.phase_accept_us"};

0 commit comments

Comments
 (0)