• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Xmx max value

 
Fabrizio Da Ros
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys!
I have a problem with java.
I have a Linux Redhat 8.0 dual processor machine with 2.5Gb.
I start my Tomcat 4.1.27 with JVM 1.4.2 using JAVA_OPTS -server -Xms512m -Xmx1024m.
Then I look memory usage with top command and a see this:

5730 beta48 25 0 195M 195M 11972 S 1.6 7.7 2:52 java
I can't understand two things:
1) why java allocate only 195M rather than 512M
2) why java reach only 256M of allocation under heavy load of processing and not 1024M
Thanks in advence.
Regards.
Fabry.
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Fabrizio Fabry:

I can't understand two things:
1) why java allocate only 195M rather than 512M
2) why java reach only 256M of allocation under heavy load of processing and not 1024M

The JVM only allocates the memory it needs. It would negatively impact the startup time for it to spend time allocating more memory than it needs, not to mention that once a JVM allocates memory it will not release it back to the system, so it is a Good Thing that the JVM only allocates the memory it requires. Be aware that the -Xms and -Xmx flags only dictate heap size, so it is not uncommon for the size of a JVM to exceed these values since there are things that do not occupy the heap (i.e. thread stack).
 
Coreolyn Elginor
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an ongoing discussion that I am often involved in. My personal view from profiling applications is that for overall performance setting your minimum = maximum is the way to go. The CPU delay ( we are only at java 1.3.x in production (no parallel garbage collection ) to increase the available memory when it is needed by the JVM is significant and outweighs the lost time in a full mark and sweep of the maximum JVM. This is esplecially true as even with a minimal JVM size it will eventually grow to maximum and you will still be losing the full JVM mark and sweep. If the JVM resized itself to a smaller memory footprint when applicable a minimum setting might provide some value.
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Coreolyn Elginor:
for overall performance setting your minimum = maximum is the way to go.

I have heard this as well, notibly from Tuning Garbage Collection with the 1.4.2 Java Virtual Machine

Unless you have problems with pauses, try granting as much memory as possible to the virtual machine. The default size (64MB) is often too small.
Setting -Xms and -Xmx to the same value increases predictability by removing the most important sizing decision from the virtual machine. On the other hand, the virtual machine can't compensate if you make a poor choice.
Be sure to increase the memory as you increase the number of processors, since allocation can be parallelized.

[ February 17, 2004: Message edited by: Joe Ess ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic