File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JVM Max Heap Size recommended

 
Neelesh A Korade
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

We have a J2EE application being deployed in the production environment on SAP's NetWeaver application server. The server machine on which the application is being deployed has 16GB RAM, with no other major application running on the same server. Even the NetWeaver application server is going to host our application alone.

We are trying to figure out what would be an ideal value for JVM max heap size for the application server. If we can have JVM max heap size in the range of 4 to 8 GB, we can enable multi threading in our application to process transactional data in parallel. But I came across a reference in one of the articles which said for max heap size beyond 2GB, the applications starts experiencing garbage collection pauses, as the garbage collector runs take much longer to complete.

Can anybody provide us with any inputs on this? Particularly, what's the maximum JVM heap size one can have, without having to suffer from any such issues as garbage collection pauses?

Thanks
Neelesh
 
Peter Chase
Ranch Hand
Posts: 1970
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have experience of using such large heaps, but it would seem a shame to constrain your application to use much less than the machine has available.

There are lots of different garbage collector configuration parameters available. There are a number of different garbage collectors available, and each one has settings to twiddle They let you trade off things total amount of GC time versus maximum pause time etc. I'd imagine that somewhere in the space of settings is one that would suit your application.

I suggest careful consultation of the documentation of your JVM's GC settings, and some experimentation.
 
Stephen King
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neelesh,

If you are using a 32 bit JVM, what you have read (max heap size ~ 2GB) is correct. It won't allow you to configure any higher value for heap. However, that is not the only parameter which can be tuned.

If you switch on the VERBOSEGC, and find that the number of minor garbage collections are higher than the major ones, adjusting the new to old generation ratio (to provide more space to the new generation objects) would bring down the frequency of garbage collections in the JVM.

I hope you are using Hotspot JVM, aren't you?

HTH
Steve
 
Henry Wong
author
Marshal
Pie
Posts: 20823
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Configuring and tuning the Sun garbage collector can actually get complicated -- and quite frankly doesn't always work. (meaning there are tradeoffs)

Henry
 
Neelesh A Korade
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all the inputs everyone. That really helps. Just to clarify a few queries made in the responses-

We are using a 64bit JVM. And the JVM is a Hotspot one.

I will look at the Hotspot GC documentation. Thanks for all the help.

-Neelesh
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://java.sun.com/docs/hotspot/gc1.4.2/#4.2.2.%20AggressiveHeap|outline looks interesting
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic