Skip to content

Commit 8e783eb

Browse files
Rongxin Xiafacebook-github-bot
authored andcommitted
allow ARL to switch to check for all memory for load shedding based on config
Summary: This is to support ARL to switch to check for all memory based on the new enum - a new enum `CGroupResourceMemoryType` is introduced, `CgroupResources` can be initialized based `CGroupResourceMemoryType` to check `anon` or `all` memory - I don't use a flag in config as this flag will not be included in `arlConfig` and every service initialize the resource differently, so I just let the service determine whether they want to initialize with different memory type. - delete all APIs / counters related to `memAll` as after this diff we will only have one view of mem (more discussion [here](https://fb.workplace.com/groups/proxygendevelopers/posts/3064051317235572/?comment_id=3064123973894973&fbclid=IwZXh0bgNhZW0CMTEAAR0i2R_cHSSEKChgn7vq_1u9aCDnCIY4xzaeHkUyFLqxR4TfbZh55f8kbPI_aem_k0DpcV2UpwH-h4LErupCkA)) See more discussion in https://fb.workplace.com/groups/proxygendevelopers/permalink/3441253179515382/ (S479847). TLDR edgetee OOM because of socket mem but ARL doesn't count it so ARL didn't kick in. Reviewed By: dddmello Differential Revision: D67954452 fbshipit-source-id: 3b99555ed644ac57e80da44d7a01c8ae1568a9a9
1 parent 6c1d916 commit 8e783eb

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

proxygen/lib/stats/ResourceData.h

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,6 @@ struct ResourceData : public PeriodicStatsDataBase {
132132
return usedMemBytes_;
133133
}
134134

135-
// Similar to getUsedMemBytes but difference is that
136-
// `getUsedMemBytes` only contains anon memory while
137-
// `getUsedMemBytesAll` contains file cache and all the other
138-
// types of memory
139-
uint64_t getUsedMemBytesAll() const {
140-
return usedMemBytesAll_;
141-
}
142-
143135
[[nodiscard]] double getMemPressureAvg10Pct() const {
144136
return memPressureAvg10Pct_;
145137
}
@@ -194,15 +186,6 @@ struct ResourceData : public PeriodicStatsDataBase {
194186
return ((double)usedMemBytes_) / totalMemBytes_ * 100;
195187
}
196188

197-
double getUsedMemAllPct() const {
198-
return ((double)usedMemBytesAll_) / totalMemBytes_ * 100;
199-
}
200-
201-
// Gets the used total memory (0-1.0) of the system as a ratio
202-
double getUsedMemAllRatio() const {
203-
return ((double)usedMemBytesAll_) / totalMemBytes_;
204-
}
205-
206189
// Gets the used anonymous memory (0-1.0) of the system as a ratio
207190
double getUsedMemRatio() const {
208191
return ((double)usedMemBytes_) / totalMemBytes_;
@@ -342,11 +325,8 @@ struct ResourceData : public PeriodicStatsDataBase {
342325
softIrqCpuCoreRatioUtils_ = std::move(softIrqCpuCoreRatioUtils);
343326
}
344327

345-
void setMemStats(uint64_t usedMemBytes,
346-
uint64_t usedMemBytesAll,
347-
uint64_t totalMemBytes) {
328+
void setMemStats(uint64_t usedMemBytes, uint64_t totalMemBytes) {
348329
usedMemBytes_ = usedMemBytes;
349-
usedMemBytesAll_ = usedMemBytesAll;
350330
totalMemBytes_ = totalMemBytes;
351331
}
352332

@@ -411,9 +391,6 @@ struct ResourceData : public PeriodicStatsDataBase {
411391
double cpuSoftIrqRatioUtil_{0};
412392
std::vector<double> softIrqCpuCoreRatioUtils_;
413393
uint64_t usedMemBytes_{0};
414-
// usedMemBytes_ contains only anon memory while usedMemBytesAll_ contains
415-
// all the memory including file cache.
416-
uint64_t usedMemBytesAll_{0};
417394
uint64_t totalMemBytes_{0};
418395
uint64_t tcpMemoryPages_{0};
419396
uint64_t maxTcpMemLimit_{0};

proxygen/lib/stats/test/MockResources.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ class MockResources : public proxygen::Resources {
6060
std::vector<double>(params.numCpuCores, params.cpuSoftIrqUtilRatio));
6161
uint64_t totalMemBytes = 100;
6262
data.setMemStats(
63-
folly::to<uint64_t>(round(params.memUtilRatio * totalMemBytes)),
6463
folly::to<uint64_t>(round(params.memUtilRatio * totalMemBytes)),
6564
totalMemBytes);
6665
uint64_t totalNetMemBytes = 100;

0 commit comments

Comments
 (0)