Merge pull request #7339 from jzhou77/fix-status-memory
Add rss_bytes to process memory and fix available_bytes calculation
This commit is contained in:
commit
7acd184a38
|
@ -260,7 +260,8 @@
|
|||
"available_bytes":0, // an estimate of the process' fair share of the memory available to fdbservers
|
||||
"limit_bytes":0, // memory limit per process
|
||||
"unused_allocated_memory":0,
|
||||
"used_bytes":0 // virtual memory size of the process
|
||||
"used_bytes":0, // virtual memory size of the process
|
||||
"rss_bytes":0 // resident memory size of the process
|
||||
},
|
||||
"messages":[
|
||||
{
|
||||
|
|
|
@ -301,7 +301,8 @@ const KeyRef JSONSchemas::statusSchema = LiteralStringRef(R"statusSchema(
|
|||
"available_bytes":0,
|
||||
"limit_bytes":0,
|
||||
"unused_allocated_memory":0,
|
||||
"used_bytes":0
|
||||
"used_bytes":0,
|
||||
"rss_bytes":0
|
||||
},
|
||||
"messages":[
|
||||
{
|
||||
|
|
|
@ -422,10 +422,11 @@ static JsonBuilderObject getBounceImpactInfo(int recoveryStatusCode) {
|
|||
}
|
||||
|
||||
struct MachineMemoryInfo {
|
||||
double memoryUsage;
|
||||
double memoryUsage; // virtual memory usage
|
||||
double rssUsage; // RSS memory usage
|
||||
double aggregateLimit;
|
||||
|
||||
MachineMemoryInfo() : memoryUsage(0), aggregateLimit(0) {}
|
||||
MachineMemoryInfo() : memoryUsage(0), rssUsage(0), aggregateLimit(0) {}
|
||||
|
||||
bool valid() { return memoryUsage >= 0; }
|
||||
void invalidate() { memoryUsage = -1; }
|
||||
|
@ -789,6 +790,7 @@ ACTOR static Future<JsonBuilderObject> processStatusFetcher(
|
|||
if (memInfo->second.valid()) {
|
||||
if (processMetrics.size() > 0 && programStart.size() > 0) {
|
||||
memInfo->second.memoryUsage += processMetrics.getDouble("Memory");
|
||||
memInfo->second.rssUsage += processMetrics.getDouble("ResidentMemory");
|
||||
memInfo->second.aggregateLimit += programStart.getDouble("MemoryLimit");
|
||||
} else
|
||||
memInfo->second.invalidate();
|
||||
|
@ -979,6 +981,7 @@ ACTOR static Future<JsonBuilderObject> processStatusFetcher(
|
|||
statusObj["network"] = networkObj;
|
||||
|
||||
memoryObj.setKeyRawNumber("used_bytes", processMetrics.getValue("Memory"));
|
||||
memoryObj.setKeyRawNumber("rss_bytes", processMetrics.getValue("ResidentMemory"));
|
||||
memoryObj.setKeyRawNumber("unused_allocated_memory", processMetrics.getValue("UnusedAllocatedMemory"));
|
||||
}
|
||||
|
||||
|
@ -1011,7 +1014,7 @@ ACTOR static Future<JsonBuilderObject> processStatusFetcher(
|
|||
if (machineMemInfo.valid() && memoryLimit > 0) {
|
||||
ASSERT(machineMemInfo.aggregateLimit > 0);
|
||||
int64_t memory =
|
||||
(availableMemory + machineMemInfo.memoryUsage) * memoryLimit / machineMemInfo.aggregateLimit;
|
||||
(availableMemory + machineMemInfo.rssUsage) * memoryLimit / machineMemInfo.aggregateLimit;
|
||||
memoryObj["available_bytes"] = std::min<int64_t>(std::max<int64_t>(memory, 0), memoryLimit);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue