Skip to content

Commit

Permalink
CLOUDSTACK-10073: KVM host RAM overprovisioning (apache#2266)
Browse files Browse the repository at this point in the history
Commit enables a new feature for KVM hypervisor which purpose is to increase virtually amount of RAM available beyond the actual limit.
There is a new parameter in agent.properties: host.overcommit.mem.mb which enables adding specified amount of RAM to actually available. It is necessary to utilize KSM and ZSwap features which extend RAM with deduplication and compression.
  • Loading branch information
bwsw authored and rohityadavcloud committed Sep 29, 2017
1 parent a06530d commit 3381c38
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 6 additions & 2 deletions agent/conf/agent.properties
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,15 @@ hypervisor.type=kvm
# vm.rng.rate.period=1000
# The number of milliseconds in which the guest is allowed to obtain the bytes
# specified above.

#
# router.aggregation.command.each.timeout=600
# timeout value for aggregation commands send to virtual router
#

# host.overcommit.mem.mb = 0
# allows to increase amount of ram available on host virtually to utilize Zswap, KSM features
# and modern fast SSD/3D XPoint devices. Specified amount of MBs is added to the memory agent
# reports to the Management Server
# Default: 0
#
# vm.watchdog.model=i6300esb
# The model of Watchdog timer to present to the Guest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv

private long _dom0MinMem;

private long _dom0OvercommitMem;

protected boolean _disconnected = true;
protected int _cmdsTimeout;
protected int _stopTimeout;
Expand Down Expand Up @@ -849,6 +851,11 @@ public boolean configure(final String name, final Map<String, Object> params) th
// Reserve 1GB unless admin overrides
_dom0MinMem = NumbersUtil.parseInt(value, 1024) * 1024 * 1024L;

value = (String)params.get("host.overcommit.mem.mb");
// Support overcommit memory for host if host uses ZSWAP, KSM and other memory
// compressing technologies
_dom0OvercommitMem = NumbersUtil.parseInt(value, 0) * 1024 * 1024L;

value = (String) params.get("kvmclock.disable");
if (Boolean.parseBoolean(value)) {
_noKvmClock = true;
Expand Down Expand Up @@ -2782,12 +2789,12 @@ protected List<Object> getHostInfo() {
info.add((int)cpus);
info.add(speed);
// Report system's RAM as actual RAM minus host OS reserved RAM
ram = ram - _dom0MinMem;
ram = ram - _dom0MinMem + _dom0OvercommitMem;
info.add(ram);
info.add(cap);
info.add(_dom0MinMem);
info.add(cpuSockets);
s_logger.debug("cpus=" + cpus + ", speed=" + speed + ", ram=" + ram + ", _dom0MinMem=" + _dom0MinMem + ", cpu sockets=" + cpuSockets);
s_logger.debug("cpus=" + cpus + ", speed=" + speed + ", ram=" + ram + ", _dom0MinMem=" + _dom0MinMem + ", _dom0OvercommitMem=" + _dom0OvercommitMem + ", cpu sockets=" + cpuSockets);

return info;
}
Expand Down

0 comments on commit 3381c38

Please sign in to comment.