<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
Hi Thomas,
<div><br>
</div>
<div>If I understand the conversation, what is referred to is something like this in ZGC style AHS:</div>
<div><a href="https://github.com/openjdk/zgc/blob/c87666fbda432c9c9d19d6871859b8c195476f6c/src/hotspot/share/gc/z/zAdaptiveHeap.cpp#L505">https://github.com/openjdk/zgc/blob/c87666fbda432c9c9d19d6871859b8c195476f6c/src/hotspot/share/gc/z/zAdaptiveHeap.cpp#L505</a><br>
</div>
<div><br>
</div>
<div>and:</div>
<div><a href="https://github.com/openjdk/zgc/blob/c87666fbda432c9c9d19d6871859b8c195476f6c/src/hotspot/share/gc/z/zAdaptiveHeap.cpp#L515">https://github.com/openjdk/zgc/blob/c87666fbda432c9c9d19d6871859b8c195476f6c/src/hotspot/share/gc/z/zAdaptiveHeap.cpp#L515</a><br>
</div>
<div><br>
</div>
<div>The reasoning here is that if you have a process that utilizes 1% of the machine CPU resources but 50% of the memory resources, you might not want to bloat memory with lots of garbage to reduce fraction of that 1% that is spent of GC. In that situation,
having a 100% CPU overhead so that the JVM uses 2% of the overall machine CPU, while saving a huge amount of the available RAM, is preferable. In other words, the CPU overhead target depends on the resource balance of unused machine resources, as well as a
resource balance of the process used resources.</div>
<div><br>
</div>
<div>In terms of use cases, containers without resource constraints or partial resource constraints, is one application. Multi process situations would be another one.</div>
<div><br>
</div>
<div>/Erik</div>
<div></div>
<div>
<div><br>
</div>
<div><br>
<blockquote type="cite">
<div>On 27 Jan 2026, at 19:00, Thomas Schatzl <thomas.schatzl@oracle.com> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div>Hi all,<br>
<br>
On 24.01.26 08:28, shaojun wang wrote:<br>
<blockquote type="cite">Hi Men Cao<br>
I read one openjdk bug which discuss G1 heap adaptive resizing feature, and I noticed that you mention one question like this:<br>
image.png<br>
and then you mentioned that you were convinced that the proposed approach does not suffer from this issue. This is because the proposed approach<br>
does not rely on the total process CPU usage, and does not measure "GC CPU overhead", i.e., a ratio of GC CPU usage over total CPU usage.<br>
image.png<br>
my question is that even with GCTimeRatio(gc time / (gc time + app time)) , the problem will still exist if the application<br>
fall into a very low cpu cost state. for example, gc_time = 30, app_time=40,GCTimeRatio is: 30/(30+40)= 0.42, the g1<br>
heap size policy will try to extend heap size to scale down GCTimeRatio。But actually the application doesn't care about<br>
its performance at all under the state,because there is basically no or merely request for the app. Do you have idea about<br>
it?<br>
https://github.com/openjdk/jdk/pull/24211 <https://github.com/openjdk/ jdk/pull/24211><br>
https://bugs.openjdk.org/browse/JDK-8359348 <https://bugs.openjdk.org/ browse/JDK-8359348><br>
</blockquote>
just to confirm your use case:<br>
<br>
- The application is doing nothing ("because there is basically no or<br>
merely [rarely?] request for [from?] the app.")<br>
<br>
- _GC_ cpu usage is high.<br>
<br>
The failure is that G1 would expand the heap due to the GCTimeRatio based heap sizing? Or keep heap size as is, at a probably too large value, compared to pre-GCTimeRatio sizing?<br>
<br>
My request is to give an example where GC cpu usage is high and there is little application activity?<br>
<br>
Considering "activity" as memory allocation activity, as GC only triggers lazily because of allocation.<br>
<br>
Thanks,<br>
Thomas<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</body>
</html>