<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<div style="font-size: 10pt; font-family: Verdana,Geneva,sans-serif;">
<p>Hi all,</p>
<p> I would like to report a case where starting jfr for an application running with zgc causes a significant throughput degradation (compared to when JFR is not started).</p>
<p> My context : I was writing a little web app to illustrate a case where the use of ZGC gives a better throughput than with G1. I benchmarked with grafana k6 my application running with G1 and my application running with ZGC : the runs with ZGC gave better throughputs. I wanted to go a bit further in explanation so I began again my benchmarks with JFR to be able to illustrate GC gains in JMC. When I ran my web app with ZGC+JFR, I noticed a significant throughput degradation in my benchmark (which was not the case with G1+JFR).</p>
<p> Although I did not measure an increase in overhead as such, I still wanted to report this issue because the degradation in throughput with JFR is such that it would not be usable as is on a production service.</p>
<p>I wrote a little application (not a web one) to reproduce the problem : the application calls a little conversion service 200 times with random numbers in parallel (to be like a web app in charge and to pressure GC). The conversion service (a method named `convertNumberToWords`) convert the number in a String looking for the String in a Map with the number as th key. In order to instantiate and destroy many objects at each call, the map is built parsing a huge String at each call. Application ends after 200 calls.</p>
<p>Here are the step to reproduce :<br />1. Clone https://framagit.org/FBibonne/poc-java/-/tree/jfr+zgc_impact (be aware to be on branch jfr+zgc_impact)<br />2. Compile it (you must include numbers200k.zip in resources : it contains a 36 Mo text files whose contents are used to create the huge String variable)<br />3. in the root of repository :<br />3a. Run `time java -Xmx4g -XX:+UseZGC -XX:+UseCompressedOops -classpath target/classes poc.java.perf.write.TestPerf #ZGC without JFR`<br />3b. Run `time java -Xmx4g -XX:+UseZGC -XX:+UseCompressedOops -XX:StartFlightRecording -classpath target/classes poc.java.perf.write.TestPerf #ZGC with JFR`<br />4. The real time of the second run (with JFR) will be considerably higher than that of the first</p>
<p>I ran these tests on my laptop :<br />- Dell Inc. Latitude 5591<br />- openSUSE Tumbleweed 20260108<br />- Kernel : 6.18.3-1-default (64-bit)<br />- 12 × Intel® Core™ i7-8850H CPU @ 2.60GHz<br />- RAM 16 Gio<br />- openjdk version "25.0.1" 2025-10-21<br />- OpenJDK Runtime Environment (build 25.0.1+8-27)<br />- OpenJDK 64-Bit Server VM (build 25.0.1+8-27, mixed mode, sharing)<br />- many tabs opened in firefox !</p>
<p>I also ran it in a container (eclipse-temurin:25) on my laptop and with a windows laptop and came to the same conclusions : here are the measurements from the container :</p>
<p>| Run with | Real time (s) |<br />|-----------|---------------|<br />| ZGC alone | 7.473 |<br />| ZGC + jfr | 25.075 |<br />| G1 alone | 10.195 |<br />| G1 + jfr | 10.450 |</p>
<p><br />After all these tests I tried to run the app with an other profiler tool in order to understand where is the issue. I join the flamegraph when running jfr+zgc : for the worker threads of the ForkJoinPool of Stream, stack traces of a majority of samples have the same top lines :<br />- PosixSemaphore::wait<br />- ZPageAllocator::alloc_page_stall<br />- ZPageAllocator::alloc_page_inner<br />- ZPageAllocator::alloc_page</p>
<p>So many thread seem to spent their time waiting in the method ZPageAllocator::alloc_page_stall when the JFR is on. The JFR periodic tasks threads has also a few samples where it waits at ZPageAllocator::alloc_page_stall. I hope this will help you to find the issue.</p>
<p>Thank you very much for reading this email until the end. I hope this is the good place for such a feedback. Let me know if I must report my problem elsewhere. Be free to ask me more questions if you need.</p>
<p>Thank you all for this amazing tool !</p>
<p><br /></p>
<div id="v1_rc_sig"></div>
</div>
</body></html>