<br><br><div class="gmail_quote">On Mon, Mar 15, 2010 at 12:03 PM, Jon Masamitsu <span dir="ltr"><<a href="mailto:Jon.Masamitsu@sun.com">Jon.Masamitsu@sun.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hiroshi,<br>
<br>
I'm looking at the code in psParallelCompact.cpp<br>
<br>
2076 bool free_ratio_in_effect = false;<br>
2077 if ((UseFreeRatioForParallelGC ||<br>
2078 (UseFreeRatioOnlyInSystemGCForParallelGC &&<br>
2079 gc_cause == GCCause::_java_lang_system_gc))) {<br>
2080 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();<br>
2081 free_ratio_in_effect = heap->try_to_shrink_by_free_ratio(true);<br>
2082 }<br>
2083<br>
2084 if (!free_ratio_in_effect && UseAdaptiveSizePolicy) {<br>
<br>
If only UseFreeRatioForParallelGC is set to true, is it correct<br>
that the heap<br>
<br>
a) will grow according to the original UseAdaptiveSizePolicy<br>
policy until MaxHeapFreeRatio is exceeded (i.e., until<br>
try_to_shrink_by_free_ratio() returns true)<br>
b) will then shrink until MaxHeapFreeRatio is no longer exceeded<br>
(likely just that once)<br>
<br>
then start with a) again?<br></blockquote><div><br>I think that mostly matches my intention. The cyclical pattern (a->b->a->b->...) is assumed not to happen more often than necessary though. An expectation is that the value of MaxHeapFreeRatio is high enough (70 by default) that the b) only happens when the app is under reasonably light(er) load (or just idle.) UseFreeRatioOnlyInSystemGCForParallelGC (instead of UseFreeRatioForParallelGC ) is for apps that call System.gc() to give a hint about the need to have its heap shrunk and want to avoid heap shrinking otherwise.<br>
<br>An intuition is the following. To reduce the memory footprint, the free ratio logic holds back the heap expansion if the original adaptive size policy expands too aggressively, or overrides and shrink the heap if the original adaptive size policy leaves too much free space, in terms of the value of MaxHeapFreeRatio. I think it's not far from what flag MaxHeapFreeRatio originally meant. Otherwise, the heap size depends on the original adaptive size policy (for performance.) It's a tradeoff between performance and footprint.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
What type of application fits with such a combination of policies?<br>
Do you have a plots of how the heap sizing behaves (i.e., size of the<br>
generations vs. collections/time)?<br></blockquote><div><br>The reason to combine the two logics (size policies) isn't for particular applications. I don't get too surprised if you say it should be a separate size policy and leave the original adaptive size policy alone. My thinking is that users may want the same level of performance from the parallel collector (the adaptive size policy is enabled by default) unless a large part of the heap (> 70% by default) is free. This is my attempt to get the best of both. The flags are off by default since of course, not all applications need to have their heap shrunk this way.<br>
<br>No, I don't have plots.<br>
<br>Hiroshi<br><br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Jon<br>
<br>
Hiroshi Yamauchi wrote On 03/10/10 15:17,:<br>
<div class="im"><br>
> Hi,<br>
><br>
> I'd like to have this patch<br>
><br>
> <a href="http://cr.openjdk.java.net/%7Erasbold/69XXXXX/webrev.00/" target="_blank">http://cr.openjdk.java.net/~rasbold/69XXXXX/webrev.00/</a><br>
</div>> <<a href="http://cr.openjdk.java.net/%7Erasbold/69XXXXX/webrev.00/" target="_blank">http://cr.openjdk.java.net/%7Erasbold/69XXXXX/webrev.00/</a>><br>
<div><div></div><div class="h5">><br>
> contributed, if appropriate.<br>
><br>
> It implements a simple heap shrinking logic based on the free ratio<br>
> (MaxHeapFreeRatio) in the parallel collector. The way it works is the<br>
> following: If the free ratio, (1.0 - <used> / <capacity>) * 100 ><br>
> MaxHeapFreeRatio, this logic kicks in. Otherwise, the (default)<br>
> adaptive size policy runs the show (as before). This feature is turned<br>
> off by default. There are two new flags to turn it on:<br>
><br>
> UseFreeRatioForParallelGC - this enables it.<br>
> UseFreeRatioOnlyInSystemGCForParallelGC - this enables it only in<br>
> explicit System.gc() calls. This is more useful in apps that call<br>
> System.gc() when it's idle and don't want shrinking to happen at all<br>
> other times.<br>
><br>
> In our tests, it appears to work well in a simple test and to help a<br>
> real app reduce its footprint (RSS) when it's idle.<br>
><br>
> Thanks to Chuck Rasbold who uploaded the webrev on my behalf.<br>
><br>
> Thanks,<br>
> Hiroshi<br>
><br>
<br>
</div></div></blockquote></div><br>