Runtime.getRuntime().freeMemory() with ZGC
Mike Rettig
mike.rettig at gmail.com
Tue Jun 8 18:28:13 UTC 2021
On Tue, Jun 8, 2021 at 2:07 AM Per Liden <per.liden at oracle.com> wrote:
> Check. Yes, proactive GCs can currently only be turned on or off, i.e.
> there is currently no other configuration option to influence it.
>
> /Per
>
ZGC has 3 powerful features that every app should be able to leverage.
1. Very short, predictable pause times
2. Idle detection for low impact collections
3. Dynamic heap management with the ability to commit/uncommit memory as
needed.
Unfortunately I think I've explored all the possible options and haven't
found a suitable configuration that can fully utilize these features while
minimizing pauses and memory usage.
Proactive pauses are too frequent. Attempting to do collections during idle
periods is great, but the future cannot be predicted. Stopping user threads
should be avoided unless there is a compelling reason. Similarly, interval
collections will be too frequent and could run during a time when the app
is under heavy load and with plenty of heap available.
SoftMaxHeapSize is a fixed value so determining an ideal value for
different hardware and load is very difficult.
Is there any chance that a new option could be added so the current heap
could be used to determine if a proactive pause is needed?
With that option, ZGC would be trivial to configure to utilize its
strengths. Proactive pauses would only run when the app is idle and there
is a compelling reason to do so. The heap can grow to accommodate
allocation spikes and then shrink if the app is idle for long periods.
Most apps would require at most three jvm options to minimize pauses and
efficiently use memory.
-Xms -Xmx -XX:ZProactiveMinHeapPercent
Mike
More information about the zgc-dev
mailing list