← Documents Documentation/filesystems/nfs/knfsd-stats.rst GitHub 원문 ↗

Linux 6.18.37 · Filesystems / NFS

Kernel NFS Server Statistics

pool_stats 형식과 nfsd network·thread counter 해석을 설명하는 전문 번역입니다.

Source pathDocumentation/filesystems/nfs/knfsd-stats.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

knfsd-stats.rst:1-122

`/proc/fs/nfsd/pool_stats`는 thread pool별 64-bit 누적 counter를 제공합니다. `packets-arrived`는 network-facing load, `sockets-enqueued`는 즉시 처리할 thread 부족, `threads-woken`은 빠른 dispatch, `threads-timedout`은 장시간 사용되지 않은 여유 thread를 나타냅니다.

Counter는 reset할 수 없고 wrap할 수 있으므로 monitoring application이 자체적으로 시간당 변화율을 계산해야 합니다. `packets-deferred`는 도착 수에서 enqueue와 wake 수를 뺀 값으로 추론합니다.

pool_stats 운영 지표
관찰가능한 판단
sockets-enqueued rate가 지속적으로 높음Nfsd thread 부족 가능성
threads-woken rate가 packets-arrived에 근접Incoming work를 빠르게 dispatch
threads-timedout이 장기간 증가Thread 여유가 클 수 있으나 spike 대비분 확인

주요 counter를 capacity 판단과 연결합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 ============================
2 Kernel NFS Server Statistics
3 ============================
4
5 :Authors: Greg Banks <[email protected]> - 26 Mar 2009
6
7 This document describes the format and semantics of the statistics
8 which the kernel NFS server makes available to userspace. These
9 statistics are available in several text form pseudo files, each of
10 which is described separately below.
11
12 In most cases you don't need to know these formats, as the nfsstat(8)
13 program from the nfs-utils distribution provides a helpful command-line
14 interface for extracting and printing them.
15
16 All the files described here are formatted as a sequence of text lines,
17 separated by newline '\n' characters. Lines beginning with a hash
18 '#' character are comments intended for humans and should be ignored
19 by parsing routines. All other lines contain a sequence of fields
20 separated by whitespace.
21
22 /proc/fs/nfsd/pool_stats
23 ========================
24
25 This file is available in kernels from 2.6.30 onwards, if the
26 /proc/fs/nfsd filesystem is mounted (it almost always should be).
27
28 The first line is a comment which describes the fields present in
29 all the other lines. The other lines present the following data as
30 a sequence of unsigned decimal numeric fields. One line is shown
31 for each NFS thread pool.
32
33 All counters are 64 bits wide and wrap naturally. There is no way
34 to zero these counters, instead applications should do their own
35 rate conversion.
36
37 pool
38 The id number of the NFS thread pool to which this line applies.
39 This number does not change.
40
41 Thread pool ids are a contiguous set of small integers starting
42 at zero. The maximum value depends on the thread pool mode, but
43 currently cannot be larger than the number of CPUs in the system.
44 Note that in the default case there will be a single thread pool
45 which contains all the nfsd threads and all the CPUs in the system,
46 and thus this file will have a single line with a pool id of "0".
47
48 packets-arrived
49 Counts how many NFS packets have arrived. More precisely, this
50 is the number of times that the network stack has notified the
51 sunrpc server layer that new data may be available on a transport
52 (e.g. an NFS or UDP socket or an NFS/RDMA endpoint).
53
54 Depending on the NFS workload patterns and various network stack
55 effects (such as Large Receive Offload) which can combine packets
56 on the wire, this may be either more or less than the number
57 of NFS calls received (which statistic is available elsewhere).
58 However this is a more accurate and less workload-dependent measure
59 of how much CPU load is being placed on the sunrpc server layer
60 due to NFS network traffic.
61
62 sockets-enqueued
63 Counts how many times an NFS transport is enqueued to wait for
64 an nfsd thread to service it, i.e. no nfsd thread was considered
65 available.
66
67 The circumstance this statistic tracks indicates that there was NFS
68 network-facing work to be done but it couldn't be done immediately,
69 thus introducing a small delay in servicing NFS calls. The ideal
70 rate of change for this counter is zero; significantly non-zero
71 values may indicate a performance limitation.
72
73 This can happen because there are too few nfsd threads in the thread
74 pool for the NFS workload (the workload is thread-limited), in which
75 case configuring more nfsd threads will probably improve the
76 performance of the NFS workload.
77
78 threads-woken
79 Counts how many times an idle nfsd thread is woken to try to
80 receive some data from an NFS transport.
81
82 This statistic tracks the circumstance where incoming
83 network-facing NFS work is being handled quickly, which is a good
84 thing. The ideal rate of change for this counter will be close
85 to but less than the rate of change of the packets-arrived counter.
86
87 threads-timedout
88 Counts how many times an nfsd thread triggered an idle timeout,
89 i.e. was not woken to handle any incoming network packets for
90 some time.
91
92 This statistic counts a circumstance where there are more nfsd
93 threads configured than can be used by the NFS workload. This is
94 a clue that the number of nfsd threads can be reduced without
95 affecting performance. Unfortunately, it's only a clue and not
96 a strong indication, for a couple of reasons:
97
98 - Currently the rate at which the counter is incremented is quite
99 slow; the idle timeout is 60 minutes. Unless the NFS workload
100 remains constant for hours at a time, this counter is unlikely
101 to be providing information that is still useful.
102
103 - It is usually a wise policy to provide some slack,
104 i.e. configure a few more nfsds than are currently needed,
105 to allow for future spikes in load.
106
107
108 Note that incoming packets on NFS transports will be dealt with in
109 one of three ways. An nfsd thread can be woken (threads-woken counts
110 this case), or the transport can be enqueued for later attention
111 (sockets-enqueued counts this case), or the packet can be temporarily
112 deferred because the transport is currently being used by an nfsd
113 thread. This last case is not very interesting and is not explicitly
114 counted, but can be inferred from the other counters thus::
115
116 packets-deferred = packets-arrived - ( sockets-enqueued + threads-woken )
117
118
119 More
120 ====
121
122 Descriptions of the other statistics file should go here.
123

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Kernel NFS server 통계 파일의 공통 형식

1-21

Greg Banks가 2009년 3월 26일 작성한 이 문서는 kernel NFS server가 user space에 제공하는 통계의 형식과 의미를 설명합니다. 통계는 여러 text pseudo-file에 나뉘며 각 파일의 형식은 별도로 정의됩니다.

대부분의 사용자는 이 raw 형식을 직접 알 필요가 없습니다. `nfs-utils` 배포판의 `nfsstat(8)`가 통계를 추출하고 출력하는 command-line interface를 제공합니다.

여기서 설명하는 파일은 newline `\n`으로 구분한 text line의 sequence입니다. `#`으로 시작하는 line은 사람을 위한 comment이므로 parser가 무시해야 합니다. 그 밖의 line은 whitespace로 구분한 field sequence입니다.

Kernel NFS 통계 소비 경로
Kernel NFS server가 text pseudo-file 갱신Comment line은 #으로 시작Data line은 whitespace로 field 구분Parser 또는 nfsstat(8)가 읽어 rate와 상태 출력

Pseudo-file의 raw field와 일반 관리 도구의 관계입니다.

============================
Kernel NFS Server Statistics
============================

:Authors: Greg Banks <[email protected]> - 26 Mar 2009

This document describes the format and semantics of the statistics
which the kernel NFS server makes available to userspace.  These
statistics are available in several text form pseudo files, each of
which is described separately below.

In most cases you don't need to know these formats, as the nfsstat(8)
program from the nfs-utils distribution provides a helpful command-line
interface for extracting and printing them.

All the files described here are formatted as a sequence of text lines,
separated by newline '\n' characters.  Lines beginning with a hash
'#' character are comments intended for humans and should be ignored
by parsing routines.  All other lines contain a sequence of fields
separated by whitespace.

/proc/fs/nfsd/pool_stats와 pool field

22-46

`/proc/fs/nfsd/pool_stats`는 `/proc/fs/nfsd` filesystem이 mount된 Linux 2.6.30 이후 kernel에서 사용할 수 있습니다. 첫 line은 뒤따르는 모든 line의 field를 설명하는 comment이고, 각 NFS thread pool마다 unsigned decimal numeric field로 구성된 data line 하나가 나옵니다.

모든 counter는 64-bit이며 overflow 시 자연스럽게 wrap합니다. Counter를 0으로 만드는 interface는 없으므로 application이 두 시점의 차이를 시간으로 나누어 자체적으로 rate를 계산해야 합니다.

`pool` field는 그 line이 나타내는 NFS thread pool의 고정 ID입니다. ID는 0부터 시작하는 연속된 작은 정수이고 최대값은 thread-pool mode에 따라 달라지지만 현재는 system CPU 수보다 클 수 없습니다.

기본 구성에서는 system의 모든 nfsd thread와 CPU를 포함하는 thread pool 하나만 존재하므로 파일에는 `pool` ID가 `0`인 data line 하나가 나타납니다.

pool_stats 기본 구조
구성형식특성
첫 line`#` comment모든 data field 설명
Pool lineUnsigned decimal fieldsThread pool마다 하나
Counter64-bit자연 wrap, reset 불가
`pool`0부터 연속된 ID기본 구성은 pool 0 하나

Header와 pool별 data line의 의미입니다.

/proc/fs/nfsd/pool_stats
========================

This file is available in kernels from 2.6.30 onwards, if the
/proc/fs/nfsd filesystem is mounted (it almost always should be).

The first line is a comment which describes the fields present in
all the other lines.  The other lines present the following data as
a sequence of unsigned decimal numeric fields.  One line is shown
for each NFS thread pool.

All counters are 64 bits wide and wrap naturally.  There is no way
to zero these counters, instead applications should do their own
rate conversion.

pool
        The id number of the NFS thread pool to which this line applies.
        This number does not change.

        Thread pool ids are a contiguous set of small integers starting
        at zero.  The maximum value depends on the thread pool mode, but
        currently cannot be larger than the number of CPUs in the system.
        Note that in the default case there will be a single thread pool
        which contains all the nfsd threads and all the CPUs in the system,
        and thus this file will have a single line with a pool id of "0".

packets-arrived와 sockets-enqueued

47-77

`packets-arrived`는 NFS packet이 도착한 횟수를 셉니다. 정확히는 network stack이 SUNRPC server layer에 transport에서 새 data를 읽을 수 있다고 알린 횟수입니다. Transport는 NFS 또는 UDP socket이나 NFS/RDMA endpoint일 수 있습니다.

NFS workload pattern과 Large Receive Offload처럼 wire packet을 합치는 network-stack 효과 때문에 이 값은 수신한 NFS call 수보다 많거나 적을 수 있습니다. 그럼에도 NFS network traffic이 SUNRPC server layer에 가하는 CPU load를 call 수보다 정확하고 workload 의존성이 낮게 나타냅니다.

`sockets-enqueued`는 service할 수 있는 nfsd thread가 없다고 판단되어 NFS transport가 queue에 들어간 횟수입니다. Network-facing NFS work가 있었지만 즉시 처리하지 못해 call service에 작은 delay가 생겼다는 뜻입니다.

이 counter의 이상적인 변화율은 0입니다. 유의미한 증가가 계속되면 performance limitation일 수 있으며, workload에 비해 pool의 nfsd thread가 너무 적은 thread-limited 상황이라면 nfsd thread 수를 늘려 성능을 개선할 가능성이 큽니다.

Network-facing counter 해석
Counter세는 사건운영 해석
`packets-arrived`SUNRPC layer가 새 transport data 통지를 받은 횟수Network traffic이 주는 CPU load 지표
`sockets-enqueued`가용 nfsd thread가 없어 transport를 queue에 넣은 횟수이상적 rate 0, 지속 증가는 thread 부족 가능성

도착 부하와 즉시 처리 실패를 구분합니다.


packets-arrived
        Counts how many NFS packets have arrived.  More precisely, this
        is the number of times that the network stack has notified the
        sunrpc server layer that new data may be available on a transport
        (e.g. an NFS or UDP socket or an NFS/RDMA endpoint).

        Depending on the NFS workload patterns and various network stack
        effects (such as Large Receive Offload) which can combine packets
        on the wire, this may be either more or less than the number
        of NFS calls received (which statistic is available elsewhere).
        However this is a more accurate and less workload-dependent measure
        of how much CPU load is being placed on the sunrpc server layer
        due to NFS network traffic.

sockets-enqueued
        Counts how many times an NFS transport is enqueued to wait for
        an nfsd thread to service it, i.e. no nfsd thread was considered
        available.

        The circumstance this statistic tracks indicates that there was NFS
        network-facing work to be done but it couldn't be done immediately,
        thus introducing a small delay in servicing NFS calls.  The ideal
        rate of change for this counter is zero; significantly non-zero
        values may indicate a performance limitation.

        This can happen because there are too few nfsd threads in the thread
        pool for the NFS workload (the workload is thread-limited), in which
        case configuring more nfsd threads will probably improve the
        performance of the NFS workload.

