<div dir="ltr">Thanks Stefan for letting me know all the details, really appreciated! </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 29, 2024 at 10:53 AM Stefan Johansson <<a href="mailto:stefan.johansson@oracle.com">stefan.johansson@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Roy,<br>
<br>
On 2024-08-27 11:44, Roy Zhang wrote:<br>
> Dear ZGC experts,<br>
> <br>
> We are using ZGC on JDK17 (AWS JDK17, OpenJDK 64-Bit Server VM <br>
> (17.0.10+8-LTS) for linux-amd64 JRE (17.0.10+8-LTS), built on Feb  6 <br>
> 2024 19:58:14 by "jenkins" with gcc 7.3.1 20180303 (Red Hat 7.3.1-5)), <br>
> from JFR, we found there are several consecutive Allocation Stall event, <br>
> high GC duration (8s+) but low pause(<< 1ms), and our health check <br>
> failed (2s timeout) during that period, no safepoint begin(default 10ms <br>
> threshold) JFR event.<br>
> <br>
<br>
The events you shared are the Garbage Collection JFR events following an <br>
allocation stall, not the stalls themselves. There is a specific event <br>
named jdk.ZAllocationStall that, if enabled, provide more information <br>
about the actual allocation stalls. Those will show you what threads are <br>
being stalled and for how long.<br>
<br>
> I am curious, will ZGC allocation stall  block the application to serve <br>
> health check requests during the whole phase (8s+)?  Otherwise I can't <br>
> understand why the health check will fail?<br>
> <br>
<br>
The allocation stalls are per thread, so when an application threads <br>
needs to allocate and it can't be satisfied it will stall. This will <br>
also kick off a garbage collection with the "Allocation Stall" cause <br>
(the ones you see). Other threads can continue to run until they need to <br>
do an allocation that can't be satisfied (which hopefully can be avoided <br>
by the GC freeing up memory).<br>
<br>
You should also keep in mind that when running into allocation stalls, <br>
ZGC is not able to fully keep up with the allocation pressure. You <br>
should look at tuning your instance to avoid this. You can try <br>
increasing the heap size or allow ZGC to use more concurrent GC threads. <br>
An even better alternative, if possible, would be to try out JDK 21 and <br>
use generational ZGC (-XX:+ZGenerational). The generational version of <br>
ZGC can usually handle high allocation pressure better than single <br>
generational ZGC.<br>
<br>
Hope this helps,<br>
StefanJ<br>
<br>
> Really appreciate ur great help in advance!<br>
> <br>
> image.png<br>
> image.png<br>
> image.png<br>
> <br>
> Thanks<br>
> Roy<br>
</blockquote></div>