<div dir="ltr">Thanks Marcus and Erik.<br><div><br></div><div><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none">HeapMemoryAfterGC - Our service framework in Amazon emits a JMX metrics for HeapMemoryAfterGC - i.e. the percent occupancy of the part of the Java heap<span> </span></span><i style="box-sizing:inherit;color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial">that excludes Eden</i><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none"><span> </span>by both live and garbage objects<span> </span></span><i style="box-sizing:inherit;color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial">after the last collection that affected that part of the Java heap</i><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none">. It is<span> </span></span><i style="box-sizing:inherit;color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial">not</i><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none"><span> </span>an instantaneously measured value: it changes<span> </span></span><i style="box-sizing:inherit;color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial">only after</i><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none"><span> </span>a collection. HeapMemoryAfterGCUse stays fairly constant.</span></div><div><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none"><br></span></div><div><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none">Heap memory Xmx and Xms values are set to 24G on the server The rise is from 10% to 30%. When I disable the JFR VM params, the HeapMomoryAfterGCuse falls bacl to 5-10%. So its the enables of JFR causing the issue.<br></span></div><div><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none"><br></span></div><div><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:common-ligatures;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:normal;background-color:rgb(248,248,248);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none">Do you think additional JVM parameters could cause the issue though I have capped the memory to 60MB.<br></span></div><div><span style="color:rgb(224,30,90);font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;font-style:normal;font-variant-ligatures:none;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:pre-wrap;background-color:rgba(29,28,29,0.04);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none">-XX:StartFlightRecording=name=SomeServiceJFR,disk=false,path-to-gc-roots=false -XX:FlightRecorderOptions=stackdepth=256,memorysize=60M,numglobalbuffers=2,globalbuffersize=30M,old-object-queue-size=64</span></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Feb 24, 2024 at 6:02 PM Marcus Hirt <<a href="mailto:marcus@hirt.se" target="_blank">marcus@hirt.se</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"><div><div lang="en-CH"><div><p class="MsoNormal"><span style="font-size:11pt">Hi Gaurav,<br><br>I’ve invited you to the JMC slack.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt">Kind regards,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt">Marcus<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p><div><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0cm 0cm"><p class="MsoNormal"><b><span lang="EN-US" style="font-size:11pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11pt;font-family:"Calibri",sans-serif"> jmc-dev <<a href="mailto:jmc-dev-retn@openjdk.org" target="_blank">jmc-dev-retn@openjdk.org</a>> <b>On Behalf Of </b>Erik Gahlin<br><b>Sent:</b> Saturday, 24 February 2024 11:09<br><b>To:</b> Gaurav Gupta <<a href="mailto:geniusgaurav27@gmail.com" target="_blank">geniusgaurav27@gmail.com</a>>; <a href="mailto:hotspot-jfr-dev@openjdk.org" target="_blank">hotspot-jfr-dev@openjdk.org</a>; <a href="mailto:jmc-dev@openjdk.org" target="_blank">jmc-dev@openjdk.org</a><br><b>Subject:</b> Re: JFR causes spike in HeapMemoryAfterGC in prod ssystems<u></u><u></u></span></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal"><span style="color:black">Hi Guarav,<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="color:black"><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="color:black">>  it is claimed to be safe in prod systems with continuous JFR profiling.</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="color:black">The overhead should be less than 1% by default (-XX:StartFlightRecording, no other options) and it should not crash, cause memory leaks etc. if you run it for a long time.</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="color:black">I don't know where the HeapMemoryAfterGC metric comes from. Is it something shown in JMC? We don't have targets for memory usage. That said, JFR should probably not use more than 50 MB of the Java heap, so if 30% is normal or not depends on how large heap you are using.</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="color:black">There is a slack channel for JMC developers. I don't manage it and I'm not sure if this is really a bug.</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="color:black"><a href="https://wiki.openjdk.org/display/jmc/Contributing" target="_blank">https://wiki.openjdk.org/display/jmc/Contributing</a></span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="color:black">Best regards,</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="color:black">Erik</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="color:black"><u></u> <u></u></span></p></div><div class="MsoNormal" align="center" style="text-align:center"><hr size="2" width="98%" align="center"></div><div id="m_-4765585040214848765m_-3690963903267059490divRplyFwdMsg"><p class="MsoNormal"><b><span style="font-size:11pt;font-family:"Calibri",sans-serif;color:black">From:</span></b><span style="font-size:11pt;font-family:"Calibri",sans-serif;color:black"> hotspot-jfr-dev <<a href="mailto:hotspot-jfr-dev-retn@openjdk.org" target="_blank">hotspot-jfr-dev-retn@openjdk.org</a>> on behalf of Gaurav Gupta <<a href="mailto:geniusgaurav27@gmail.com" target="_blank">geniusgaurav27@gmail.com</a>><br><b>Sent:</b> Friday, February 23, 2024 6:26 AM<br><b>To:</b> <a href="mailto:hotspot-jfr-dev@openjdk.org" target="_blank">hotspot-jfr-dev@openjdk.org</a> <<a href="mailto:hotspot-jfr-dev@openjdk.org" target="_blank">hotspot-jfr-dev@openjdk.org</a>>; <a href="mailto:jmc-dev@openjdk.org" target="_blank">jmc-dev@openjdk.org</a> <<a href="mailto:jmc-dev@openjdk.org" target="_blank">jmc-dev@openjdk.org</a>><br><b>Subject:</b> JFR causes spike in HeapMemoryAfterGC in prod ssystems</span> <u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p></div></div><div><p class="MsoNormal"><span style="color:black">Hi Team, </span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="color:black">I am Gaurav Gupta, Principal Engineer at Amazon India (<a href="mailto:gagup@amazon.com" target="_blank">gagup@amazon.com</a>). My team is trying to enable JFR on production systems for studying any issues using custom events in JMC. Also we plan to study the impact of code changes in our application on system performance by studying JFR dumps using JMC and Flamescope (sub-second profiling).</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="color:black">We tried enabling JFR in our prod system by adding following JVM args in our application startup (we have not yet added any custom event in our code:</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9pt;font-family:Consolas;color:rgb(224,30,90)">-XX:+FlightRecorder -XX:StartFlightRecording=name=SomeServiceJFR,disk=false,path-to-gc-roots=false -XX:FlightRecorderOptions=stackdepth=256,memorysize=60M,numglobalbuffers=2,globalbuffersize=30M,old-object-queue-size=64</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="color:black">(The reason we turned off the disk parameter is to avoid disk space issues during spiky traffic. We plan to take JFR dump on demand basis by running JFR.dump command line option to study application behavior and keep JFR recording on all the time).</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12pt"><span style="color:black">We saw the system performance metrics on HeapMemoryAfterGC rising from 5% to 30% (on our test fleet) after starting our application with above JVM args (i.e. with JFR enabled). As per our reading about JFR, it is claimed to be safe in prod systems with continuous JFR profiling. But the rise of the HeapMemory use raised concern.</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="color:black">I seek your advice in this regard, if we are missing anything (wrt parameter configuration above) or are there other options to try without affecting the prod system.</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="color:black">Also, is there a slack channel that I join for live discussion in this regard? How can I get added?</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="color:black">PS: I won't be able to share the JFR dump file outside Amazon as it records events and stack traces for our proprietary software. But I am happy to come to a meeting on slack or other means and discuss this. Slack email: <a href="mailto:gagup@amazon.com" target="_blank">gagup@amazon.com</a></span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="color:black"><br>--</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-family:"Garamond",serif;color:black">Best regards,</span><span style="color:black"><br></span><b><span style="font-size:10pt;font-family:"Garamond",serif;color:rgb(0,204,204)">Gaurav Gupta</span></b><span style="color:black"><br><br></span><span style="font-family:"Garamond",serif;color:rgb(51,0,153)">-------------------------------------------------------------------------------------------------------------------------------</span><span style="color:black"><br></span><i><span style="font-family:"Garamond",serif;color:rgb(51,0,153)">"Perfection is achieved not when there is nothing more to add,but rather when there is nothing more to take away."</span></i><u></u><u></u></p></div></div></div></div></blockquote></div><br clear="all"><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><span style="font-family:garamond,serif;color:rgb(0,0,0)">Best regards,</span><br style="font-family:garamond,serif;color:rgb(153,51,153)"><font style="color:rgb(0,204,204)" size="2"><b style="font-family:garamond,serif">Gaurav Gupta</b><span style="font-family:garamond,serif"></span></font><br style="font-family:courier new,monospace;color:rgb(153,51,153)"><font size="2"></font><br><span style="color:rgb(51,0,153);font-family:garamond,serif">-------------------------------------------------------------------------------------------------------------------------------</span><br style="color:rgb(51,0,153);font-family:garamond,serif"><i style="color:rgb(51,0,153);font-family:garamond,serif">"Perfection is achieved not when there is nothing more to add,but rather when there is nothing more to take away."</i><br></div></div>