JVM options to turn server into client?

221 views
Skip to first unread message

Charles Oliver Nutter

unread,
Nov 8, 2010, 10:46:10 AM11/8/10
to JVM Languages
More and more folks are running on 64-bit systems these days, and as a
result more people are having to cope with Hotspot's 64-bit JVM only
having a "server" mode. Given server mode's dreadful startup
characteristics, this has started to turn people off using JRuby (and
probably other projects) at the command line, since it can take as
much as an order of magnitude longer to boot e.g. rails applications
in server mode.

So I'm looking for ways to solve this.

So far I've managed to cut about 1/4 of the time off a typical startup
by passing -XX:CompileThreshold=1500 and -XX:-Inline, hoping to make
the server compiler mimic more closely what the client compiler does.
This definitely does help, trimming off as much as 25-30%. It's still
not as fast as client though, and this doesn't seem to work on all
platforms (worked on an EC2 Linux instance, didn't work on my home
Linux box.

I've tried TieredCompilation as well, with b117 of the JDK7 EA, and it
did not appear to start up much faster than straight-up server mode.

I'm curious if anyone else has ideas for flags to speed up server mode.

- Charlie

Rémi Forax

unread,
Nov 9, 2010, 3:09:28 AM11/9/10
to jvm-la...@googlegroups.com
Hi Charles,

Le 08/11/2010 16:46, Charles Oliver Nutter a �crit :


> More and more folks are running on 64-bit systems these days, and as a
> result more people are having to cope with Hotspot's 64-bit JVM only
> having a "server" mode. Given server mode's dreadful startup
> characteristics, this has started to turn people off using JRuby (and
> probably other projects) at the command line, since it can take as
> much as an order of magnitude longer to boot e.g. rails applications
> in server mode.

Do you try profile the rails apps + your runtime ?

> So I'm looking for ways to solve this.
>
> So far I've managed to cut about 1/4 of the time off a typical startup
> by passing -XX:CompileThreshold=1500 and -XX:-Inline, hoping to make
> the server compiler mimic more closely what the client compiler does.
> This definitely does help, trimming off as much as 25-30%. It's still
> not as fast as client though, and this doesn't seem to work on all
> platforms (worked on an EC2 Linux instance, didn't work on my home
> Linux box.
>
> I've tried TieredCompilation as well, with b117 of the JDK7 EA, and it
> did not appear to start up much faster than straight-up server mode.

Tiered compilation doesn't use the CompileThreshold flag but its own set
of flags:
see
http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2010-November/004239.html

> I'm curious if anyone else has ideas for flags to speed up server mode.
>
> - Charlie

R�mi

ijuma

unread,
Nov 9, 2010, 3:59:57 AM11/9/10
to JVM Languages
On Nov 8, 3:46 pm, Charles Oliver Nutter <head...@headius.com> wrote:
> I've tried TieredCompilation as well, with b117 of the JDK7 EA, and it
> did not appear to start up much faster than straight-up server mode.

I'm not sure if the tiered changes have been merged to the main
repository yet. Compare the following:

http://hg.openjdk.java.net/jdk7/hotspot/log?rev=tiered
http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/log?rev=tiered

That probably explains why you didn't notice any difference. Unless I
am missing something, it seems like you have to build your own HotSpot
if you want to test this.

Best,
Ismael

ijuma

unread,
Nov 9, 2010, 4:33:29 AM11/9/10
to JVM Languages
On Nov 9, 8:59 am, ijuma <isma...@gmail.com> wrote:
> I'm not sure if the tiered changes have been merged to the main
> repository yet.

Sorry, ignore my previous message.
This should have been:

http://hg.openjdk.java.net/jdk7/jdk7/hotspot/log?rev=tiered

The ChangeLog also shows some of them:

http://download.java.net/jdk7/changes/jdk7-b115.html

Best,
Ismael

Hannes Wallnoefer

unread,
Nov 9, 2010, 5:04:11 AM11/9/10
to jvm-la...@googlegroups.com
2010/11/8 Charles Oliver Nutter <hea...@headius.com>:

> More and more folks are running on 64-bit systems these days, and as a
> result more people are having to cope with Hotspot's 64-bit JVM only
> having a "server" mode. Given server mode's dreadful startup
> characteristics, this has started to turn people off using JRuby (and
> probably other projects) at the command line, since it can take as
> much as an order of magnitude longer to boot e.g. rails applications
> in server mode.
>
> So I'm looking for ways to solve this.

Slightly off-topic, but least on Debian you can easily install a
32-bit JVM on 64-bit systems:

http://packages.debian.org/lenny/ia32-sun-java6-bin

Install and run update-java-alternatives. I haven't tried myself (I
wish I had know this when I needed it) but a friend reported reduced
memory usage after making the switch.

Hannes

> So far I've managed to cut about 1/4 of the time off a typical startup
> by passing -XX:CompileThreshold=1500 and -XX:-Inline, hoping to make
> the server compiler mimic more closely what the client compiler does.
> This definitely does help, trimming off as much as 25-30%. It's still
> not as fast as client though, and this doesn't seem to work on all
> platforms (worked on an EC2 Linux instance, didn't work on my home
> Linux box.
>
> I've tried TieredCompilation as well, with b117 of the JDK7 EA, and it
> did not appear to start up much faster than straight-up server mode.
>
> I'm curious if anyone else has ideas for flags to speed up server mode.
>
> - Charlie
>

> --
> You received this message because you are subscribed to the Google Groups "JVM Languages" group.
> To post to this group, send email to jvm-la...@googlegroups.com.
> To unsubscribe from this group, send email to jvm-language...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en.
>
>

Charles Oliver Nutter

unread,
Nov 9, 2010, 6:03:20 AM11/9/10
to jvm-la...@googlegroups.com
On Tue, Nov 9, 2010 at 9:09 AM, Rémi Forax <fo...@univ-mlv.fr> wrote:
> Do you try profile the rails apps + your runtime ?

Yes, but unfortunately profiling either introduces so much overhead it
masks the actual startup time...and profiling isn't particularly good
at startup anyway.

As far as JRuby's concerned, much of the time taken during startup of
a large app is simply parsing and executing all those Ruby scripts.
Our parser is definitely not a simple piece of code, and there's a lot
happening as an application boots. We've knocked down a few obvious
bottlenecks, but our startup time is at *best* an order of magnitude
slower than C Ruby for any given app. On server, it's more like two
orders of magnitude.

Most of my experiments have pointed toward the lack of quick jitting
and the cost of jitting once it happens as the primary costs running
on the server VM. That's largely why reducing compilation threshold
and disabling inlining improves that startup time.

> Tiered compilation doesn't use the CompileThreshold flag but its own set of
> flags:
> see
> http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2010-November/004239.html

Yes, I saw that thread. I haven't tried tuning the other thresholds
yet, but that may be the next attempt. However, since I need options
for real users on Java 6, I'd still like to hear if there's other
server-tuning flags that can make compiles come more quickly and with
less overhead. I will keep poking at it.

- Charlie

Charles Oliver Nutter

unread,
Nov 9, 2010, 6:04:20 AM11/9/10
to jvm-la...@googlegroups.com
On Tue, Nov 9, 2010 at 11:04 AM, Hannes Wallnoefer <han...@helma.at> wrote:
> Slightly off-topic, but least on Debian you can easily install a
> 32-bit JVM on 64-bit systems:
>
> http://packages.debian.org/lenny/ia32-sun-java6-bin
>
> Install and run update-java-alternatives. I haven't tried myself (I
> wish I had know this when I needed it) but a friend reported reduced
> memory usage after making the switch.

Yes, my #1 recommendation for JRuby users right now is to use 32-bit
client JVM in development. The startup time difference is night and
day.

- Charlie

John Rose

unread,
Nov 16, 2010, 4:59:24 PM11/16/10
to jvm-la...@googlegroups.com, Igor Veresov
Charlie, I see you tried TieredCompilation (in b117).  Igor suggests XX:CompilationPolicyChoice=3 also.

-- John

On Nov 16, 2010, at 1:51 PM, Igor Veresov wrote:

Sure, the relief is there since September.
Just ask him to run with -XX:+TieredCompilation.
And also with -XX:CompilationPolicyChoice=3 if he uses official Oracle binaries (the ones that are built from CI).

igor


On 11/16/10 1:34 PM, John Rose wrote:
JRuby's Charlie Nutter is having big problems with startup time with
server compiler on x86_64.

http://groups.google.com/group/jvm-languages/browse_thread/thread/3052f5cdb929e9ee#


Reply all
Reply to author
Forward
0 new messages