← Documents Documentation/mm/damon/monitoring_intervals_tuning_example.rst GitHub 원문 ↗

Linux 6.18.37 · Memory management

DAMON Monitoring Interval Parameters Tuning Example

실제 server workload에서 sampling·aggregation interval을 단계적으로 늘리며 region 분해와 hot·cold 탐지 품질을 비교합니다.

Source pathDocumentation/mm/damon/monitoring_intervals_tuning_example.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

monitoring_intervals_tuning_example.rst:1-247

같은 1:20 비율을 유지해도 absolute interval이 너무 짧으면 aggregation마다 의미 있는 접근량이 쌓이지 않아 region이 기본 최소 개수와 비슷한 큰 덩어리에 머뭅니다. Interval을 늘리면 작은 hot region과 오래 유지된 cold region이 분리되지만, 지나치게 늘리면 hot 쪽 편향이 생길 수 있습니다.

Interval별 관찰 결과
Sampling / aggregation관찰판정
5ms / 100ms10개 region, 모두 access 0%, 최대 age 약 6초너무 짧음
100ms / 2shot 4 KiB region 2개와 수분 단위 age작은 hot region 분리 시작
400ms / 8sregion 수·크기·빈도 다양성 크게 증가의미 있는 관리에 유망
800ms / 16snon-zero region 증가, region 수 감소hot 쪽 편향 시작

62 GiB 물리 메모리에서 네 설정의 region 분해와 탐지 특성을 비교합니다.

Access temperature 해석
상태Temperature 방향정렬 위치
오랫동안 미접근더 큰 음수위쪽, 가장 cold
최근까지 미접근작은 음수중간
자주 접근양수아래쪽, 가장 hot

Temperature는 접근 빈도와 age의 가중합이며 0% 접근에는 음수 부호가 붙습니다.

Interval 조정 판단
모두 비슷한 큰 regionaggregation interval 증가작은 hot region 분리다양한 region 확보
hot 쪽 편향·cold 탐지 저하interval을 직전 수준으로 낮춤목적에 맞는 절충점 선택

Region 다양성과 hot·cold 분리 품질을 함께 보며 aggregation interval을 조정합니다.

실험의 핵심 지표
지표의미
Region 수`min_nr_regions` 근처면 분해가 부족할 수 있음
Region 크기 다양성Adaptive adjustment의 분해 정도
`nr_accesses` 분포Hotness 구분 해상도
`age` 범위접근 패턴 유지 시간과 최근성
Histogram전체 메모리의 temperature 분포

출력에서 조정 성공 여부를 판단할 때 함께 확인할 항목입니다.

권장 실험 순서
단계작업
1동일한 sampling/aggregation 비율로 시작
2충분히 기다린 뒤 동일 방식으로 snapshot 수집
3Temperature 정렬과 histogram을 함께 비교
4Region 다양성이 부족하면 interval 증가
5Hot·cold 한쪽 편향이 시작되기 전 값을 선택

