NewRatio: to twiddle or not to twiddle

Charles Oliver Nutter charles.nutter at
Tue Sep 2 12:58:14 PDT 2008

I'm interested in performance characteristics on all collectors, really. 
There's a dearth of information and research on how best to twiddle JVM 
settings for dynlangs, and I think it's high time we changed that.

For the most part I'm talking about server performance, since that's 
what we always recommend people use for fast execution. But the down 
side of server is slower startup/warmup, and JRuby in particular is 
trying to fit into a command-line niche where slow startup is 
unacceptable. So for the most part command-line JRuby forced -client by 
default and makes no other changes to GC settings. This thread and 
others like it (like one I'm starting on jvm-l now) will probably change 

Also, on a side note, is there a good way we could detect that our -XX 
options aren't going to kill startup on a non-hotspot VM? Love the 
nonstandard options...hate the difficulty of knowing when we can use them.

Tom Rodriguez wrote:
> Which collector are you using?  -client defaults to the serial collector 
> which isn't adaptive at all.  -server will use the parallel collector 
> which tries to resize the new generation to improve collector 
> performance.  If you are running with -client try adding 
> -XX:+UseParallelGC.  I often see much better performance with -client 
> just from this change.
> tom
> On Sep 2, 2008, at 11:50 AM, Charles Oliver Nutter wrote:
>> I've ben playing with JRuby on various benchmarks recently and found 
>> that several object-intensive scripts run better if I set NewRatio=1. 
>> Ruby, even more than Java, tends to generate lots and lots of objects, 
>> especially considering that there's no unboxed primitive numeric types 
>> (and no fixnums on the JVM...ahem ahem). So my general theory is that:
>> 1. A NewRatio of 1 allows all those extra transient objects to get 
>> collected more quickly.
>> 2. Too small a "new" generation causes transient objects to get shoved 
>> into older generations, potentially snowballing and forcing more 
>> comprehensive GC runs as time goes on.
>> I'm curious whether this theory sounds reasonable, whether there's a 
>> better way I can adapt hotspot to the memory demands of a dynamic 
>> language like Ruby, and what other implications there are in setting 
>> NewRatio to 1.
>> Thoughts?
>> (And please let me know if there's a better list to post this sort of 
>> question to)
>> - Charlie

More information about the hotspot-dev mailing list