@@ -58,7 +58,7 @@ const (
58
58
)`
59
59
60
60
minCPURequest = 0.01 // 10m
61
- minMemoryRequestBytes = 64 * 1024 * 1024 // 64 MiB
61
+ minMemoryRequestBytes = 32 * 1024 * 1024 // 64 MiB
62
62
)
63
63
64
64
var (
@@ -317,8 +317,8 @@ func WorkloadResourceRecommendations(ctx context.Context, env string, teamSlug s
317
317
318
318
return & WorkloadUtilizationRecommendations {
319
319
CPURequestCores : math .Max (cpuReq , minCPURequest ),
320
- MemoryRequestBytes : int64 (math .Max (roundUpToPowerOf2 (memReq ), minMemoryRequestBytes )),
321
- MemoryLimitBytes : int64 (math .Max (roundUpToPowerOf2 (memLimit ), minMemoryRequestBytes )),
320
+ MemoryRequestBytes : int64 (math .Max (roundUpToNearest32MiB (memReq ), minMemoryRequestBytes )),
321
+ MemoryLimitBytes : int64 (math .Max (roundUpToNearest32MiB (memLimit ), minMemoryRequestBytes )),
322
322
}, nil
323
323
}
324
324
@@ -354,9 +354,7 @@ func ensuredVal(v prom.Vector) float64 {
354
354
return float64 (v [0 ].Value )
355
355
}
356
356
357
- func roundUpToPowerOf2 (x float64 ) float64 {
358
- if x <= 0 {
359
- return 0
360
- }
361
- return math .Pow (2 , math .Ceil (math .Log2 (x )))
357
+ func roundUpToNearest32MiB (bytes float64 ) float64 {
358
+ const chunk float64 = 32 * 1024 * 1024 // 32 MiB in bytes
359
+ return math .Ceil (bytes / chunk ) * chunk
362
360
}
0 commit comments