lostluck commented on code in PR #31567:
URL: https://github.com/apache/beam/pull/31567#discussion_r1635517651
##########
sdks/java/container/boot.go:
##########
@@ -248,18 +248,24 @@ func main() {
}
// heapSizeLimit returns 80% of the runner limit, if provided. If not provided,
-// it returns 70% of the physical memory on the machine. If it cannot determine
-// that value, it returns 1GB. This is an imperfect heuristic. It aims to
-// ensure there is memory for non-heap use and other overhead, while also not
-// underutilizing the machine. if set_recommended_max_xmx experiment is
enabled,
-// sets xmx to 32G. Under 32G JVM enables CompressedOops. CompressedOops
-// utilizes memory more efficiently, and has positive impact on GC performance
-// and cache hit rate.
+// it returns max(70% M, M - 32GB) where M the physical memory on the machine.
+// If it cannot determine that value, it returns 1GB. This is an imperfect
+// heuristic. It aims to ensure there is memory for non-heap use and other
+// overhead, while also not underutilizing the machine.
+// if set_recommended_max_xmx experiment is enabled, sets xmx to 32G. Under 32G
+// JVM enables CompressedOops. CompressedOops utilizes memory more efficiently,
+// and has positive impact on GC performance and cache hit rate.
func heapSizeLimit(info *fnpb.ProvisionInfo, setRecommendedMaxXmx bool) uint64
{
if setRecommendedMaxXmx {
return 32 << 30
} else if size, err := syscallx.PhysicalMemorySize(); err == nil {
- return (size * 70) / 100
+ var lim uint64 = (size * 70) / 100
+ var limLarge uint64 = size - (32 << 30)
+ if lim > limLarge {
+ return lim
+ } else {
+ return limLarge
+ }
Review Comment:
Stylewise, don't have the else wrapper around a return statement like that,
just have the return after the if block.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]