Remove the default value of InitialRAMPercentage

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: None
    • Component/s: hotspot
    • gc

      Defaulting `InitialHeapSize` to `MinHeapSize` (unless explicitly overridden) brings several advantages. Most importantly, it provides simplicity and predictability, ensuring users can easily understand the default behavior of the `InitialRAMPercentage` flag. This step aligns closely with existing JVM ergonomics, since specifying `-Xms` already sets both `MinHeapSize` and `InitialHeapSize`, making their connection explicit, intuitive, and consistent for users.

      It is important to emphasize that selecting a default value for `InitialRAMPercentage` fundamentally involves a trade-off between startup and runtime performance. A larger initial heap size grants the GC more headroom initially, potentially reducing early GC cycles and resizing events. In contrast, a smaller initial heap can result in more GC activity and resizing as the heap fills up and adjusts to demand at runtime. However, it is extremely challenging to pick a single numeric default that suits the needs of most applications, given their diversity. Therefore, we propose to always choose the minimum possible initial heap size, as this consistently optimizes for startup performance. For users more concerned with runtime performance than startup, they are always able to explicitly configure `-Xms` or `InitialRAMPercentage` to meet their requirements.

      By making this the default behavior, we effectively remove opaque GC heuristics and provide a consistent, predictable starting point that is easy to understand and reason about. If the user hasn't specified their preferences, we optimize for what can be objectively beneficial, faster startup, while allowing users to tune for other needs as appropriate.

      From a performance perspective, minimizing the initial heap size leads to faster startup, as targeted by JDK-8353837. Adaptive heap growth ensures that additional memory requirements can still be met efficiently as the application runs. We share the same concerns and observations highlighted in JDK-8353837: depending on the heap sizing policy of the chosen garbage collector, reducing the initial heap may trigger more frequent resizings until a stable heap size is reached. However, this behavior is generally not an issue for small, out-of-the-box applications. For long-running or production workloads, the impact is expected to be minimal since most memory-conscious applications already set `-Xms` explicitly, which overrides the `InitialRAMPercentage` setting. This approach aligns with current usage patterns, making the default `InitialRAMPercentage` largely redundant and occasionally confusing. By directly tying the initial heap allocation to `MinHeapSize`, we prevent non-intuitive scaling based on host memory size, leading to more consistent and predictable behavior across a wide range of environments.

            Assignee:
            Joel Sikström
            Reporter:
            Joel Sikström
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: