32

I saw Java -server in http://shootout.alioth.debian.org/ for programming language benchmark. I know that -server is a parameter for running JVM. I want to know:

When we use -server parameter and how it work? Can we use this parameter for java desktop application?

thanks.

Saeed Zarinfam
  • 9,818
  • 7
  • 59
  • 72
  • Incidentally, the benchmarks game machine is "a server-class machine" so those are the default settings. The explicit -server parameter is only being used to make the settings really obvious to everyone. – igouy Mar 12 '11 at 16:46
  • Maybe duplicate of http://stackoverflow.com/questions/198577/real-differences-between-java-server-and-java-client if `-client` and `-server` are two mutually exclusive modes. – Ciro Santilli OurBigBook.com Feb 21 '15 at 18:00

4 Answers4

28

It just selects the "Server Hotspot VM". See documentation (Solaris/Linux) for java.

According to Wikipedia:

Sun's JRE features 2 virtual machines, one called Client and the other Server. The Client version is tuned for quick loading. It makes use of interpretation, compiling only often-run methods. The Server version loads more slowly, putting more effort into producing highly optimized JIT compilations, that yield higher performance.

See: http://en.wikipedia.org/wiki/HotSpot

Jifeng Zhang
  • 5,037
  • 4
  • 30
  • 43
payne
  • 13,833
  • 5
  • 42
  • 49
14

The -server flag will indicate to the launcher that the hw is a server class machine which for java 6 means at least 2 cores and at least 2 GB physical memory (ie most machines these days). On server class machines the deafult selection is

  • The throughput gc.
  • initial heap size of 1/64th of phys mem up to 1 GB
  • maximum heap size of 1/4th of phys mem up to max of 1 GB.
  • The server run time compiler.

Note that on 32 bit windows there is no server vm so the client vm is the default. On the other 32 bit machines the server vm is chosen if the hw is server class, otherwise it's client. On 64 bit machines there is no client vm so the server vm is the default.

A link to the hot spot faq: HotSpot

Erik
  • 2,013
  • 11
  • 17
  • I thought that there *was* a server mode on 32 bit windows? We ran our production code that way for a number of years (by selecting -server) until we switched to Linux. – Fortyrunner Mar 21 '11 at 22:23
  • Hm, I can't find the reference right now but as I remember it the -server flag was just ignored on java 5 and later for win32. But I might be wrong, especially since I cant find the reference. – Erik Mar 23 '11 at 11:27
2

You can check this blog for additional info: http://victorpillac.wordpress.com/2011/09/11/notes-on-the-java-server-flag/

Basically on most recent machines different from 32bits windows the flag will be turned on by default. For 32bits windows you will need to download the JDK to get the server system.

Victor P.
  • 630
  • 1
  • 6
  • 14
0

More info on server vms : http://download.oracle.com/javase/1.3/docs/guide/performance/hotspot.html#server

Nishan
  • 2,821
  • 4
  • 27
  • 36
  • 1
    While this may theoretically answer the question, [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Matt Ball Apr 24 '12 at 20:10