Skip to content

Commit

Permalink
allow ARL to switch to check for all memory for load shedding based o…
Browse files Browse the repository at this point in the history
…n 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
  • Loading branch information
Rongxin Xia authored and facebook-github-bot committed Jan 14, 2025
1 parent 6c1d916 commit 8e783eb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
25 changes: 1 addition & 24 deletions proxygen/lib/stats/ResourceData.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,6 @@ struct ResourceData : public PeriodicStatsDataBase {
return usedMemBytes_;
}

// Similar to getUsedMemBytes but difference is that
// `getUsedMemBytes` only contains anon memory while
// `getUsedMemBytesAll` contains file cache and all the other
// types of memory
uint64_t getUsedMemBytesAll() const {
return usedMemBytesAll_;
}

[[nodiscard]] double getMemPressureAvg10Pct() const {
return memPressureAvg10Pct_;
}
Expand Down Expand Up @@ -194,15 +186,6 @@ struct ResourceData : public PeriodicStatsDataBase {
return ((double)usedMemBytes_) / totalMemBytes_ * 100;
}

double getUsedMemAllPct() const {
return ((double)usedMemBytesAll_) / totalMemBytes_ * 100;
}

// Gets the used total memory (0-1.0) of the system as a ratio
double getUsedMemAllRatio() const {
return ((double)usedMemBytesAll_) / totalMemBytes_;
}

// Gets the used anonymous memory (0-1.0) of the system as a ratio
double getUsedMemRatio() const {
return ((double)usedMemBytes_) / totalMemBytes_;
Expand Down Expand Up @@ -342,11 +325,8 @@ struct ResourceData : public PeriodicStatsDataBase {
softIrqCpuCoreRatioUtils_ = std::move(softIrqCpuCoreRatioUtils);
}

void setMemStats(uint64_t usedMemBytes,
uint64_t usedMemBytesAll,
uint64_t totalMemBytes) {
void setMemStats(uint64_t usedMemBytes, uint64_t totalMemBytes) {
usedMemBytes_ = usedMemBytes;
usedMemBytesAll_ = usedMemBytesAll;
totalMemBytes_ = totalMemBytes;
}

Expand Down Expand Up @@ -411,9 +391,6 @@ struct ResourceData : public PeriodicStatsDataBase {
double cpuSoftIrqRatioUtil_{0};
std::vector<double> softIrqCpuCoreRatioUtils_;
uint64_t usedMemBytes_{0};
// usedMemBytes_ contains only anon memory while usedMemBytesAll_ contains
// all the memory including file cache.
uint64_t usedMemBytesAll_{0};
uint64_t totalMemBytes_{0};
uint64_t tcpMemoryPages_{0};
uint64_t maxTcpMemLimit_{0};
Expand Down
1 change: 0 additions & 1 deletion proxygen/lib/stats/test/MockResources.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class MockResources : public proxygen::Resources {
std::vector<double>(params.numCpuCores, params.cpuSoftIrqUtilRatio));
uint64_t totalMemBytes = 100;
data.setMemStats(
folly::to<uint64_t>(round(params.memUtilRatio * totalMemBytes)),
folly::to<uint64_t>(round(params.memUtilRatio * totalMemBytes)),
totalMemBytes);
uint64_t totalNetMemBytes = 100;
Expand Down

0 comments on commit 8e783eb

Please sign in to comment.