Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JVM Server Mode vs Client Mode

 
Yohan Liyanage
Ranch Hand
Posts: 132
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the differences between server mode and client mode of the JVM (apart from load time)?

As I have heard, Server mode is optimized for better performance, but lately I found out that server mode is slower than client mode for some types of calculations (when running SciMark).

For what type of scenarios is it advisable to use the Server VM?

Thanks in advance.
 
Henry Wong
author
Marshal
Pie
Posts: 21219
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The difference is the way that it uses the Just-in-Time compilers.

The client mode uses a JIT compiler (originally from Apple), which basically compiles the java bytecodes into native machine code as soon as it is loaded.

The server mode uses a JIT compile from Sun, which uses the Java interpreter on the java bytecodes, for a while. Once enough data has been collected about the java class, it is then JIT compiled to native machine code, using the profiling data that it has collected to optimize the compilation.

Henry
 
Henry Wong
author
Marshal
Pie
Posts: 21219
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In terms of usage, people generally recommend using the client option for short lived applications, and the server option for longer lived application, as there is less of a need to spend time profiling an application that doesn't run for very long.

In terms of practical usage, people generally switch between these two modes when they encounter a core dump. Although admittingly, I haven't seen this practice is quite a while.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic