Skip to content

Commit 3a02d3b

Browse files
Rongxin Xiameta-codesync[bot]
authored andcommitted
export memory events high and max metrics
Summary: Same as D93677082, these are another metrics I want to add to monitor about whether we are close to OOM, and do some test see if we can use them as extra metrics for memory shedding. The [metrics](https://facebookmicrosites.github.io/cgroup2/docs/memory-controller.html) added are: - **memory events high**: The number of times processes of the cgroup are throttled and routed to perform direct memory reclaim because the high memory boundary was exceeded. - **memory events max**: The number of times the cgroup's memory usage was about to go over the max boundary -- if we see failure about reclaim after this happen, we will OOM. For now memory.high = memory.max in Revproxy settings thus memory_events.high = memory_events.max, but we might change that for better OOM protection so I'm still going to export two metrics here. Differential Revision: D93800675 fbshipit-source-id: eb050bff5a404d11f574694f7b0bb892667e50a2
1 parent e76d8a1 commit 3a02d3b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

proxygen/lib/stats/ResourceData.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,14 @@ struct ResourceData : public PeriodicStatsDataBase {
168168
return memPressureSomeAvg300Pct_;
169169
}
170170

171+
[[nodiscard]] int64_t getMemEventsHighCount() const {
172+
return memEventsHighCount_;
173+
}
174+
175+
[[nodiscard]] int64_t getMemEventsMaxCount() const {
176+
return memEventsMaxCount_;
177+
}
178+
171179
[[nodiscard]] double getCpuPressureAvg10Pct() const {
172180
return cpuPressureAvg10Pct_;
173181
}
@@ -367,6 +375,11 @@ struct ResourceData : public PeriodicStatsDataBase {
367375
memPressureSomeAvg300Pct_ = avg300;
368376
}
369377

378+
void setMemEventsStats(int64_t highCount, int64_t maxCount) {
379+
memEventsHighCount_ = highCount;
380+
memEventsMaxCount_ = maxCount;
381+
}
382+
370383
void setIoPressureStats(double avg10, double avg60, double avg300) {
371384
ioPressureAvg10Pct_ = avg10;
372385
ioPressureAvg60Pct_ = avg60;
@@ -439,6 +452,9 @@ struct ResourceData : public PeriodicStatsDataBase {
439452
double memPressureSomeAvg60Pct_{0};
440453
double memPressureSomeAvg300Pct_{0};
441454

455+
int64_t memEventsHighCount_{0};
456+
int64_t memEventsMaxCount_{0};
457+
442458
double ioPressureAvg10Pct_{0};
443459
double ioPressureAvg60Pct_{0};
444460
double ioPressureAvg300Pct_{0};

0 commit comments

Comments
 (0)