# US 2014/0196033 A1 · System and method for improving memory usage in virtual machines

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2014/0196033 A1
- Document ID: US20140196033A1
- Status: Published application
- Kind: A1
- Application number: 13/782,661
- Filed: 2013-03-01
- Published: 2014-07-10
- Earliest claimed: 2013-01-10
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Norman Bobroff; Michael Hilton Dawson; Liana Liyow Fong; Arun Kwangil Iyengar; Peter Hans Westerink
- Web page: https://patentgrep.com/patent/US20140196033A1

## CPC

- G06F 9/5016: {the resource being the memory}
- G06F 3/0604: {Improving or facilitating administration, e.g. storage management}
- G06F 9/455: Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 9/5022: {Mechanisms to release resources}
- G06F 12/0269: {Incremental or concurrent garbage collection, e.g. in real-time systems (G06F12/0261 takes precedence)}
- G06F 2009/45583: {Memory management, e.g. access or allocation}
- G06F 2212/152: Virtualized environment, e.g. logically partitioned system
- G06F 2212/702: Conservative garbage collection
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method (and system) for managing memory among virtual machines in a system having a plurality of virtual machines, includes providing at least one memory optimization mechanism which can reduce memory usage of a virtual machine at a cost of increasing CPU usage. Information on memory usage and CPU usage of each virtual machine is periodically collected. In response to detecting that a first virtual machine exhibits a high level of memory use, at least one second virtual machine with extra CPU capacity is identified. The at least one memory optimization mechanism is applied to the at least one second virtual machine, to reduce memory used by the at least one second virtual machine, thereby providing a portion of freed memory. The portion of freed memory is then allocated to the first virtual machine.

## Claims

### Claim 1

An apparatus, comprising:
at least one processor upon which can be executed a virtual memory optimizer for optimizing a memory usage among a plurality of concurrently-running virtual machines; and
a memory that stores a set of computer readable instructions for implementing and executing said virtual memory optimizer, said memory optimizer performing a monitoring of a usage of memory by each virtual machine of said plurality of concurrently-running virtual machines and applying at least one memory optimization mechanism that reallocates memory among said concurrently-running virtual machines based on reducing a memory usage of a virtual machine as a tradeoff of increasing a central processing unit (CPU) usage to achieve said reduced memory usage.

### Claim 2 (depends on 1)

The apparatus of claim 1, as also executing at least one of said plurality of concurrently-running virtual machines.

### Claim 3 (depends on 1)

The apparatus of claim 1, further comprising a hypervisor for controlling machine assets of said apparatus among a plurality of dynamic logical partitions (DLPARs), wherein said machind assets are dynamically allocated among said DLPARs without a rebooting of said apparatus.

### Claim 4 (depends on 1)

The apparatus of claim 1, wherein said virtual memory optimizer is configured to perform:
monitoring of a central processing unit (CPU) usage and a memory usage of each said VM;
detecting that a first VM of the plurality of concurrently-running VMs requires more memory; and
exercising a memory allocation mechanism for allocating additional memory to the first VM; and allocating the additional memory to the first VM,
wherein the additional memory to be allocated is determined based upon considering a cost of increasing a central processing unit (CPU) usage of the concurrently-running VMs in order to reallocate memory to said first VM.

### Claim 5 (depends on 4)

The apparatus of claim 4, wherein the memory allocation mechanism for allocating additional memory comprises:
determining initially if any free memory not currently used by any of the other VMs of said plurality of VMs is available, and, if so, allocating at least a portion of said free memory to said first VM, the additional memory thereby being allocated to said first VM at no addition increase of CPU usage of any of said concurrently-running VMs; and
if no free memory is currently available, determining whether any of the other VMs of said plurality of VMs can free up memory if one or more memory optimization mechanisms were to be applied, and, if so, allocating said freed up memory to said first VM, wherein said determining whether a VM can free up memory considers a CPU overhead cost in applying said one or more memory optimization mechanisms.

### Claim 6 (depends on 5)

The apparatus of claim 5, wherein said one or more memory optimization mechanisms comprise one or more of:
a memory compression mechanism, wherein a contents of memory are compressed using a predetermined compression algorithm;
a memory deduplication mechanism, wherein duplicate memory pages are identified and a single copy of the duplication memory pages are retained and shared among more than one virtual machine; and
a delta encoding mechanism, wherein, for two pages having similar but not identical contents, only one of the two pages is retained along with a delta which encodes differences between the two pages.

### Claim 7 (depends on 6)

The apparatus of claim 6, wherein the detecting that a first VM need more memory comprises one or more of:
detecting that an amount of free memory available to said first VM is decreasing and approaching zero;
detecting that said first VM has no free memory and is paging; and
making a prediction of memory needs of said first VM based on a past performance.

### Claim 8 (depends on 1)

The apparatus of claim 1, as comprising a server connected to a network of computers.

### Claim 9 (depends on 8)

The apparatus of claim 8, wherein said virtual memory optimizer controls a memory allocation for at least one VM operating on another computer in said network.

### Claim 10

A system comprising a plurality of concurrently-running virtual machines (VMs), said system comprising at least one computer comprising:
at least one processor upon which can be executed a virtual memory optimizer for optimizing a memory usage among said plurality of concurrently-running VMs; and
a memory that stores a set of computer readable instructions for implementing and executing said virtual memory optimizer, said virtual memory optimizer providing at least one memory optimization mechanism which can reduce a memory usage of a virtual machine at a cost of increasing a central processing unit (CPU) usage.

### Claim 11 (depends on 10)

The system of claim 10, wherein said virtual memory optimizer executes a method of virtual memory optimization comprising:
periodically collecting information on a memory usage and a CPU usage of each VM;
in response to a first VM exhibiting a high level of memory use, identifying at least one second VM with an extra CPU capacity;
applying, to the at least one second VM the at least one memory optimization mechanism, to reduce memory used by the at least one second VM, thereby providing a portion of freed memory; and
allocating the portion of freed memory to the first VM.

### Claim 12 (depends on 11)

The system of claim 11, wherein the at least one memory optimization mechanism comprises reducing a heap size corresponding to a memory area managed by a garbage collector.

### Claim 13 (depends on 12)

The system of claim 12, said virtual memory optimization method further comprising:
collecting empirical data on a garbage collection overhead as a function of heap size; and
using the empirical data to determine a heap size for said at least one second virtual machine.

### Claim 14 (depends on 11)

The system of claim 11, said virtual memory optimization method further comprising:
upon determining that said first virtual machine is exhibiting said high level of memory use, initially determining whether additional memory is available without having to free memory from another virtual machine; and
if such additional memory is available, then allocating at least a portion of the additional memory to said first virtual machine.

### Claim 15 (depends on 11)

The system of claim 11, said virtual memory optimization method further comprising:
setting a predetermined threshold of CPU usage for each said virtual machine;
determining whether a virtual machine will continue to operate below its CPU usage threshold if memory current allocated to that virtual machine were to be freed; and
freeing memory from that virtual machine only if its CPU usage will remain below its CPU usage threshold, by said applying the at least one memory optimization mechanism to that virtual machine and deallocating memory from that virtual machine of memory freed up by the at least one memory optimization mechanism.

### Claim 16 (depends on 11)

The system of claim 11, said virtual memory optimization method further comprising:
setting a target CPU usage level for each said virtual machine; and
providing a priority among said virtual machines for said applying the at least one memory optimization mechanism, said priority being based upon a difference between a current CPU usage level of a virtual machine and its target CPU usage level.

### Claim 17 (depends on 11)

The system of claim 11, said virtual memory optimization method further comprising:
setting a target memory usage level for each said virtual machine; and
providing a priority among said virtual machines for said applying the at least one memory optimization mechanism, said prior being based upon a difference between a current memory usage level of a virtual machine and its target memory usage level.

### Claim 18 (depends on 11)

The system of claim 11, wherein the at least one memory optimization mechanism comprises a plurality of memory optimization mechanisms.

### Claim 19 (depends on 18)

The system of claim 18, wherein said plurality of memory optimization mechanisms comprise:
a memory compression mechanism, wherein a contents of memory are compressed using a predetermined compression algorithm;
a memory deduplication mechanism, wherein duplicate memory pages are identified and a single copy of the duplication memory pages are retained and shared among more than one virtual machine; and
a delta encoding mechanism, wherein, for two pages having similar but not identical contents, only one of the two pages is retained along with a delta which encodes differences between the two pages.

### Claim 20 (depends on 18)

The system of claim 18, said virtual memory optimization method further comprising applying said plurality of memory optimization mechanisms in accordance with a priority.

### Claim 21 (depends on 16)

The system of claim 16, said virtual memory optimization method further comprising:
detecting that a virtual machine is exceeding its target CPU usage level; and
reducing a level of optimization being executed on said virtual machine detected as exceeding its target CPU usage level.

### Claim 22 (depends on 11)

The system of claim 11, wherein said system comprises a plurality of virtual machines operating on a plurality of computers interconnected in a network.
