File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes Hotspot: java -server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Hotspot: java -server" Watch "Hotspot: java -server" New topic

Hotspot: java -server

Bill Clar
Ranch Hand

Joined: Sep 21, 2006
Posts: 163

I've searched through all the Hotspot threads and haven't found an answer, so forgive me if this question has been previously asked.

Currently we are running a Tomcat web application using JRE 1.4.0. The default Hotspot setting is client. Ideally, I'd like to use the -server setting, however, I'd like to know if there are any risks involved with this switch.

Will the application run slower initially?
Will the application throw any Exceptions that the -client mode previously di d not catch?


Bill Clar
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
As I understand it, the server JVM differs mainly in its eagerness to compile code to native and in its default garbage-collection strategies. The server JVM is biases towards better performance in the long run, possibly at the expense of longer start-up time.

You do not need to adjust your Java code to accommodate changing between client and server JVM. Well, not unless your code has some very nasty timing dependencies, or something.

I use server JVM for my server and client JVM for my clients, and have not found any problems with this configuration.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Joe Ess

Joined: Oct 29, 2001
Posts: 9189

The Java Platform Performance book has a chapter on the HotSpot virtual machine, explaining the differences between server and client.

[How To Ask Questions On JavaRanch]
Peter White

Joined: Sep 21, 2006
Posts: 14
I think the latest JVM's will auto select -server mode anyway if the machine is of sufficient spec (2CPU and 2GB RAM).

We use this setting with tomcat with no noticable difference in startup times (approx 45s inc. some cache warmups). We haven't seem anything different in exceptions, although we had a few problems on our 64bit machines initially, but the latest 1.5 JVM seems fine now.



Building a new game one brick at a time.<br /><a href="" target="_blank" rel="nofollow"></a>
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

As far as performance is concerned the server JVM is supposed to be faster than the client JVM. I remember seeing a graph that compared the performance of the client and the server JVM with C++. The server JVM was winning. I cant remember the link though.
[ September 24, 2006: Message edited by: John Meyers ]

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
I agree. Here's the link:
subject: Hotspot: java -server
It's not a secret anymore!