This is an automated email from the ASF dual-hosted git repository.

yhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 08a97671516 Sets recommended max Xmx 32G when set_recommended_max_xmx 
experiment is enabled (#28442)
08a97671516 is described below

commit 08a976715160d3e18e5fb623aaa9f485f1cda4bb
Author: Arvind Ram <[email protected]>
AuthorDate: Mon Sep 18 18:43:52 2023 -0700

    Sets recommended max Xmx 32G when set_recommended_max_xmx experiment is 
enabled (#28442)
    
    * Sets recommended max Xmx 32G when set_recommended_max_xmx experiment is 
enabled
    
    * Fixing lint errors
    
    * Adding comment to reason why 32G is recomemnded value
---
 sdks/java/container/boot.go | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/sdks/java/container/boot.go b/sdks/java/container/boot.go
index 0e39d907f07..f7fd7437c88 100644
--- a/sdks/java/container/boot.go
+++ b/sdks/java/container/boot.go
@@ -159,8 +159,9 @@ func main() {
                cp = append(cp, filepath.Join(dir, filepath.FromSlash(name)))
        }
 
+       var setRecommendedMaxXmx = strings.Contains(options, 
"set_recommended_max_xmx")
        args := []string{
-               "-Xmx" + strconv.FormatUint(heapSizeLimit(info), 10),
+               "-Xmx" + strconv.FormatUint(heapSizeLimit(info, 
setRecommendedMaxXmx), 10),
                // ParallelGC the most adequate for high throughput and lower 
CPU utilization
                // It is the default GC in Java 8, but not on newer versions
                "-XX:+UseParallelGC",
@@ -266,9 +267,14 @@ func makePipelineOptionsFile(options string) error {
 // 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.
-func heapSizeLimit(info *fnpb.ProvisionInfo) uint64 {
-       if size, err := syscallx.PhysicalMemorySize(); err == nil {
+// 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
        }
        return 1 << 30

Reply via email to