Nov 10, 2018

JVM Settings for production for Glassfish

The standard JVM defaults are not suitable for a production system. One of the simplest changes that can be made is to use the -server flag, rather than the default -client. Although the Server and Client VMs are similar, the Server VM has been specially tuned to maximise peak operating speed. It is intended for executing long-running server applications, which need the fastest possible operating speed more than a fast start-up time or smaller runtime memory footprint.
Allocate more memory to the JVM by modifying the value of the -Xmx flag. How much depends on the size and complexity of your enterprise application and how much memory you  have available. In addition we also want to make sure we allocate all of the memory on startup. This is done with the -Xms flag.
We set the minimum and maximum perm gen to the same value in order to avoid allocation failures & subsequent full garbage collections.