Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Slow starup of Java application - best practices for fine tuning JVM?

843829Mar 12 2010 — edited Mar 16 2010
We are having problems with a java application, which takes a long time to startup.

In order to understand our question we better start with some background info. You will find the question(s) after that.

Background:
-------------

The setup is as follows:
In a client-server solution we have a win xp, fat client running java 1.6.0.18.
(Sun JRE). The fat client containt a lot of GUI, and connects to a server for DB access. Client machines are typical 1 to 3 years old (there are problems even on brand new machines). They have the client version of JRE - standard edition installed (Java SE 6 update 10 or better) Pretty much usual stuff so far.

We have done a lot of profiling on the client code, and yes we have found parts of our own Java code that needs improving. we are all over this. Server side seems ok with good response times. So far, we havent found anything about shaky net connections or endless loops in the java client code or similiar.
Still, things are not good. Starting the application takes a long time. too long.
There are many complicating factors, but here is what we think we have observed:

There is a problem with cold vs. varm starts of the application. Apparently, after a reboot of the client PC - things are really, really bad - and it takes (sometimes) up to 30-40 secs to start the application (until we arrive at the start GUI in our app).
If we run our application, close it down, and then restart
without rebooting, things are a lot better. It then usually takes
something like 15 - 20 sec. which is "acceptable". Not good, but acceptable,

Any ideas why?
I have googled it, and some links seems to suggest that the reason could be disk cache. Where vital jar are already in disk cache on th warm start? Does that make any sense? Virus scanners presumable runs in both cases.

People still think that 15 - 20 sec in start up on the warm start is an awful long time, even though there is a lot, a lot, of functionality in the application.
We got a suggestion to use IBMs JRE - as it can do some tricks (not sure what) our SUN JRE cant do concerning the warm and cold start problem. But thats is not an option for us. And noone has come up with any really good suggestions with the SUN JRE so far?

On the Java Quick Starter (JQS) -
improves initial startup time for most java applets and applications.
Which might be helpful? People on the internet seem more interested
in uninstalling the thing than actually installing it though?
And it seems very proprietary, where we cant give our Jar files to it?

We could obviously try to "hide" the problem in some way and make it "seem" quicker. Where perceived performance can be just as good as actual performance. But it does seem a bad solution. So for the cold start we will probably try reading the jar files and thereby have them in disk cache before startup of our application. And see if that helps us.

Still, ok the cold start is the real killer, but warm start isn't exactly wonderfull either.

People have suggested that we read more on the JVM and performance.
java.sun.com.javase/technologies/performance.jsp
java.sun.com.docs/hotspot/gc5.0/gc_tuning_5.html
the use of JVM flags "-Xms" "-Xmx" etc etc.

And here comes the question .. da da ...
-----------------------------------------

Concerning various suggested reading material.
it is very much appreciated - but we will like to ask people here - if it is possibe to get more specific pointers. to where the gold might be buried.
I.e. in a an ideal world we would have time to read and understand all of these documents in depth. However, in this less than ideal world we are also doing a lot of very timeconsuming profiling in our own java code.
E.g. java garbage collection is is a huge subject - and JVm settings also. Sure, in the end we will probably have to do this all very thoroughly. But for now we are hoping for some heuristics on what other people are doing when facing a problem like ours..?

Young generation, large memory pages, garbage collection threads ect. all sounds interesting - but what would you start with?
If you don't have info to decide - what kind of profiling would you be running and then adjust what JVM setting in your trials?
In this pressed for time scenario. Ignorance is not bliss. But makes it hard to pinpoint the or those JVM parameters to adjust. So some good pointers from experienced JVM "configurators" will be much appreciated!
Actually, If we can establish that finetuning of these parameters is a good idea, it will certainly also be much easier to allocate the time for doing so. - reading, experimenting etc. in our project.
So, All in all , what kinds of performance improvements can we hope for? 5 out of 20 secs on the warm start? Or is it 10 % nitpicking? Whats the ball park figure for what we can hope to achieve here given our setup? What do you think based on above?

----------

Maybe someone out there have done some finetuning of JVM parameters in a similiar PC environments like, with similiar fat clients...? Finetuning so and so - gave 5 secs. So start your work with these one-two parameters?
Something like that - some best practices? Thats what we are hoping for.


best wishes
-Simon
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 13 2010
Added on Mar 12 2010
9 comments
857 views