Thursday, May 14, 2009

Changing the JVM heap size

The default Java heap size doesn’t cut it for my servlet tests. Fortunately, this is how you can change it:

java -jar myjar.jar -Xms512m -Xmx2048m

The –Xms option specifies the minimum heap size; the –Xmx option specifies the maximum.

1 comments:

tdmeth said...

I've looked into this for use on a JRun4 system (can you guess which one?). I ran into two rather strange issues. 1) This may just be a JRun 4 limitation, but if you change the heap size for one application, it changes it for all applications. 2) You actually start to loose performance at the 1.25GB mark, due to the overhead from garbage collection. The preferred method was to create two separate JVMs and cluster them. Don't know how much this applies to what you are doing, but there you go.

Post a Comment