threads-woken과 threads-timedout

78-107

`threads-woken`은 idle nfsd thread를 깨워 NFS transport에서 data를 받도록 시도한 횟수입니다. 들어오는 network-facing NFS work를 빠르게 처리한 경우이므로 좋은 신호이며, 이상적인 변화율은 `packets-arrived` 변화율에 가깝되 그보다 조금 작습니다.

`threads-timedout`은 nfsd thread가 일정 시간 incoming network packet 처리를 위해 깨어나지 못해 idle timeout을 발생시킨 횟수입니다. Workload가 사용할 수 있는 것보다 nfsd thread를 많이 구성했을 가능성을 보여 주므로 성능 영향 없이 thread 수를 줄일 수 있다는 단서입니다.

다만 강한 결론으로 사용하면 안 됩니다. 현재 idle timeout은 60분이라 counter 증가가 매우 느리고, workload가 여러 시간 일정하지 않으면 값이 이미 낡은 상황을 반영할 수 있습니다. 또한 향후 load spike를 흡수하도록 현재 필요량보다 nfsd를 조금 더 두는 것이 보통 현명한 운영 정책입니다.

Nfsd thread counter 해석
Counter증가 조건해석 주의
`threads-woken`Idle nfsd를 깨워 transport 수신 시도`packets-arrived`보다 약간 낮은 rate가 이상적
`threads-timedout`60분 동안 work 없이 idle timeout과다 thread의 단서지만 workload 변화와 여유 capacity 고려

빠른 dispatch와 장시간 미사용 thread를 구분합니다.

threads-woken
        Counts how many times an idle nfsd thread is woken to try to
        receive some data from an NFS transport.

        This statistic tracks the circumstance where incoming
        network-facing NFS work is being handled quickly, which is a good
        thing.  The ideal rate of change for this counter will be close
        to but less than the rate of change of the packets-arrived counter.

threads-timedout
        Counts how many times an nfsd thread triggered an idle timeout,
        i.e. was not woken to handle any incoming network packets for
        some time.

        This statistic counts a circumstance where there are more nfsd
        threads configured than can be used by the NFS workload.  This is
        a clue that the number of nfsd threads can be reduced without
        affecting performance.  Unfortunately, it's only a clue and not
        a strong indication, for a couple of reasons:

         - Currently the rate at which the counter is incremented is quite
           slow; the idle timeout is 60 minutes.  Unless the NFS workload
           remains constant for hours at a time, this counter is unlikely
           to be providing information that is still useful.

         - It is usually a wise policy to provide some slack,
           i.e. configure a few more nfsds than are currently needed,
           to allow for future spikes in load.

Transport 처리 세 경로와 packets-deferred

108-122

NFS transport에 들어온 packet은 세 방식 가운데 하나로 처리됩니다. Idle nfsd thread를 깨우면 `threads-woken`, 가용 thread가 없어 transport를 나중 처리를 위해 queue에 넣으면 `sockets-enqueued`가 증가합니다.

세 번째는 transport를 현재 다른 nfsd thread가 사용 중이어서 packet 처리를 잠시 defer하는 경우입니다. 이 사건은 별도 counter로 기록하지 않지만 다른 counter의 차이로 계산할 수 있습니다.

packets-deferred = packets-arrived - (sockets-enqueued + threads-woken)

마지막 `More` 절은 다른 statistics file의 설명이 이 위치에 추가되어야 한다는 placeholder입니다. 따라서 현재 문서는 `/proc/fs/nfsd/pool_stats` 형식과 field에 집중합니다.

Incoming packet의 세 처리 경로
NFS transport에 packet 도착Idle thread wake: threads-wokenThread 부재로 queue: sockets-enqueuedTransport 사용 중 임시 지연: packets-deferred

`packets-arrived`를 두 직접 counter와 한 추론 값으로 분해합니다.

Note that incoming packets on NFS transports will be dealt with in
one of three ways.  An nfsd thread can be woken (threads-woken counts
this case), or the transport can be enqueued for later attention
(sockets-enqueued counts this case), or the packet can be temporarily
deferred because the transport is currently being used by an nfsd
thread.  This last case is not very interesting and is not explicitly
counted, but can be inferred from the other counters thus::

        packets-deferred = packets-arrived - ( sockets-enqueued + threads-woken )


More
====

Descriptions of the other statistics file should go here.