이 예제의 측정 절차를 재사용 가능한 단계로 정리했습니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =================================================
4 DAMON Moniting Interval Parameters Tuning Example
5 =================================================
6
7 DAMON's monitoring parameters need tuning based on given workload and the
8 monitoring purpose. There is a :ref:`tuning guide
9 <damon_design_monitoring_params_tuning_guide>` for that. This document
10 provides an example tuning based on the guide.
11
12 Setup
13 =====
14
15 For below example, DAMON of Linux kernel v6.11 and `damo
16 <https://github.com/damonitor/damo>`_ (DAMON user-space tool) v2.5.9 was used to
17 monitor and visualize access patterns on the physical address space of a system
18 running a real-world server workload.
19
20 5ms/100ms intervals: Too Short Interval
21 =======================================
22
23 Let's start by capturing the access pattern snapshot on the physical address
24 space of the system using DAMON, with the default interval parameters (5
25 milliseconds and 100 milliseconds for the sampling and the aggregation
26 intervals, respectively). Wait ten minutes between the start of DAMON and
27 the capturing of the snapshot, to show a meaningful time-wise access patterns.
28 ::
29
30 # damo start
31 # sleep 600
32 # damo record --snapshot 0 1
33 # damo stop
34
35 Then, list the DAMON-found regions of different access patterns, sorted by the
36 "access temperature". "Access temperature" is a metric representing the
37 access-hotness of a region. It is calculated as a weighted sum of the access
38 frequency and the age of the region. If the access frequency is 0 %, the
39 temperature is multiplied by minus one. That is, if a region is not accessed,
40 it gets minus temperature and it gets lower as not accessed for longer time.
41 The sorting is in temperature-ascendint order, so the region at the top of the
42 list is the coldest, and the one at the bottom is the hottest one. ::
43
44 # damo report access --sort_regions_by temperature
45 0 addr 16.052 GiB size 5.985 GiB access 0 % age 5.900 s # coldest
46 1 addr 22.037 GiB size 6.029 GiB access 0 % age 5.300 s
47 2 addr 28.065 GiB size 6.045 GiB access 0 % age 5.200 s
48 3 addr 10.069 GiB size 5.983 GiB access 0 % age 4.500 s
49 4 addr 4.000 GiB size 6.069 GiB access 0 % age 4.400 s
50 5 addr 62.008 GiB size 3.992 GiB access 0 % age 3.700 s
51 6 addr 56.795 GiB size 5.213 GiB access 0 % age 3.300 s
52 7 addr 39.393 GiB size 6.096 GiB access 0 % age 2.800 s
53 8 addr 50.782 GiB size 6.012 GiB access 0 % age 2.800 s
54 9 addr 34.111 GiB size 5.282 GiB access 0 % age 2.300 s
55 10 addr 45.489 GiB size 5.293 GiB access 0 % age 1.800 s # hottest
56 total size: 62.000 GiB
57
58 The list shows not seemingly hot regions, and only minimum access pattern
59 diversity. Every region has zero access frequency. The number of region is
60 10, which is the default ``min_nr_regions value``. Size of each region is also
61 nearly identical. We can suspect this is because “adaptive regions adjustment”
62 mechanism was not well working. As the guide suggested, we can get relative
63 hotness of regions using ``age`` as the recency information. That would be
64 better than nothing, but given the fact that the longest age is only about 6
65 seconds while we waited about ten minutes, it is unclear how useful this will
66 be.
67
68 The temperature ranges to total size of regions of each range histogram
69 visualization of the results also shows no interesting distribution pattern. ::
70
71 # damo report access --style temperature-sz-hist
72 <temperature> <total size>
73 [-,590,000,000, -,549,000,000) 5.985 GiB |********** |
74 [-,549,000,000, -,508,000,000) 12.074 GiB |********************|
75 [-,508,000,000, -,467,000,000) 0 B | |
76 [-,467,000,000, -,426,000,000) 12.052 GiB |********************|
77 [-,426,000,000, -,385,000,000) 0 B | |
78 [-,385,000,000, -,344,000,000) 3.992 GiB |******* |
79 [-,344,000,000, -,303,000,000) 5.213 GiB |********* |
80 [-,303,000,000, -,262,000,000) 12.109 GiB |********************|
81 [-,262,000,000, -,221,000,000) 5.282 GiB |********* |
82 [-,221,000,000, -,180,000,000) 0 B | |
83 [-,180,000,000, -,139,000,000) 5.293 GiB |********* |
84 total size: 62.000 GiB
85
86 In short, the parameters provide poor quality monitoring results for hot
87 regions detection. According to the :ref:`guide
88 <damon_design_monitoring_params_tuning_guide>`, this is due to the too short
89 aggregation interval.
90
91 100ms/2s intervals: Starts Showing Small Hot Regions
92 ====================================================
93
94 Following the guide, increase the interval 20 times (100 milliseocnds and 2
95 seconds for sampling and aggregation intervals, respectively). ::
96
97 # damo start -s 100ms -a 2s
98 # sleep 600
99 # damo record --snapshot 0 1
100 # damo stop
101 # damo report access --sort_regions_by temperature
102 0 addr 10.180 GiB size 6.117 GiB access 0 % age 7 m 8 s # coldest
103 1 addr 49.275 GiB size 6.195 GiB access 0 % age 6 m 14 s
104 2 addr 62.421 GiB size 3.579 GiB access 0 % age 6 m 4 s
105 3 addr 40.154 GiB size 6.127 GiB access 0 % age 5 m 40 s
106 4 addr 16.296 GiB size 6.182 GiB access 0 % age 5 m 32 s
107 5 addr 34.254 GiB size 5.899 GiB access 0 % age 5 m 24 s
108 6 addr 46.281 GiB size 2.995 GiB access 0 % age 5 m 20 s
109 7 addr 28.420 GiB size 5.835 GiB access 0 % age 5 m 6 s
110 8 addr 4.000 GiB size 6.180 GiB access 0 % age 4 m 16 s
111 9 addr 22.478 GiB size 5.942 GiB access 0 % age 3 m 58 s
112 10 addr 55.470 GiB size 915.645 MiB access 0 % age 3 m 6 s
113 11 addr 56.364 GiB size 6.056 GiB access 0 % age 2 m 8 s
114 12 addr 56.364 GiB size 4.000 KiB access 95 % age 16 s
115 13 addr 49.275 GiB size 4.000 KiB access 100 % age 8 m 24 s # hottest
116 total size: 62.000 GiB
117 # damo report access --style temperature-sz-hist
118 <temperature> <total size>
119 [-42,800,000,000, -33,479,999,000) 22.018 GiB |***************** |
120 [-33,479,999,000, -24,159,998,000) 27.090 GiB |********************|
121 [-24,159,998,000, -14,839,997,000) 6.836 GiB |****** |
122 [-14,839,997,000, -5,519,996,000) 6.056 GiB |***** |
123 [-5,519,996,000, 3,800,005,000) 4.000 KiB |* |
124 [3,800,005,000, 13,120,006,000) 0 B | |
125 [13,120,006,000, 22,440,007,000) 0 B | |
126 [22,440,007,000, 31,760,008,000) 0 B | |
127 [31,760,008,000, 41,080,009,000) 0 B | |
128 [41,080,009,000, 50,400,010,000) 0 B | |
129 [50,400,010,000, 59,720,011,000) 4.000 KiB |* |
130 total size: 62.000 GiB
131
132 DAMON found two distinct 4 KiB regions that pretty hot. The regions are also
133 well aged. The hottest 4 KiB region was keeping the access frequency for about
134 8 minutes, and the coldest region was keeping no access for about 7 minutes.
135 The distribution on the histogram also looks like having a pattern.
136
137 Especially, the finding of the 4 KiB regions among the 62 GiB total memory
138 shows DAMON’s adaptive regions adjustment is working as designed.
139
140 Still the number of regions is close to the ``min_nr_regions``, and sizes of
141 cold regions are similar, though. Apparently it is improved, but it still has
142 rooms to improve.
143
144 400ms/8s intervals: Pretty Improved Results
145 ===========================================
146
147 Increase the intervals four times (400 milliseconds and 8 seconds
148 for sampling and aggregation intervals, respectively). ::
149
150 # damo start -s 400ms -a 8s
151 # sleep 600
152 # damo record --snapshot 0 1
153 # damo stop
154 # damo report access --sort_regions_by temperature
155 0 addr 64.492 GiB size 1.508 GiB access 0 % age 6 m 48 s # coldest
156 1 addr 21.749 GiB size 5.674 GiB access 0 % age 6 m 8 s
157 2 addr 27.422 GiB size 5.801 GiB access 0 % age 6 m
158 3 addr 49.431 GiB size 8.675 GiB access 0 % age 5 m 28 s
159 4 addr 33.223 GiB size 5.645 GiB access 0 % age 5 m 12 s
160 5 addr 58.321 GiB size 6.170 GiB access 0 % age 5 m 4 s
161 [...]
162 25 addr 6.615 GiB size 297.531 MiB access 15 % age 0 ns
163 26 addr 9.513 GiB size 12.000 KiB access 20 % age 0 ns
164 27 addr 9.511 GiB size 108.000 KiB access 25 % age 0 ns
165 28 addr 9.513 GiB size 20.000 KiB access 25 % age 0 ns
166 29 addr 9.511 GiB size 12.000 KiB access 30 % age 0 ns
167 30 addr 9.520 GiB size 4.000 KiB access 40 % age 0 ns
168 [...]
169 41 addr 9.520 GiB size 4.000 KiB access 80 % age 56 s
170 42 addr 9.511 GiB size 12.000 KiB access 100 % age 6 m 16 s
171 43 addr 58.321 GiB size 4.000 KiB access 100 % age 6 m 24 s
172 44 addr 9.512 GiB size 4.000 KiB access 100 % age 6 m 48 s
173 45 addr 58.106 GiB size 4.000 KiB access 100 % age 6 m 48 s # hottest
174 total size: 62.000 GiB
175 # damo report access --style temperature-sz-hist
176 <temperature> <total size>
177 [-40,800,000,000, -32,639,999,000) 21.657 GiB |********************|
178 [-32,639,999,000, -24,479,998,000) 17.938 GiB |***************** |
179 [-24,479,998,000, -16,319,997,000) 16.885 GiB |**************** |
180 [-16,319,997,000, -8,159,996,000) 586.879 MiB |* |
181 [-8,159,996,000, 5,000) 4.946 GiB |***** |
182 [5,000, 8,160,006,000) 260.000 KiB |* |
183 [8,160,006,000, 16,320,007,000) 0 B | |
184 [16,320,007,000, 24,480,008,000) 0 B | |
185 [24,480,008,000, 32,640,009,000) 0 B | |
186 [32,640,009,000, 40,800,010,000) 16.000 KiB |* |
187 [40,800,010,000, 48,960,011,000) 8.000 KiB |* |
188 total size: 62.000 GiB
189
190 The number of regions having different access patterns has significantly
191 increased. Size of each region is also more varied. Total size of non-zero
192 access frequency regions is also significantly increased. Maybe this is already
193 good enough to make some meaningful memory management efficiency changes.
194
195 800ms/16s intervals: Another bias
196 =================================
197
198 Further double the intervals (800 milliseconds and 16 seconds for sampling
199 and aggregation intervals, respectively). The results is more improved for the
200 hot regions detection, but starts looking degrading cold regions detection. ::
201
202 # damo start -s 800ms -a 16s
203 # sleep 600
204 # damo record --snapshot 0 1
205 # damo stop
206 # damo report access --sort_regions_by temperature
207 0 addr 64.781 GiB size 1.219 GiB access 0 % age 4 m 48 s
208 1 addr 24.505 GiB size 2.475 GiB access 0 % age 4 m 16 s
209 2 addr 26.980 GiB size 504.273 MiB access 0 % age 4 m
210 3 addr 29.443 GiB size 2.462 GiB access 0 % age 4 m
211 4 addr 37.264 GiB size 5.645 GiB access 0 % age 4 m
212 5 addr 31.905 GiB size 5.359 GiB access 0 % age 3 m 44 s
213 [...]
214 20 addr 8.711 GiB size 40.000 KiB access 5 % age 2 m 40 s
215 21 addr 27.473 GiB size 1.970 GiB access 5 % age 4 m
216 22 addr 48.185 GiB size 4.625 GiB access 5 % age 4 m
217 23 addr 47.304 GiB size 902.117 MiB access 10 % age 4 m
218 24 addr 8.711 GiB size 4.000 KiB access 100 % age 4 m
219 25 addr 20.793 GiB size 3.713 GiB access 5 % age 4 m 16 s
220 26 addr 8.773 GiB size 4.000 KiB access 100 % age 4 m 16 s
221 total size: 62.000 GiB
222 # damo report access --style temperature-sz-hist
223 <temperature> <total size>
224 [-28,800,000,000, -23,359,999,000) 12.294 GiB |***************** |
225 [-23,359,999,000, -17,919,998,000) 9.753 GiB |************* |
226 [-17,919,998,000, -12,479,997,000) 15.131 GiB |********************|
227 [-12,479,997,000, -7,039,996,000) 0 B | |
228 [-7,039,996,000, -1,599,995,000) 7.506 GiB |********** |
229 [-1,599,995,000, 3,840,006,000) 6.127 GiB |********* |
230 [3,840,006,000, 9,280,007,000) 0 B | |
231 [9,280,007,000, 14,720,008,000) 136.000 KiB |* |
232 [14,720,008,000, 20,160,009,000) 40.000 KiB |* |
233 [20,160,009,000, 25,600,010,000) 11.188 GiB |*************** |
234 [25,600,010,000, 31,040,011,000) 4.000 KiB |* |
235 total size: 62.000 GiB
236
237 It found more non-zero access frequency regions. The number of regions is still
238 much higher than the ``min_nr_regions``, but it is reduced from that of the
239 previous setup. And apparently the distribution seems bit biased to hot
240 regions.
241
242 Conclusion
243 ==========
244
245 With the above experimental tuning results, we can conclude the theory and the
246 guide makes sense to at least this workload, and could be applied to similar
247 cases.
248

3. 한국어 전문 번역

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

목적과 시험 환경

1-18

DAMON 모니터링 매개변수는 workload와 모니터링 목적에 맞게 조정해야 합니다. 이 문서는 monitoring parameter tuning guide를 실제로 적용한 예를 제공합니다.

예제는 Linux kernel v6.11의 DAMON과 DAMON 사용자 공간 도구 `damo` v2.5.9를 사용해 실제 server workload가 실행 중인 시스템의 물리 주소 공간 접근 패턴을 모니터링하고 시각화했습니다.

.. SPDX-License-Identifier: GPL-2.0

=================================================
DAMON Moniting Interval Parameters Tuning Example
=================================================

DAMON's monitoring parameters need tuning based on given workload and the
monitoring purpose.  There is a :ref:`tuning guide
<damon_design_monitoring_params_tuning_guide>` for that.  This document
provides an example tuning based on the guide.

Setup
=====

For below example, DAMON of Linux kernel v6.11 and `damo
<https://github.com/damonitor/damo>`_ (DAMON user-space tool) v2.5.9 was used to
monitor and visualize access patterns on the physical address space of a system
running a real-world server workload.

5ms/100ms: 너무 짧은 interval

19-90

먼저 기본 매개변수인 sampling 5ms와 aggregation 100ms로 시스템 물리 주소 공간의 접근 패턴 snapshot을 수집합니다. 시간에 따른 의미 있는 패턴이 나타나도록 DAMON을 시작한 뒤 snapshot을 얻기 전까지 10분 기다립니다.

