Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JVM heap sizing in VMware guests

This question is probably better phrased: how does running a Java server on a hypervisor such as VMware ESX affect the Java heap?

  • Access to JVM heap is random from the OS/hypervisor perspective
  • It is difficult to for guest OS or hypervisor to optimize memory that is randomly accessed
  • Given this, can the hypervisor detect unused pages in JVM 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?

like image 349
Rob Avatar asked Jan 13 '09 16:01

Rob


People also ask

How do I know my JVM heap size?

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.

What is the JVM heap size?

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.

What is maximum heap size for JVM?

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.


1 Answers

Related to my question:

Here is a PDF that provides a broad overview of considerations for running Java on VMware guests: link text

like image 109
Rob Avatar answered Oct 22 '22 11:10

Rob