ZGC Unable to reclaim memory for long time
Connaughton, Niall
conniall at amazon.com
Wed Nov 6 21:15:38 UTC 2019
ZGC and other pauseless/low pause collectors are designed to allow your process to continue while the GC is running - hence why your pause times are low. The problem is that if your process is still running, it's still allocating. If you are filling up the heap faster than ZGC can keep up, you will have degraded performance. Assuming your allocations are mostly not long-lived, you give ZGC more time to collect by giving it a bigger heap, which takes longer for you to fill.
This is the mindset shift that Peter Booth was referring to earlier. A lot of engineers have developed/been trained into a mindset where smaller heaps are better, particularly by STW GCs like ParallelGC. That approach is not helpful with concurrent collectors, and it's something you can already see with G1GC. In most cases giving G1GC a larger heap will improve performance, but it does depend on your workload and allocation/lifetime pattern.
So the fact ZGC can handle heaps that are TBs in size doesn't mean that you can expect better performance by moving to ZGC and keeping the heap size the same, even if the heap is only a few GB.
Niall
On 11/6/19, 13:05, "zgc-dev on behalf of Sundara Mohan M" <zgc-dev-bounces at openjdk.java.net on behalf of m.sundar85 at gmail.com> wrote:
To be clear "before" i was referring to my previous GC, Parallel/G1/CMS.
Here is what i was seeing
Instance1 - 8G heap, ParallelGC, 100RPS, 200ms Latency
Instance2 - 8G heap, ZGC, 100RPS, 600ms Latency
Instance3 - 32G heap, ZGC, 100RPS, 200ms Latency
My expectation was Instance2 should give me same result as Instance1 but
that is not the case. Instead i had to move to Instance3 setting to get
what i want.
This is just my observation and it might not be same for all workloads.
But on the other hand with ZGC my throughput increased from
*(ParallelGC)97%* to* (ZGC)99.7% *and my STW pauses have never crossed 20ms.
Thanks
Sundar
On Wed, Nov 6, 2019 at 12:47 PM Florian Weimer <fw at deneb.enyo.de> wrote:
> * Sundara Mohan M.:
>
> > Hi Per
> > As per [1] https://wiki.openjdk.java.net/display/zgc/Main it says it
> can
> > handle *few hundred megabytes* to multi terabytes*.*
> >
> > So my understanding was if my application is running with 8G before, with
> > ZGC and same heap also it should run without issues. So far that is not
> > the case i have to increase the heap size always to make sure it gets the
> > same latency/RPS.
>
> What do you mean with “before”? Thanks.
>
More information about the zgc-dev
mailing list