How to do force full garbage collection when heap usage goes beyond a certain threshold

Pas pasthelod at gmail.com
Mon Feb 24 19:49:39 UTC 2020


Hello,

I recommend CCing the list, as I'm just a regular JVM user, and it's
not exactly unlikely that my advice is sub par. :)

On Mon, 24 Feb 2020 at 18:49, mohd shaban <mohdshaban000123 at gmail.com> wrote:
>
> Hi Pas ,
>
> If we are not using "XX:InitiatingHeapOccupancyPercent" this JVM arguments , then still default value of that parameter is 45% so when Heap usage reaches to 45 it should trigger the GC but it is not triggering the GC. Or do we need to set this parameter then it will work?.

Which version are you using exactly? Also do you have GC logging
enabled? (-verbose:gc -XX:+PrintGCDetails) How big is the heap? (Do
you use Xms and Xmx? Do you set them to equal value?)

Furthermore, IHOP is defined in terms of "Old Gen", but there is also
the "Young Gen" ("Eden" and "Survivor" regions), and Metaspace too, so
45% of "Old Gen" requires quite a few GC cycles which gradually move
the surviving objects to the "Old Gen", and when "Old Gen" reaches 45%
then you should see the beginning of a Marking phase for the Old Gen.
(Or more likely a Mixed collection.)

>
>
> And one more thing i want to understand , is it recommended to use "UseStringDeduplication" jvm arguments. if yes then is there any disadvantage if using this option?
>

If your application has a lot of identical strings, then yes, it's
recommended. But it has a cost to scan all the strings (that survived
a few GCs already). Of course if you have good monitoring/telemetry,
then just flip it on, measure, and decide based on your measurement.

> Thanks,
> Mohd Shaban


Pas

>
> On Mon, Feb 24, 2020 at 2:38 PM Pas <pasthelod at gmail.com> wrote:
>>
>> Hello,
>>
>> Are you familiar with how Initiating Heap Occupancy Percent works in G1? Do you want something else?
>>
>>
>> https://docs.oracle.com/javase/9/gctuning/garbage-first-garbage-collector.htm#JSGCT-GUID-572C9203-AB27-46F1-9D33-42BA4F3C6BF3
>>
>> https://docs.oracle.com/en/java/javase/13/gctuning/garbage-first-garbage-collector.html#GUID-AC383806-7FA7-4698-8B92-4FD092B9F368
>>
>>
>>
>> Pas
>>
>>
>>
>> On Mon, Feb 24, 2020, 08:45 mohd shaban <mohdshaban000123 at gmail.com> wrote:
>>>
>>> Hi Team,
>>>
>>> Is there a way to force GC when heap usage goes beyond a certain threshold?.
>>> I am using G1GC Algorithm.
>>>
>>> Thanks,
>>> Mohd Shaban
>>> _______________________________________________
>>> hotspot-gc-use mailing list
>>> hotspot-gc-use at openjdk.java.net
>>> https://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use


More information about the hotspot-gc-use mailing list