United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6427025 CMS: NewRatio ignored in the setting of NewSize and MaxNewSize
JDK-6427025 : CMS: NewRatio ignored in the setting of NewSize and MaxNewSize

Details
Type:
Bug
Submit Date:
2006-05-17
Status:
Resolved
Updated Date:
2010-04-02
Project Name:
JDK
Resolved Date:
2006-06-29
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
1.4.2_10
Fixed Versions:

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
See comments section.

                                    

Comments
EVALUATION

I have a simple 2-line fix for Mustang, which can be
backported to Tiger and 1.4.2_XX as needed by customer(s).
                                     
2006-05-17
WORK AROUND

E$xplicitly use NewSize=... MaxNewSize=...
to set the new generation size.
                                     
2006-05-17
SUGGESTED FIX

The 2-line fix was rolled in as part of CR 6407949. See that CR for
the complete putback details. The relevant diffs for this CR are:

@@ -1020,13 +1036,20 @@
       FLAG_SET_DEFAULT(MaxNewSize, MAX2(NewSize, preferred_max_new_size));
     } else {
       FLAG_SET_DEFAULT(MaxNewSize, preferred_max_new_size);
     }
   }
-  size_t min_new  = align_size_up(ScaleForWordSize(4*M), os::vm_page_size());
-  size_t max_heap = align_size_down(MaxHeapSize,CardTableRS::ct_max_alignment_constraint());
+  // Unless explicitly requested otherwise, prefer a large
+  // Old to Young gen size so as to shift the collection load
+  // to the old generation concurrent collector
+  if (FLAG_IS_DEFAULT(NewRatio)) {
+    FLAG_SET_DEFAULT(NewRatio, MAX2(NewRatio, new_ratio));
+  
+    size_t min_new  = align_size_up(ScaleForWordSize(min_new_default), os::vm_page_size());
                     // MaxHeapSize is aligned down in collectorPolicy
+    size_t max_heap = align_size_down(MaxHeapSize,
+                                      CardTableRS::ct_max_alignment_constraint());
 
   if (max_heap > min_new) {
     // Unless explicitly requested otherwise, make young gen
     // at least min_new, and at most preferred_max_new_size.
     if (FLAG_IS_DEFAULT(NewSize)) {
@@ -1033,28 +1056,23 @@
       FLAG_SET_DEFAULT(NewSize, MAX2(NewSize, min_new));
       FLAG_SET_DEFAULT(NewSize, MIN2(preferred_max_new_size, NewSize));
     }
     // Unless explicitly requested otherwise, size old gen
     // so that it's at least 3X of NewSize to begin with;
-    // later NewRatio will decide how it grows; see below.
+      // later NewRatio will decide how it grows; see above.
     if (FLAG_IS_DEFAULT(OldSize)) {
       if (max_heap > NewSize) {
         FLAG_SET_DEFAULT(OldSize, MIN2(3*NewSize,  max_heap - NewSize));
       }
     }
   }
-  // Unless explicitly requested otherwise, prefer a large
-  // Old to Young gen size so as to shift the collection load
-  // to the old generation concurrent collector
-  if (FLAG_IS_DEFAULT(NewRatio)) {
-    FLAG_SET_DEFAULT(NewRatio, MAX2(NewRatio, (intx)15));
   }
                                     
2006-06-20
EVALUATION

The fix has been putback to Mustang and is available for backport to
Tiger and Mantis; see suggested fix section.
                                     
2006-06-20
SUGGESTED FIX

The above changes were made as part of CR 6407949:-

Event:            putback-to
Parent workspace: /net/jano.sfbay/export/disk05/hotspot/ws/main/gc_baseline
                  (jano.sfbay:/export/disk05/hotspot/ws/main/gc_baseline)
Child workspace:  /net/prt-web.sfbay/prt-workspaces/20060616171045.ysr.defaults/workspace
                  (prt-web:/net/prt-web.sfbay/prt-workspaces/20060616171045.ysr.defaults/workspace)
User:             ysr

Comment:

---------------------------------------------------------

Job ID:                 20060616171045.ysr.defaults
Original workspace:     karachi:/net/spot/scratch/ysr/defaults
Submitter:              ysr
Archived data:          /net/prt-archiver.sfbay/data/archived_workspaces/main/gc_baseline/2006/20060616171045.ysr.defaults/
Webrev:                 http://analemma.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/gc_baseline/2006/20060616171045.ysr.defaults/workspace/webrevs/webrev-2006.06.16/index.html

Fixed 6407949: CMS: revisit and retune default settings of Eden, Survivor Spaces etc.

  Webrev: http://analemma.sfbay/net/spot/scratch/ysr/defaults/webrev

It has been apparent for a while that the current default settings
of CMS, especially its policy of "promote all survivors"
was suboptimal for typical configurations where it would
place excessive pressure on the old gen allocation as well
as collection, in some cases leading to avoidable
concurrent mode failure and/or an excessively fragmented
heap. At the same time, the march of progress means that
machines come with more memory than was the case when these
defaults were chosen, memory is slightly faster and CPU's
are much faster. (Of course, low pause applications are
also more demanding and stringent in their requirements
but we'll assume that in those cases most users will tune
their heaps much more carefully in those cases and ignore
that particular demographic for the purposes of setting
defaults.) It has also become abundantly clear from recent
usage feedback and experience that CMS is used much more
in large heap server settings than in small heap client
settings. Indeed, for small heaps it is expected that
stop world serial or parallel gc might be competitive
for a while yet, especially considering the footprint
and start-up  penalties measured sometime ago with CMS.

This putback revises the defaults so as to use a larger
young generation as well as enabling the use of survivor spaces.
The values used were determined based on a slew of runs in the
vicinity of the old and new values and choosing an optimal
number that did not trade off much in pause times while
improving throughput. The result is that for server benchmarks
there's an across the board reduction in GC overheads
and concommitant improvement in application throughput and scores.
For the client benchmarks there is the expected increase
in footprint even though there's the expected reduction in
GC time overheads. GC pauses increase only by a few percent
whereas GC overheads decline several-fold. This thus appears
to be a good server-centric OOB performance tradeoff.

While testing this code, I tweaked the triggering threshold
computation so as to account for the fact that the
computation normally obtains at the end of a scavenge.
This causes slightly earlier triggering than before and
avoids some "close to the edge" concurrent mode failures
because of starting the just-in-time collection a wee-bit
too late. During that exercise I found the data in
PrintCMSInitiationStatics useful, so converted it to
a product flag to allow use in product builds; the overhead
is negligible even when enabled.

Note that the use of survivor spaces regresses the
CMS initial checkpoint/mark pause times by a factor
that brings them close to the cms remark times.
This is being addressed in CR 6412968 for Mustang RC.

Also included is a CMSUseOldDefaults flag (set to false)
that will, if switched on, revert to the old CMS
defaults for these tunables.

Reviewed by: J. Masamitsu, T. Printezis, A. Petrusenko
Approved by: Mustang Core Team (Azar Nohadani)

Fix Verified: yes

Verification Testing:  (performance)
  . refworkloads, client and server with CMS and iCMS;
    see bug report for summary data and pointers to logs.

Other testing:
  . PRT

Files:
update: src/share/vm/memory/concurrentMarkSweepGeneration.cpp
update: src/share/vm/runtime/arguments.cpp
update: src/share/vm/runtime/globals.hpp

Examined files: 3849

Contents Summary:
       3   update
    3846   no action (unchanged)
                                     
2006-06-20



Hardware and Software, Engineered to Work Together