Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have Tomcat 6.0 up and running. I went to tweak the memory sizes and realized that I have it running on the Sun JDK 1.6 client JVM. I don't have the Sun server JVM installed:

C:\>java -client -version
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)

C:\>java -server -version
Error: no `server' JVM at `C:\appl\java\jre6u16\bin\server\jvm.dll'.

To clarify: I know how to switch JVMs in Tomcat from client to server. I just have to pick the most appropriate server JVM.

Am I going to notice a big difference between client and server JVMs? If I want the Sun server JVM, do I have to reinstall the whole JDK? Are there other free server alternatives that would be good for running Tomcat?

share|improve this question
add comment

4 Answers

up vote 4 down vote accepted

Here (from the Sun release notes) is the answer I was looking for, at least for how to ensure the JDK server is up and running:

jre\bin\server\

On Microsoft Windows platforms, the JDK includes both the Java HotSpotTM Server VM and Java HotSpotTM Client VM. However, the JRE for Microsoft Windows platforms includes only the Java HotSpotTM Client VM. Those wishing to use the Java HotSpotTM Server VM with the JRE may copy the JDK's jre\bin\server folder to a bin\server directory in the JRE. Software vendors may redistribute the Java HotSpotTM Server VM with their redistributions of the JRE.

share|improve this answer
add comment

Have you tried to use the file setenv.sh under TOMCAT_HOME/bin/ ? You have to manually create this file (e.g via vi) and then add you Java options. For example:

cd TOMCAT_HOME/bin
vi setenv.sh

add the following line in this file:

export JAVA_OPTS='-server'

This way your JVM should run in server mode.

share|improve this answer
    
No, you're misunderstanding -- I know how to run java in server mode. The problem is I don't have a server JVM installed, and I want to know which one is most appropriate and if there is much of a difference between Sun client/server JVMs. –  Jason S Oct 8 '09 at 17:02
1  
The argument -server in $JAVA_OPTS runs your installed Sun JVM in server mode. The are no seperate JVMs of the Sun JRE. And yes, the Sun JRE 1.6.0 is appropriate for your use. You might also be interested in stackoverflow.com/questions/198577/… –  joschi Oct 8 '09 at 17:45
    
I don't understand why people are voting up this answer. It is not the question I asked. –  Jason S Oct 8 '09 at 17:56
add comment

Yes, you probably want the server JVM. It is tuned for server-side performance. You won't know for sure unless you go to the effort of benchmarking, but I have yet to come across anyone saying that the client VM worked better for their Tomcat setup.

As far as whether you need to download the entire JDK or not -- that I don't know, unfortunately.

share|improve this answer
add comment

-server and -client are just flags that change the performance characteristics of the normal sun JVM. If you don't specify one, the JVM guesses. In this case, it's guessing you have a client-class machine, and you just need to run java with the -server flag to change that.

See: http://java.sun.com/j2se/1.5.0/docs/guide/vm/server-class.html

share|improve this answer
    
They're not just flags. They determine whether server\jvm.dll or client\jvm.dll is used. –  Jason S Oct 8 '09 at 17:53
1  
Well, I wasn't implying that the flags are ignored. Obviously, they actually cause different code to run. The fact that they're in different DLLs is an implementation detail. It said as much in the link I gave. Anyway. Yes, they're just performance flags afaik. The server version takes a bit longer to load, and is slow for user-facing GUI stuff, but good for long-running processes like webapps. –  Lee B Oct 8 '09 at 18:06
    
[sound of me pulling my hair out] -- yes, you're absolutely right, but I know that already. It's just that I don't have server\jvm.dll installed (I guess I just downloaded the client JDK) and am not sure what to download to get the Sun JVM, or whether to use someone else's (IBM's?) JVM. –  Jason S Oct 8 '09 at 18:12
3  
You would be less frustrated if you stated your issues clearly, and didn't fight with the people who answer based on what you say. As for which JVM: for me there's only one choice these days: OpenJDK/JVM. If you're not satisfied with that, I'd suggest benchmarking them. A decent distro like Debian will let you try out different JVMs quite easily. –  Lee B Oct 8 '09 at 18:17
    
OK thanks for the OpenJDK/JVM reference -- consider editing your answer to include this. I thought I did state my issues clearly (question is titled "which JVM is best for Tomcat?" and I mentioned I didn't have the server JVM installed), but I guess I didn't. –  Jason S Oct 8 '09 at 18:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.