Abacn commented on code in PR #31567:
URL: https://github.com/apache/beam/pull/31567#discussion_r1640397371
##########
sdks/java/container/boot.go:
##########
@@ -248,20 +257,22 @@ 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.
-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
+// it returns max(70% size, size - 32GB). Set size=0 if the physical memory on
+// the machine was undetermined, then 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(size uint64) uint64 {
Review Comment:
Here added a unit test responding the change request from internal. However
to do so I need to change the method to take an external value.
I try to keep the logic, the effective order of execution the same as before
(e.g. syscallx.PhysicalMemorySize won't be called if set_recommended_max_xmx is
set), PTAL
--
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]