In an article posted today by VMware, Ben Corrie (Java memory expert and VMware lead engineer) outlines how to improve memory management in virtualized Java environments using Elastic Memory for Java (EM4J). In short, it helps get more applications running on a single host. 

The main problem EM4J sets out to solve is memory reclamation.  In the past, a process called guest ballooning was enabled to allow the hypervisor to borrow memory from less active VMs and allocate the memory to more active VMs.  However, since the JVM manages memory in a way that is opaque to the guest OS, the hypervisor previously had not been able to access and manage the effective distribution of that memory. 

With EM4J, the same elastic resource management advantages provided by virtualization for non-Java workloads are now available in Java.  EM4J helps to drive up hardware utilization by providing capabilities to manage memory, the typical limiting factor.  Corrie explains what this means to users:

Imagine you have Java workloads that serve different geographies in separate groups of VMs. When Asia is most active, the US is asleep. At the end of each active period in Asia, the Asia JVM heaps are full of stale session data, cache data etc. For the next 12 hours, those VMs will be relatively idle and the memory being consumed to store all that garbage and cold cache data is wasted. You could be putting that memory to much better use in your US VMs! With EM4J, the hypervisor can balloon into the JVM heaps of the Asia servers and reclaim that memory so that it can be used by the US ones. Once the US winds down, the Asia JVMs can just kick the balloon out of their heaps to take memory back from the US servers.

Corrie also explains a bit of the evolution of this product. Originally released as a 1.0 version last summer, EM4J 1.1 was recently released as part of the larger VMware vFabric 5.1 release, integrating EM4J into several VMware products including vCenter and tc Server to help with monitoring, analyzing, and sizing plus additional platform support.

For more information, see the full article on the vFabric blog.