Results 1 to 3 of 3
  1. #1
    efoss is offline Member
    Join Date
    Sep 2011
    Posts
    2
    Rep Power
    0

    Default using -Xms, -Xmx and -Xmn

    I am new to Java. I am using a Java library, so my normal commands are:

    java -jar XXX.jar

    In seeing how other people use this library, I saw that they would often use a "-Xmx" option:

    java -Xmx12g -jar XXX.jar

    This looks like it sets the maximum heap size:

    JVM Tuning

    -Xms sets initial heap size
    -Xmx (the one I've been using) sets maximum heap size
    -Xmn sets the size of the heap for the young generation

    If I am running a single -jar command and I have a whole node to myself simply for this command (12 CPUs, 48 gigs of RAM), is there any reason to mess with any of these options? I can see setting options that will increase the size of the heap, but I don't see the advantage of limiting it, unless I'm concerned about interfering with other processes running on the same node (which I'm not).

    Thanks.

    Eric

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: using -Xms, -Xmx and -Xmn

    The JVM (depending on version, but any post 1.4) will take 1Gb of that 48 Gb as its default Xmx, so if your app is going to need more than that then you need to give it an Xmx value.

    Xmn you will only need to look at if you are having GC problems, and that would involve you understanding how garbage collection works, and the underlying algorithms, as well as how those interact with your system.

    Xms, in a production system, should normally be set the same as Xmx, so the JVM doesn't have to waste time grabbing extra memory. Though that advice may have changed recently.

  3. #3
    efoss is offline Member
    Join Date
    Sep 2011
    Posts
    2
    Rep Power
    0

    Default Re: using -Xms, -Xmx and -Xmn

    Thanks very much, Tolls. That makes sense.

    Eric

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •