Skip to content

Commit

Permalink
Update heap pct calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pritham Marupaka committed Nov 13, 2023
1 parent 8047f50 commit 694c0c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions launchlib/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func filterHeapSizeArgs(customConfig *CustomLauncherConfig, args []string) []str
if !hasInitialRAMPercentage && !hasMaxRAMPercentage {
initialHeapPercentage, err := computeInitialHeapPercentage(customConfig)
if err != nil {
initialHeapPercentage = 0.75
initialHeapPercentage = 75.0
}
filtered = append(filtered, fmt.Sprintf("-XX:InitialRAMPercentage=%.2f", initialHeapPercentage))
filtered = append(filtered, fmt.Sprintf("-XX:MaxRAMPercentage=%.2f", initialHeapPercentage))
Expand Down Expand Up @@ -386,7 +386,7 @@ func isInitialRAMPercentage(arg string) bool {
// heap minus 3mb per processor, with a minimum value of 50%.
func computeInitialHeapPercentage(customConfig *CustomLauncherConfig) (float64, error) {
if !customConfig.Experimental.UseProcessorAwareInitialHeapPercentage {
return 0.75, nil
return 75.0, nil
}

cgroupProcessorCount, err := DefaultCGroupV1ProcessorCounter.ProcessorCount()
Expand All @@ -400,5 +400,5 @@ func computeInitialHeapPercentage(customConfig *CustomLauncherConfig) (float64,
var heapLimit = float64(cgroupMemoryLimitInBytes)
var processorAdjustment = 3 * BytesInMebibyte * float64(cgroupProcessorCount)

return max(0.5, (0.75*heapLimit-processorAdjustment)/heapLimit), nil
return max(50.0, (0.75*heapLimit-processorAdjustment)/heapLimit*100.0), nil
}

0 comments on commit 694c0c5

Please sign in to comment.