Tuning Java Virtual Machines (JVMs) refers largely to memory heap size and garbage collection (GC) tuning.
With most JVMs, tuning heap size requires identifying how the application is using memory, changing parameters and re-profiling. As much as is realistically possible, the application needs to be running close to production loads.
This is particularly difficult to do, since some real-world loads just won’t be seen in the lab. Most JVMs provide you with the ability to set initial and maximum heap size, though some also allow other parameters such as large pages. If the heap size is set too large, garbage collection pauses become too long; if heap size is set too small, the application will throw an out-of-memory error and likely crash. Thus memory and GC tuning are closely related topics that impact application performance.
For more information about JVM performance tuning and garbage collection, read this white paper about the various tuning and collection strategies. Java developers can improve application performance, scalability and reliability by making more informed choices about performance tuning options.