VMware Cloud Community
huntersvt
Contributor
Contributor

VMWare guest and JVM memory allocation

Having an issue that I've been researching for a long time, but not really finding an answer that fits my situation and so I thought I'd post here. We're running ESXI 5.5 and I've got a guest server running Tomcat 6 and a 1.6 JVM on Windows Server 2008 R2. I know the JVM and Tomcat are old, but unfortunately I'm restricted from upgrading either due to application requirements.

I'm running into an issue with full garbage collection periodically taking too long (minutes vs seconds). My understanding is that this usually indicates an issue with memory allocation, but my looking at memory usage doesn't seem to support that, but increasing memory available to the server and then to the Tomcat instances has resolved the issue in the past. However, our admins are reluctant to increase resources available to a guest without proof it's needed (understandable). I've been told that we can over allocate memory to Tomcat instances because in looking at utilization stats, the VM guest is assigned 8 gig of RAM, but active memory tops out at 5 gig based on stats I've gathered. The definition of over allocation in this case being that we can assign more memory to the Tomcats than Windows believes it has available. My research with VM's and how JVM's use memory indicate that this may not be the best idea. I would like to resolve the garbage collection issue without requesting more resources, but if I can't, I need to figure out how to prove to our IT staff that we need more resources assigned to that server.

I would be grateful for any experiences that people experienced with VM's and JVM memory usage and garbage collection could offer. I searched these forums quite a bit and didn't quite find anything that fits my exact issue. Thanks for your time.

- Patrick

Tags (3)
0 Kudos
2 Replies
rcporto
Leadership
Leadership

Instead of increase the allocated memory, ask your VMware admin to configure the memory reservation to the size of allocated memory and check if you get better results with the garbage collection, see this KB article: VMware KB: Best practices for running Java in a virtual machine

These points are general recommendations:

  • Size the virtual machine memory to leave adequate space for the Java heap, the other memory demands of the Java virtual machine code and stack, and any other concurrently executing process that needs memory from the guest operating system.
  • Set the memory reservation value in the VMware Infrastructure Client to the size of memory for the virtual machine. As any type of Memory Swapping  (physical or virtual) is detrimental to performance of JVM heap especially for Garbage Collection.
  • Determine the optimal number of virtual CPUs for a virtual machine that hosts a Java application by testing the virtual machine configured with different numbers of virtual CPUs at different times with the same load.
  • If you are using multiple Garbage Collector threads in your JVM, match the number of those threads to the number of virtual CPUs that are configured in the virtual machine.
  • For easier monitoring and load balancing, use one JVM process per virtual machine.
  • If your ESX host is overcommitted, ensure that the Balloon Driver is running within the virtual machine so that memory is optimally managed.
---

Richardson Porto
Senior Infrastructure Specialist
LinkedIn: http://linkedin.com/in/richardsonporto
0 Kudos
huntersvt
Contributor
Contributor

Thanks Richardson, I'll take this information and talk to our admin.

0 Kudos