File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes JVM Heap size - How Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "JVM Heap size - How" Watch "JVM Heap size - How" New topic

JVM Heap size - How

Ramu Nur

Joined: Aug 21, 2010
Posts: 22
Is there a standard technique to set the JVM heap size for an application? Or is it a trail-and-error (after profiling) with some start up values?

Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

Trail and error mostly. Some apps hog memory and others dont. It depends on how state is maintained; what is cached; how large the cache is; what the purge policy for caches are; etc etc.

A load and performance test usually highlights the limits of CPU / memory / Threads. A good rule of thumb is to add some buffer to the max limit (say 20%. But 20% of what number ? That can be a factor too).

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
chander shivdasani
Ranch Hand

Joined: Oct 09, 2007
Posts: 206

Ya, i agree to Deepak. Its mainly by trial error.
One thing to look is how often does JVM do GC. Make sure its not spending most of its time doing GC.

Enjoy, Chander
SCJP 5, Oracle Certified PL/SQL Developer
I agree. Here's the link:
subject: JVM Heap size - How
It's not a secret anymore!