# damo start
# sleep 600
# damo record --snapshot 0 1
# damo stop

그다음 DAMON이 찾은 서로 다른 접근 패턴의 region을 `access temperature` 순서로 나열합니다. Access temperature는 region의 접근 빈도와 `age`를 가중합해 접근 열도를 나타냅니다. 접근 빈도가 0%이면 temperature에 -1을 곱하므로 접근되지 않은 region은 음수가 되고, 접근되지 않은 기간이 길수록 더 낮아집니다. 오름차순 정렬에서 맨 위가 가장 cold하고 맨 아래가 가장 hot합니다.

# damo report access --sort_regions_by temperature
0   addr 16.052 GiB   size 5.985 GiB   access 0 %   age 5.900 s    # coldest
1   addr 22.037 GiB   size 6.029 GiB   access 0 %   age 5.300 s
2   addr 28.065 GiB   size 6.045 GiB   access 0 %   age 5.200 s
3   addr 10.069 GiB   size 5.983 GiB   access 0 %   age 4.500 s
4   addr 4.000 GiB    size 6.069 GiB   access 0 %   age 4.400 s
5   addr 62.008 GiB   size 3.992 GiB   access 0 %   age 3.700 s
6   addr 56.795 GiB   size 5.213 GiB   access 0 %   age 3.300 s
7   addr 39.393 GiB   size 6.096 GiB   access 0 %   age 2.800 s
8   addr 50.782 GiB   size 6.012 GiB   access 0 %   age 2.800 s
9   addr 34.111 GiB   size 5.282 GiB   access 0 %   age 2.300 s
10  addr 45.489 GiB   size 5.293 GiB   access 0 %   age 1.800 s    # hottest
total size: 62.000 GiB

목록에는 뚜렷하게 hot한 region이 없고 접근 패턴 다양성도 최소 수준입니다. 모든 region의 접근 빈도가 0이며 region 수는 기본 `min_nr_regions` 값인 10이고 크기도 거의 같습니다. Adaptive regions adjustment가 제대로 동작하지 못했다고 의심할 수 있습니다.

지침이 말하듯 `age`를 최근성 정보로 사용하면 region의 상대적 hotness를 얻을 수 있어 아무 정보가 없는 것보다는 낫습니다. 그러나 10분가량 기다렸는데 가장 긴 `age`가 약 6초뿐이므로 얼마나 유용할지는 분명하지 않습니다.

Temperature 구간별 region 총크기 histogram도 흥미로운 분포 패턴을 보여 주지 않습니다.

# damo report access --style temperature-sz-hist
<temperature> <total size>
[-,590,000,000, -,549,000,000) 5.985 GiB  |**********          |
[-,549,000,000, -,508,000,000) 12.074 GiB |********************|
[-,508,000,000, -,467,000,000) 0 B        |                    |
[-,467,000,000, -,426,000,000) 12.052 GiB |********************|
[-,426,000,000, -,385,000,000) 0 B        |                    |
[-,385,000,000, -,344,000,000) 3.992 GiB  |*******             |
[-,344,000,000, -,303,000,000) 5.213 GiB  |*********           |
[-,303,000,000, -,262,000,000) 12.109 GiB |********************|
[-,262,000,000, -,221,000,000) 5.282 GiB  |*********           |
[-,221,000,000, -,180,000,000) 0 B        |                    |
[-,180,000,000, -,139,000,000) 5.293 GiB  |*********           |
total size: 62.000 GiB

요약하면 이 매개변수는 hot region 탐지 품질이 낮습니다. 조정 지침에 따르면 원인은 지나치게 짧은 `aggregation interval`입니다.


5ms/100ms intervals: Too Short Interval
=======================================

Let's start by capturing the access pattern snapshot on the physical address
space of the system using DAMON, with the default interval parameters (5
milliseconds and 100 milliseconds for the sampling and the aggregation
intervals, respectively).  Wait ten minutes between the start of DAMON and
the capturing of the snapshot, to show a meaningful time-wise access patterns.
::

    # damo start
    # sleep 600
    # damo record --snapshot 0 1
    # damo stop

