Tuning Java on LINUX

Hi,

Need help in tuning JAVA on LINUX.

From http://www.trutek.com/index.php?id=173 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.

It would be great if someone help me on this.

Thank you,
Crabbie

  1. what is the total size of physical memory?

  2. what is the size of your swap space?

  3. what is the amount of free memory plus unused swap space when the operating system is just idling?

  4. what is the maximum you can successfully set it to?

Hi,

I have provided information requested against each query below.

  1. what is the total size of physical memory?
    => 4GB
  2. what is the size of your swap space?
    => 2GB
  3. what is the amount of free memory plus unused swap space when the operating system is just idling?
    => Not sure how would I find that. However, below is info found at header on running "top" command

top - 13:53:56 up 1 day, 2:41, 6 users, load average: 2.95, 2.84, 2.81
Tasks: 121 total, 4 running, 117 sleeping, 0 stopped, 0 zombie
Cpu(s): 33.2% us, 16.6% sy, 0.1% ni, 50.1% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 4149212k total, 3375016k used, 774196k free, 244924k buffers
Swap: 2097144k total, 0k used, 2097144k free, 2755996k cached

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

  1. what is the maximum you can successfully set it to?
    => Currently I could set upto -Xms2588m -Xmx2588m

Please let me know if you need further information.

Thanks,
Crabbie

That's quite good already. If you look at

http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/java.html

Look at the documentation for these options, it says Linux platforms are limited to around 2GB, or less. Only SPARC may go beyond the figure.

I have read that some environments such as J2EE application server can achieve some advantage with multiple concurrent VMs, but whether you can use that really depends on your environment.

"Pro Java EE 5 Performance Management and Optimization" by Apress is a must-read for you, if you are managing a JavaEE environment.

774196+2097144=2871340

which is in the same ball park as your -Xmx2588m

I suggest

(a) try the same in single-user mode with limited daemons running

(b) bigger swap

Thank you so much for your help.

I will try the mentioned alternatives.

Thanks again.
Crabbie