The Source for Java Technology Collaboration

Home » java.net Forums » JDK » Java Quick Starter

Thread: Start quicker by tuning JVM and javac

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 13 - Last Post: Nov 17, 2008 4:13 AM by: kamaltiwari123 Threads: [ Previous | Next ]
maksym_shostak

Posts: 22
Start quicker by tuning JVM and javac
Posted: Apr 16, 2008 11:54 AM
 
  Click to reply to this thread Reply

Hello.

I'm searching the ways to reduce startup time of my
small desktop application. I'm searching among Java VM
and javac compiler options.

For example, seems that following could help:

1. java -client (Select the Java HotSpot Client VM. In general,
the server VM starts up more slowly than the client VM, but
over time runs more quickly.)


2. javac -g:none (Do not generate any debugging information)

3. java -Xms, -Xmx (and other performance tuning options).

I look forward to hearing your thoughts.

linuxhippy

Posts: 646
Re: Start quicker by tuning JVM and javac
Posted: Apr 16, 2008 2:38 PM   in response to: maksym_shostak
 
  Click to reply to this thread Reply

Compiler options won't help that much I fear.

Best you can do is install JDK6u10-beta (the most recent build) and enable quickstarter, this should help much more than anything else.

The client-jvm should be default anyhow ... oh well wait ...on Linux with 2CPUs and 2GB ram its now the server compiler, because this is considered a server-class machine. Really stupid, my Laptop has already 3GB ram!

lg Clemens

maksym_shostak

Posts: 22
Re: Start quicker by tuning JVM and javac
Posted: Apr 17, 2008 10:10 AM   in response to: linuxhippy
 
  Click to reply to this thread Reply

> The client-jvm should be default anyhow ...
> lg Clemens

Not only on Linux.
See server-class machines detection at
http://java.sun.com:80/j2se/1.5.0/docs/guide/vm/server-class.html

demonduck

Posts: 382
Re: Start quicker by tuning JVM and javac
Posted: Aug 29, 2008 4:31 AM   in response to: maksym_shostak
 
  Click to reply to this thread Reply

More stupid engineering -- if it's a server, wouldn't there be a System Administrator that would make sure that the server JVM is the default?

Average machines these days have over 2gig mem and more than 2 processors.

May I suggest that the Java Dev Team is trying to make Java into some sort of Artificial Intelligence entity that tries to anticipate the users needs. It's easier and simpler to let the human figure it out using standard and conventional use patterns.

lowecg

Posts: 16
Re: Start quicker by tuning JVM and javac
Posted: Aug 31, 2008 3:16 AM   in response to: maksym_shostak
 
  Click to reply to this thread Reply

If you only have the JRE installed then the server VM will not be available.

One option that can make a significant difference to the startup time is -Xverify:none

Obviously use this with some degree of caution since it turns off class byte code verification.

denka

Posts: 19
Re: Start quicker by tuning JVM and javac
Posted: Aug 29, 2008 9:54 AM   in response to: maksym_shostak
 
  Click to reply to this thread Reply

I'm not sure if it works anymore, but some while ago people were placing class files in a JAR with no compression to speed up class loading. Class loading does slow things down on the start-up. This also hints at application design, where main application window would appear sooner the less classes it needs to load and the lesser number of objects it has to instantiate. Thus, try deferring initialization of non-essential things, but not to the degree where everything loads on demand: that might hurt perception of responsiveness. And now we arrived at the most important thing: perception of performance. Your customer will wait a little and will not be outraged about it if you provide some feedback. Splash screen with progress indicator (while you eagerly load all essential resources and restore application state) is a must.

mrmorris

Posts: 88
Re: Start quicker by tuning JVM and javac
Posted: Aug 29, 2008 5:11 PM   in response to: denka
 
  Click to reply to this thread Reply

Exactly. Will someone please explain this to the NetBeans team. The current lazy loading trend does not assist in perceived performance.

lowecg

Posts: 16
Re: Start quicker by tuning JVM and javac
Posted: Aug 31, 2008 3:22 AM   in response to: maksym_shostak
 
  Click to reply to this thread Reply

What version of the JVM are you using?

I've had favourable experiences with the JVM Quick Starter enhancement in the up coming 6.0u10 release (now in the RC stages) - this improves cold start times on Windows.

https://jdk6.dev.java.net/

Cheers,

Chris.

keeskuip

Posts: 36
Re: Start quicker by tuning JVM and javac
Posted: Aug 31, 2008 4:42 AM   in response to: maksym_shostak
 
  Click to reply to this thread Reply

You could create your jar with the option '-i'.

-i = generate index information for the specified jar files

Classloading from that jar will be faster.

lowecg

Posts: 16
Re: Start quicker by tuning JVM and javac
Posted: Aug 31, 2008 2:49 PM   in response to: maksym_shostak
 
  Click to reply to this thread Reply

General question - I'm seeing quite a few posts around discussing Java start up times.

Does anyone know if there is an official benchmark that can be used to measure start up times for desktop applications, web start apps and applets?

dleskov

Posts: 11
Re: Start quicker by tuning JVM and javac
Posted: Sep 1, 2008 4:00 AM   in response to: lowecg
 
  Click to reply to this thread Reply

We have some application startup time benchmarks, but they are not official, we use them internally for (regression) testing of our Startup Optimizer. I could post a few bits of methodology (disk cache cleanup) here if you are interested.

lowecg

Posts: 16
Re: Start quicker by tuning JVM and javac
Posted: Sep 1, 2008 4:07 AM   in response to: dleskov
 
  Click to reply to this thread Reply

Yes please, anything you could give me would be greatly appreciated.

Cheers,

Chris.

dleskov

Posts: 11
Re: Start quicker by tuning JVM and javac
Posted: Sep 30, 2008 5:24 AM   in response to: lowecg
 
  Click to reply to this thread Reply

We have a special mode in our JVM in which it measures the length of the different phases of startup, calculates working set size, counts the number of page faults, and so on. I think Sun may have done something similar, so maybe you can get that by rebuilding the OpenJDK?

For measuring the overall startup times on HotSpot, we patch the test programs so that they exit as soon at the main() method receives control, or when the main window is displayed, etc.

You also have to remove the application and the JRE from disk cache if you want to measure cold startup. There are three options on Windows:

1. Remove everything from %windir%\Prefetch and reboot.

2. Run a memory-hungry task (our night build works perfectly :) )

3. Write a small memory eater. Aggressive ones can make Windows unstable though.

Make sure no Java app using the same JRE is launched on system startup or login.

kamaltiwari123

Posts: 1
Re: Start quicker by tuning JVM and javac
Posted: Nov 17, 2008 4:13 AM   in response to: dleskov
 
  Click to reply to this thread Reply

hi ,
i am kamal.l am little bit confused that , what is the need to remove files from prefetch and boot directory.

plz try to explain it.

looking forward to hearing you.

thanks
regards
Kamal




 XML java.net RSS