Then, list the DAMON-found regions of different access patterns, sorted by the
"access temperature".  "Access temperature" is a metric representing the
access-hotness of a region.  It is calculated as a weighted sum of the access
frequency and the age of the region.  If the access frequency is 0 %, the
temperature is multiplied by minus one.  That is, if a region is not accessed,
it gets minus temperature and it gets lower as not accessed for longer time.
The sorting is in temperature-ascendint order, so the region at the top of the
list is the coldest, and the one at the bottom is the hottest one. ::

    # damo report access --sort_regions_by temperature
    0   addr 16.052 GiB   size 5.985 GiB   access 0 %   age 5.900 s    # coldest
    1   addr 22.037 GiB   size 6.029 GiB   access 0 %   age 5.300 s
    2   addr 28.065 GiB   size 6.045 GiB   access 0 %   age 5.200 s
    3   addr 10.069 GiB   size 5.983 GiB   access 0 %   age 4.500 s
    4   addr 4.000 GiB    size 6.069 GiB   access 0 %   age 4.400 s
    5   addr 62.008 GiB   size 3.992 GiB   access 0 %   age 3.700 s
    6   addr 56.795 GiB   size 5.213 GiB   access 0 %   age 3.300 s
    7   addr 39.393 GiB   size 6.096 GiB   access 0 %   age 2.800 s
    8   addr 50.782 GiB   size 6.012 GiB   access 0 %   age 2.800 s
    9   addr 34.111 GiB   size 5.282 GiB   access 0 %   age 2.300 s
    10  addr 45.489 GiB   size 5.293 GiB   access 0 %   age 1.800 s    # hottest
    total size: 62.000 GiB

The list shows not seemingly hot regions, and only minimum access pattern
diversity.  Every region has zero access frequency.  The number of region is
10, which is the default ``min_nr_regions value``.  Size of each region is also
nearly identical.  We can suspect this is because “adaptive regions adjustment”
mechanism was not well working.  As the guide suggested, we can get relative
hotness of regions using ``age`` as the recency information.  That would be
better than nothing, but given the fact that the longest age is only about 6
seconds while we waited about ten minutes, it is unclear how useful this will
be.

The temperature ranges to total size of regions of each range histogram
visualization of the results also shows no interesting distribution pattern. ::

    # damo report access --style temperature-sz-hist
    <temperature> <total size>
    [-,590,000,000, -,549,000,000) 5.985 GiB  |**********          |
    [-,549,000,000, -,508,000,000) 12.074 GiB |********************|
    [-,508,000,000, -,467,000,000) 0 B        |                    |
    [-,467,000,000, -,426,000,000) 12.052 GiB |********************|
    [-,426,000,000, -,385,000,000) 0 B        |                    |
    [-,385,000,000, -,344,000,000) 3.992 GiB  |*******             |
    [-,344,000,000, -,303,000,000) 5.213 GiB  |*********           |
    [-,303,000,000, -,262,000,000) 12.109 GiB |********************|
    [-,262,000,000, -,221,000,000) 5.282 GiB  |*********           |
    [-,221,000,000, -,180,000,000) 0 B        |                    |
    [-,180,000,000, -,139,000,000) 5.293 GiB  |*********           |
    total size: 62.000 GiB

In short, the parameters provide poor quality monitoring results for hot
regions detection. According to the :ref:`guide
<damon_design_monitoring_params_tuning_guide>`, this is due to the too short
aggregation interval.

100ms/2s: 작은 hot region이 보이기 시작함

91-143

지침에 따라 sampling interval과 aggregation interval을 각각 100ms와 2s로 20배 늘립니다.

# damo start -s 100ms -a 2s
# sleep 600
# damo record --snapshot 0 1
# damo stop
# damo report access --sort_regions_by temperature
0   addr 10.180 GiB   size 6.117 GiB   access 0 %   age 7 m 8 s    # coldest
1   addr 49.275 GiB   size 6.195 GiB   access 0 %   age 6 m 14 s
2   addr 62.421 GiB   size 3.579 GiB   access 0 %   age 6 m 4 s
3   addr 40.154 GiB   size 6.127 GiB   access 0 %   age 5 m 40 s
4   addr 16.296 GiB   size 6.182 GiB   access 0 %   age 5 m 32 s
5   addr 34.254 GiB   size 5.899 GiB   access 0 %   age 5 m 24 s
6   addr 46.281 GiB   size 2.995 GiB   access 0 %   age 5 m 20 s
7   addr 28.420 GiB   size 5.835 GiB   access 0 %   age 5 m 6 s
8   addr 4.000 GiB    size 6.180 GiB   access 0 %   age 4 m 16 s
9   addr 22.478 GiB   size 5.942 GiB   access 0 %   age 3 m 58 s
10  addr 55.470 GiB   size 915.645 MiB access 0 %   age 3 m 6 s
11  addr 56.364 GiB   size 6.056 GiB   access 0 %   age 2 m 8 s
12  addr 56.364 GiB   size 4.000 KiB   access 95 %  age 16 s
13  addr 49.275 GiB   size 4.000 KiB   access 100 % age 8 m 24 s   # hottest
total size: 62.000 GiB
# damo report access --style temperature-sz-hist
<temperature> <total size>
[-42,800,000,000, -33,479,999,000) 22.018 GiB |*****************   |
[-33,479,999,000, -24,159,998,000) 27.090 GiB |********************|
[-24,159,998,000, -14,839,997,000) 6.836 GiB  |******              |
[-14,839,997,000, -5,519,996,000)  6.056 GiB  |*****               |
[-5,519,996,000, 3,800,005,000)    4.000 KiB  |*                   |
[3,800,005,000, 13,120,006,000)    0 B        |                    |
[13,120,006,000, 22,440,007,000)   0 B        |                    |
[22,440,007,000, 31,760,008,000)   0 B        |                    |
[31,760,008,000, 41,080,009,000)   0 B        |                    |
[41,080,009,000, 50,400,010,000)   0 B        |                    |
[50,400,010,000, 59,720,011,000)   4.000 KiB  |*                   |
total size: 62.000 GiB

