Skip to content

Commit

Permalink
Merge pull request #2068 from HubSpot/mem_cpu_cutoff
Browse files Browse the repository at this point in the history
Consistently compare memory in GB, not MB/B
  • Loading branch information
ssalinas authored Feb 6, 2020
2 parents 5b78ddf + 2841654 commit 2335a58
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,15 @@ public CpuMemoryPreference getCpuMemoryPreferenceForSlave(SingularityOfferHolder
}

private double getCpuMemoryRatioForSlave(SingularityOfferHolder offerHolder) {
double memory = MesosUtils.getMemory(offerHolder.getCurrentResources(), Optional.empty());
double memoryGB = MesosUtils.getMemory(offerHolder.getCurrentResources(), Optional.empty()) / 1024;
double cpus = MesosUtils.getNumCpus(offerHolder.getCurrentResources(), Optional.empty());
return memory/cpus;
return cpus/memoryGB;
}

private double getCpuMemoryRatioForRequest(RequestUtilization requestUtilization) {
double cpuUsageForRequest = getEstimatedCpuUsageForRequest(requestUtilization);
double memUsageForRequest = requestUtilization.getAvgMemBytesUsed();
return cpuUsageForRequest/memUsageForRequest;
double memUsageGBForRequest = requestUtilization.getAvgMemBytesUsed() / 1024 / 1024;
return cpuUsageForRequest/memUsageGBForRequest;
}

public double getEstimatedCpuUsageForRequest(RequestUtilization requestUtilization) {
Expand Down

0 comments on commit 2335a58

Please sign in to comment.