Large Pages

If you configure Linux to use large pages, they are treated quite differently by the guest than are regular 4k pages. Large pages are set aside specifically for use by processes that request them. Regular applications, including JVMs not configured to use large pages, can only use free memory left over after the large pages are set aside when the guest boots. Because the unused large pages represent memory that is effectively unavailable to most regular applications, they are included in the Other Memory section of the historical graph.

When a JVM starts up and requests that its heap be allocated from the guest's large pages, the Other Memory line drops as those pages are now actually in use by the JVM heap. It is a simple accounting change. Conversely, a JVM that starts and is not configured to use large pages allocates its heap out of the remaining free memory in the guest.

You can see four examples of this action clearly in the graph below. The VM starts with no applications running, but 4GB of large pages set aside.

  1. JVM 1starts up and uses all 4GB of large pages for its heap. The graph shows that the heap memory is fully committed right from the start since no regular applications have access to that memory anyway. The light blue Potential Heap Size line is hidden behind the brown line.

  2. JVM 2 starts up with a 2GB heap and the graph clearly shows it consuming less of the “Other memory” representing the large pages configured in the guest.

  3. JVM 3 is a 4GB heap using small pages. Although the vRAM is 8GB and nothing else is running in this VM, JVM 3 still gets a memory alert about its potential heap exceeding the vRAM line. This is correct because JVM 3 can commit memory only out of the free memory left behind after the large pages are set aside. This JVM was idle before shutting down as can be seen from the flat committed line.

  4. The last section of the graph shows what the combination of these two types of JVMs would look like. JVM 2 and JVM 3 are started at the same time and JVM 3 rapidly commits its heap until the guest runs out of memory and starts to swap.

Note that the guest paging was severe enough to trigger a warning.