Need help - Tune JVM to use Max Memory on Linux

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • crabbie_upk
    New Member
    • Sep 2005
    • 2

    Need help - Tune JVM to use Max Memory on Linux

    Hi,

    Need help in tuning JAVA on LINUX.

    From http://www.trutek.com/index.php?id=17 3 I understand that on Linux operating system with 4GB memory, JVM can be run with maximum memory of 3800m. But I had no luck. Could someone help me in achieving on Red Hat Linux server.

    Here is the details of my Linux server.

    OS: Red Hat Linux (Linux xyzsrvr 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST 2005 i686 i686 i386 GNU/Linux)
    Java: java version "1.5.0_06"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
    Java HotSpot(TM) Server VM (build 1.5.0_06-b05, mixed mode)
    RAM: 4GB

    I get this below error while instructing JVM to use 3800m.
    $ java -Xmn3800m -Xmx3800m xxxxx (Lots of more options)
    Error occurred during initialization of VM
    Could not reserve enough space for object heap
    Could not create the Java virtual machine.

    The "free" command yeilds below details on memory usage.
    free
    total used free shared buffers cached
    Mem: 4149212 3374120 775092 0 244844 2755816 -/+ buffers/cache: 373460 3775752
    Swap: 2097144 0 2097144

    Currently I could go up to -Xms2588m -Xmx2588m

    It would be great if someone help me on this.

    Thank you,
    Crabbie
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    Take a look at http://www.javaperformancetuning.com...pservers.shtml.
    I think a good excerpt for you you have would be:
    As a starting point for a server based on a single JVM, consider setting the maximum heap size to 1/4 the total physical memory on the server and setting the minimum to 1/2 of the maximum heap. Sun recommends that ms be set to somewhere between 1/10 and 1/4 of the mx setting. They do not recommend setting ms and mx to be the same. Bigger is not always better for heap size. In general increasing the size of the Java heap improves throughput to the point where the heap no longer resides in physical memory. Once the heap begins swapping to disk, Java performance drastically suffers. Therefore, the mx heap setting should be set small enough to contain the heap within physical memory. Also, large heaps can take several seconds to fill up, so garbage collection occurs less frequently which means that pause times due to GC will increase. Use verbosegc to help determine the optimum size that minimizes overall GC.

    Comment

    Working...