This question is probably better phrased: how does running a Java server on a hypervisor such as VMware ESX affect the Java heap?
The conventional wisdom for Java server applications is that performance is best if you allocate all the heap at JVM startup, rather than allowing the heap to be dynamically resized as the need arises. In other words, if you set the heap size to 1GB, your Java process will grab 1GB of contiguous virtual address space (+ whatever is needed for the binaries), memory which is no longer available to other applications.
Is VMware smart enough to detect that some of this heap is in fact unused? How does this affect GC performance? Would it be better to let the heap be dynamically resized in VMware? What GC strategies work best with VMware guests?
Also, would anyone point me towards guidelines for tuning JVM heaps in virtualized environments?
You can verify that the JVM is using the increased Java heap space: Open a terminal window. Review the command output. The argument beginning with "-Xmx" will give you the value of the current Java heap space.
You can pass parameters to the JVM to set the minimum and maximum heap sizes; the default maximum heap size is 256 MB. To give more capacity to a message flow that is going to process large messages, reduce the minimum JVM heap size to allow the main memory heap to occupy more address space.
The max JVM heap size limit has been removed since we moved to completely 64 bit releases. As such you are now limited by the OS and/or machine. The theoretical limit is 2^64 bytes, which is 16 exabytes (1 exabyte = 1024 petabytes, 1 petabyte = 1024 terabytes). However, most OS's can't handle that.
Related to my question:
Here is a PDF that provides a broad overview of considerations for running Java on VMware guests: link text
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With