Earlier this week I had to solve a major performance issue affecting our application, in the end it turned out to be a database (missing statistics) problem that lead to a slow response from a query, but in the mean time I had the opportunity to play a little bit more with Websphere’s JVM Heap size settings.
First of all, what is the JVM Heap size? The simple answer is: The amount of memory used by the virtual machine to allocate new objects created by your Java applications.
You can find tons of details about it online, but here I’ll post the main ones:
·It directly affects performance, so it’s one of the most important JVM tuning parameters
·If you set the max heap size too low, your apps will reach the max level soon and you’ll get the following error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
·In case you choose big amount for the max heap size setting, then your applications will have all the room needed to create objects, but then the Garbage Collection (GC) process will take longer. The effect of this setting will depend on the GC policy you choose.
By default the GC policy is set to “Optthruput” which means your app will not respond during GC. The second option is “Optavgpause”, that runs the GC concurrently with the app and gives a better response time. Finally “Gencon”, that treats long-lived and short-lived objects in a different way by allocating the latter ones in a special area (Nursery space) that can be disposed more often, hence reducing the time spent during GC.
In the end the value of the heap size will depend on the needs and resources available in each case, so now it’s time for you to go and give it a try ;)