DAMON은 뚜렷하게 hot한 4 KiB region 두 개를 찾았습니다. 이 region들의 `age`도 충분히 큽니다. 가장 hot한 4 KiB region은 약 8분 동안 해당 접근 빈도를 유지했고, 가장 cold한 region은 약 7분 동안 접근되지 않았습니다. Histogram 분포도 패턴을 보이기 시작합니다.

전체 62 GiB 메모리에서 4 KiB region을 찾아냈다는 사실은 DAMON adaptive regions adjustment가 설계대로 동작한다는 것을 보여 줍니다.

다만 region 수는 여전히 `min_nr_regions`에 가깝고 cold region 크기도 비슷합니다. 분명 개선됐지만 더 개선할 여지가 있습니다.

100ms/2s intervals: Starts Showing Small Hot Regions
====================================================

Following the guide, increase the interval 20 times (100 milliseocnds and 2
seconds for sampling and aggregation intervals, respectively). ::

    # damo start -s 100ms -a 2s
    # sleep 600
    # damo record --snapshot 0 1
    # damo stop
    # damo report access --sort_regions_by temperature
    0   addr 10.180 GiB   size 6.117 GiB   access 0 %   age 7 m 8 s    # coldest
    1   addr 49.275 GiB   size 6.195 GiB   access 0 %   age 6 m 14 s
    2   addr 62.421 GiB   size 3.579 GiB   access 0 %   age 6 m 4 s
    3   addr 40.154 GiB   size 6.127 GiB   access 0 %   age 5 m 40 s
    4   addr 16.296 GiB   size 6.182 GiB   access 0 %   age 5 m 32 s
    5   addr 34.254 GiB   size 5.899 GiB   access 0 %   age 5 m 24 s
    6   addr 46.281 GiB   size 2.995 GiB   access 0 %   age 5 m 20 s
    7   addr 28.420 GiB   size 5.835 GiB   access 0 %   age 5 m 6 s
    8   addr 4.000 GiB    size 6.180 GiB   access 0 %   age 4 m 16 s
    9   addr 22.478 GiB   size 5.942 GiB   access 0 %   age 3 m 58 s
    10  addr 55.470 GiB   size 915.645 MiB access 0 %   age 3 m 6 s
    11  addr 56.364 GiB   size 6.056 GiB   access 0 %   age 2 m 8 s
    12  addr 56.364 GiB   size 4.000 KiB   access 95 %  age 16 s
    13  addr 49.275 GiB   size 4.000 KiB   access 100 % age 8 m 24 s   # hottest
    total size: 62.000 GiB
    # damo report access --style temperature-sz-hist
    <temperature> <total size>
    [-42,800,000,000, -33,479,999,000) 22.018 GiB |*****************   |
    [-33,479,999,000, -24,159,998,000) 27.090 GiB |********************|
    [-24,159,998,000, -14,839,997,000) 6.836 GiB  |******              |
    [-14,839,997,000, -5,519,996,000)  6.056 GiB  |*****               |
    [-5,519,996,000, 3,800,005,000)    4.000 KiB  |*                   |
    [3,800,005,000, 13,120,006,000)    0 B        |                    |
    [13,120,006,000, 22,440,007,000)   0 B        |                    |
    [22,440,007,000, 31,760,008,000)   0 B        |                    |
    [31,760,008,000, 41,080,009,000)   0 B        |                    |
    [41,080,009,000, 50,400,010,000)   0 B        |                    |
    [50,400,010,000, 59,720,011,000)   4.000 KiB  |*                   |
    total size: 62.000 GiB

DAMON found two distinct 4 KiB regions that pretty hot.  The regions are also
well aged.  The hottest 4 KiB region was keeping the access frequency for about
8 minutes, and the coldest region was keeping no access for about 7 minutes.
The distribution on the histogram also looks like having a pattern.

Especially, the finding of the 4 KiB regions among the 62 GiB total memory
shows DAMON’s adaptive regions adjustment is working as designed.

Still the number of regions is close to the ``min_nr_regions``, and sizes of
cold regions are similar, though.  Apparently it is improved, but it still has
rooms to improve.

400ms/8s: 크게 개선된 결과

144-194

Interval을 다시 네 배 늘려 sampling 400ms와 aggregation 8s로 설정합니다.

# damo start -s 400ms -a 8s
# sleep 600
# damo record --snapshot 0 1
# damo stop
# damo report access --sort_regions_by temperature
0   addr 64.492 GiB   size 1.508 GiB   access 0 %   age 6 m 48 s    # coldest
1   addr 21.749 GiB   size 5.674 GiB   access 0 %   age 6 m 8 s
2   addr 27.422 GiB   size 5.801 GiB   access 0 %   age 6 m
3   addr 49.431 GiB   size 8.675 GiB   access 0 %   age 5 m 28 s
4   addr 33.223 GiB   size 5.645 GiB   access 0 %   age 5 m 12 s
5   addr 58.321 GiB   size 6.170 GiB   access 0 %   age 5 m 4 s
[...]
25  addr 6.615 GiB    size 297.531 MiB access 15 %  age 0 ns
26  addr 9.513 GiB    size 12.000 KiB  access 20 %  age 0 ns
27  addr 9.511 GiB    size 108.000 KiB access 25 %  age 0 ns
28  addr 9.513 GiB    size 20.000 KiB  access 25 %  age 0 ns
29  addr 9.511 GiB    size 12.000 KiB  access 30 %  age 0 ns
30  addr 9.520 GiB    size 4.000 KiB   access 40 %  age 0 ns
[...]
41  addr 9.520 GiB    size 4.000 KiB   access 80 %  age 56 s
42  addr 9.511 GiB    size 12.000 KiB  access 100 % age 6 m 16 s
43  addr 58.321 GiB   size 4.000 KiB   access 100 % age 6 m 24 s
44  addr 9.512 GiB    size 4.000 KiB   access 100 % age 6 m 48 s
45  addr 58.106 GiB   size 4.000 KiB   access 100 % age 6 m 48 s    # hottest
total size: 62.000 GiB
# damo report access --style temperature-sz-hist
<temperature> <total size>
[-40,800,000,000, -32,639,999,000) 21.657 GiB  |********************|
[-32,639,999,000, -24,479,998,000) 17.938 GiB  |*****************   |
[-24,479,998,000, -16,319,997,000) 16.885 GiB  |****************    |
[-16,319,997,000, -8,159,996,000)  586.879 MiB |*                   |
[-8,159,996,000, 5,000)            4.946 GiB   |*****               |
[5,000, 8,160,006,000)             260.000 KiB |*                   |
[8,160,006,000, 16,320,007,000)    0 B         |                    |
[16,320,007,000, 24,480,008,000)   0 B         |                    |
[24,480,008,000, 32,640,009,000)   0 B         |                    |
[32,640,009,000, 40,800,010,000)   16.000 KiB  |*                   |
[40,800,010,000, 48,960,011,000)   8.000 KiB   |*                   |
total size: 62.000 GiB

서로 다른 접근 패턴을 가진 region 수가 크게 증가했고 각 region 크기도 더 다양해졌습니다. 접근 빈도가 0이 아닌 region의 총크기도 크게 늘었습니다. 이 정도면 의미 있는 메모리 관리 효율 개선에 사용할 수 있을 가능성이 있습니다.

400ms/8s intervals: Pretty Improved Results
===========================================

Increase the intervals four times (400 milliseconds and 8 seconds
for sampling and aggregation intervals, respectively). ::

    # damo start -s 400ms -a 8s
    # sleep 600
    # damo record --snapshot 0 1
    # damo stop
    # damo report access --sort_regions_by temperature
    0   addr 64.492 GiB   size 1.508 GiB   access 0 %   age 6 m 48 s    # coldest
    1   addr 21.749 GiB   size 5.674 GiB   access 0 %   age 6 m 8 s
    2   addr 27.422 GiB   size 5.801 GiB   access 0 %   age 6 m
    3   addr 49.431 GiB   size 8.675 GiB   access 0 %   age 5 m 28 s
    4   addr 33.223 GiB   size 5.645 GiB   access 0 %   age 5 m 12 s
    5   addr 58.321 GiB   size 6.170 GiB   access 0 %   age 5 m 4 s
    [...]
    25  addr 6.615 GiB    size 297.531 MiB access 15 %  age 0 ns
    26  addr 9.513 GiB    size 12.000 KiB  access 20 %  age 0 ns
    27  addr 9.511 GiB    size 108.000 KiB access 25 %  age 0 ns
    28  addr 9.513 GiB    size 20.000 KiB  access 25 %  age 0 ns
    29  addr 9.511 GiB    size 12.000 KiB  access 30 %  age 0 ns
    30  addr 9.520 GiB    size 4.000 KiB   access 40 %  age 0 ns
    [...]
    41  addr 9.520 GiB    size 4.000 KiB   access 80 %  age 56 s
    42  addr 9.511 GiB    size 12.000 KiB  access 100 % age 6 m 16 s
    43  addr 58.321 GiB   size 4.000 KiB   access 100 % age 6 m 24 s
    44  addr 9.512 GiB    size 4.000 KiB   access 100 % age 6 m 48 s
    45  addr 58.106 GiB   size 4.000 KiB   access 100 % age 6 m 48 s    # hottest
    total size: 62.000 GiB
    # damo report access --style temperature-sz-hist
    <temperature> <total size>
    [-40,800,000,000, -32,639,999,000) 21.657 GiB  |********************|
    [-32,639,999,000, -24,479,998,000) 17.938 GiB  |*****************   |
    [-24,479,998,000, -16,319,997,000) 16.885 GiB  |****************    |
    [-16,319,997,000, -8,159,996,000)  586.879 MiB |*                   |
    [-8,159,996,000, 5,000)            4.946 GiB   |*****               |
    [5,000, 8,160,006,000)             260.000 KiB |*                   |
    [8,160,006,000, 16,320,007,000)    0 B         |                    |
    [16,320,007,000, 24,480,008,000)   0 B         |                    |
    [24,480,008,000, 32,640,009,000)   0 B         |                    |
    [32,640,009,000, 40,800,010,000)   16.000 KiB  |*                   |
    [40,800,010,000, 48,960,011,000)   8.000 KiB   |*                   |
    total size: 62.000 GiB

The number of regions having different access patterns has significantly
increased.  Size of each region is also more varied. Total size of non-zero
access frequency regions is also significantly increased. Maybe this is already
good enough to make some meaningful memory management efficiency changes.

800ms/16s: 다른 방향의 편향

195-241

Interval을 다시 두 배로 늘려 sampling 800ms와 aggregation 16s로 설정합니다. Hot region 탐지는 더 개선되지만 cold region 탐지는 나빠지기 시작하는 모습입니다.

# damo start -s 800ms -a 16s
# sleep 600
# damo record --snapshot 0 1
# damo stop
# damo report access --sort_regions_by temperature
0   addr 64.781 GiB   size 1.219 GiB   access 0 %   age 4 m 48 s
1   addr 24.505 GiB   size 2.475 GiB   access 0 %   age 4 m 16 s
2   addr 26.980 GiB   size 504.273 MiB access 0 %   age 4 m
3   addr 29.443 GiB   size 2.462 GiB   access 0 %   age 4 m
4   addr 37.264 GiB   size 5.645 GiB   access 0 %   age 4 m
5   addr 31.905 GiB   size 5.359 GiB   access 0 %   age 3 m 44 s
[...]
20  addr 8.711 GiB    size 40.000 KiB  access 5 %   age 2 m 40 s
21  addr 27.473 GiB   size 1.970 GiB   access 5 %   age 4 m
22  addr 48.185 GiB   size 4.625 GiB   access 5 %   age 4 m
23  addr 47.304 GiB   size 902.117 MiB access 10 %  age 4 m
24  addr 8.711 GiB    size 4.000 KiB   access 100 % age 4 m
25  addr 20.793 GiB   size 3.713 GiB   access 5 %   age 4 m 16 s
26  addr 8.773 GiB    size 4.000 KiB   access 100 % age 4 m 16 s
total size: 62.000 GiB
# damo report access --style temperature-sz-hist
<temperature> <total size>
[-28,800,000,000, -23,359,999,000) 12.294 GiB  |*****************   |
[-23,359,999,000, -17,919,998,000) 9.753 GiB   |*************       |
[-17,919,998,000, -12,479,997,000) 15.131 GiB  |********************|
[-12,479,997,000, -7,039,996,000)  0 B         |                    |
[-7,039,996,000, -1,599,995,000)   7.506 GiB   |**********          |
[-1,599,995,000, 3,840,006,000)    6.127 GiB   |*********           |
[3,840,006,000, 9,280,007,000)     0 B         |                    |
[9,280,007,000, 14,720,008,000)    136.000 KiB |*                   |
[14,720,008,000, 20,160,009,000)   40.000 KiB  |*                   |
[20,160,009,000, 25,600,010,000)   11.188 GiB  |***************     |
[25,600,010,000, 31,040,011,000)   4.000 KiB   |*                   |
total size: 62.000 GiB

접근 빈도가 0이 아닌 region을 더 많이 찾았습니다. Region 수는 여전히 `min_nr_regions`보다 훨씬 많지만 이전 설정보다 줄었고, 분포가 hot region 쪽으로 조금 편향된 것으로 보입니다.

800ms/16s intervals: Another bias
=================================

Further double the intervals (800 milliseconds and 16 seconds for sampling
and aggregation intervals, respectively).  The results is more improved for the
hot regions detection, but starts looking degrading cold regions detection. ::

    # damo start -s 800ms -a 16s
    # sleep 600
    # damo record --snapshot 0 1
    # damo stop
    # damo report access --sort_regions_by temperature
    0   addr 64.781 GiB   size 1.219 GiB   access 0 %   age 4 m 48 s
    1   addr 24.505 GiB   size 2.475 GiB   access 0 %   age 4 m 16 s
    2   addr 26.980 GiB   size 504.273 MiB access 0 %   age 4 m
    3   addr 29.443 GiB   size 2.462 GiB   access 0 %   age 4 m
    4   addr 37.264 GiB   size 5.645 GiB   access 0 %   age 4 m
    5   addr 31.905 GiB   size 5.359 GiB   access 0 %   age 3 m 44 s
    [...]
    20  addr 8.711 GiB    size 40.000 KiB  access 5 %   age 2 m 40 s
    21  addr 27.473 GiB   size 1.970 GiB   access 5 %   age 4 m
    22  addr 48.185 GiB   size 4.625 GiB   access 5 %   age 4 m
    23  addr 47.304 GiB   size 902.117 MiB access 10 %  age 4 m
    24  addr 8.711 GiB    size 4.000 KiB   access 100 % age 4 m
    25  addr 20.793 GiB   size 3.713 GiB   access 5 %   age 4 m 16 s
    26  addr 8.773 GiB    size 4.000 KiB   access 100 % age 4 m 16 s
    total size: 62.000 GiB
    # damo report access --style temperature-sz-hist
    <temperature> <total size>
    [-28,800,000,000, -23,359,999,000) 12.294 GiB  |*****************   |
    [-23,359,999,000, -17,919,998,000) 9.753 GiB   |*************       |
    [-17,919,998,000, -12,479,997,000) 15.131 GiB  |********************|
    [-12,479,997,000, -7,039,996,000)  0 B         |                    |
    [-7,039,996,000, -1,599,995,000)   7.506 GiB   |**********          |
    [-1,599,995,000, 3,840,006,000)    6.127 GiB   |*********           |
    [3,840,006,000, 9,280,007,000)     0 B         |                    |
    [9,280,007,000, 14,720,008,000)    136.000 KiB |*                   |
    [14,720,008,000, 20,160,009,000)   40.000 KiB  |*                   |
    [20,160,009,000, 25,600,010,000)   11.188 GiB  |***************     |
    [25,600,010,000, 31,040,011,000)   4.000 KiB   |*                   |
    total size: 62.000 GiB

It found more non-zero access frequency regions. The number of regions is still
much higher than the ``min_nr_regions``, but it is reduced from that of the
previous setup. And apparently the distribution seems bit biased to hot
regions.

결론

242-247

위 실험 조정 결과를 바탕으로 DAMON interval 조정 이론과 지침은 적어도 이 workload에서 타당하며 비슷한 사례에도 적용할 수 있다고 결론 내릴 수 있습니다.

Conclusion
==========

With the above experimental tuning results, we can conclude the theory and the
guide makes sense to at least this workload, and could be applied to similar
cases.