Free ratio based heap shrinking in the parallel collector

Jon Masamitsu Jon.Masamitsu at Sun.COM
Fri Mar 19 17:04:08 UTC 2010


Hiroshi Yamauchi wrote On 03/18/10 11:27,:

>
>
>
>  
>
>
>     There is a method
>
>     PSAdaptiveSizePolicy::adjust_for_throughput()
>
>     which is called to calculate the amount that the heap
>     should grow in order to achieve a throughput goal.
>     If that method said not to increase the heap based
>     on the value of MaxHeapFreeRatio is that close to
>     what you want?  It's not the same but it would be
>     a way of limiting the growth of the heap (stops
>     growing the heap when the free space after the collection
>     exceeds a threshold).  I think it would fit in more
>     easily with the rest of UseAdativeSizePolicy.  I think
>     it would be easier to explain too.
>
>
> I think even if adjust_for_throughput tries to limit the growth that
> way in each invocation of it, it's likely that the heap will
> eventually fully expanded with enough amount of load (and objects).
> So, it could delay the expansion under light load. But I think the key
> here is to be able to shrink the heap after it is expanded. It looks
> to me that adjust_for_throughput never shrinks the size. If I'm not
> mistaken, it's closer, but not quite there, I think.
>
You're right that adjust_for_throughput() will not shrink the heap.
Another part of the policy is that the heap is shrunk if the
throughput goal and the pause time goal are being
met.   It's a slower process than just enforcing MaxHeapFreeRatio
and requires a number of GC's (that is, the heap would be
shrunk down a percentage at each GC).    We would
need to change the UseAdaptiveSizePolicy to do something like


if ( average-pause > pause-goal)
          shrink heap
else if (average-throughput < throughput-goal) &&
            ! (UseFreeRatioForParallelGC && heap too empty))  <<<< new
         grow heap
else
         shrink heap


Or maybe something like


if ( average-pause > pause-goal)
          shrink heap
else if (average-throughput < throughput-goal)
          if  (UseFreeRatioForParallelGC && heap too empty)    <<<< new
                 shrink heap (policy-to-be-determined)         <<<<
          else                                                 <<<<
                 grow heap
else if (average-throughput < throughput-goal)
         grow heap to reduce gc overhead
else
         shrink heap




More information about the hotspot-gc-dev mailing list