0

We want to know if we can't limit the balloon memory on a Linux machine by tuning the value of -

Mem.CtlMaxPercent

for example is it possible to set 20% for Mem.CtlMaxPercent instead the default of 65%?

The target is to give more available memory on RHEL machine, because the balloon memory on RHEL machine is around 30G and we want to decrease this value so RHEL machine will be with more available memory

reference - https://nerdblurt.com/vmware-memory-ballooning-sched-mem-maxmemctl-versus-mem-ctlmaxpercent/

  • Sched.Mem.MaxMemCtl: Maximum amount of memory reclaimed from the selected virtual machine by ballooning, in megabytes (MB). If the ESXi host needs to reclaim additional memory, it is forced to swap. Swapping is less desirable than ballooning. Default = -1 (Unlimited) (VM advanced Setting)

  • Mem.CtlMaxPercent: Limits the maximum amount of memory reclaimed from any virtual machine using the memory balloon driver (vmmemctl), based on a percentage of its configured memory size. Specify 0 to disable reclamation for all virtual machines. Default = 65% (Host advacned setting)*

Stuggi
  • 3,506
  • 4
  • 19
  • 36
King David
  • 549
  • 6
  • 20
  • 1
    Struggling to understand what you're saying here - you have a ESXi host that's memory constrained, and it's ballooning all of the UNUSED memory that a specific VM has previously used, yet you want to have some of that now-empty memory dedicated to your VM, even though it's not using it, presumably so it's faster to access WHEN it's needed by that VM - and you want to do this via changing ballooning options rather than just by reserving memory for that VM, or having more real memory? Is that right? – Chopper3 Oct 09 '20 at 09:49
  • I will say that the balloon memory take too meny space from the VM , while VM machine have 64 , and the ballon take 40G , so application on VM cant start so we want to decrease the balloon memory in way it will take less memory on VM , for example 10G insted of 40G – King David Oct 10 '20 at 19:15
  • 1
    I think you need to read more about what Balloon is sorry. – Chopper3 Oct 11 '20 at 20:29
  • You need more resources or to right-size your VMs. – ewwhite Oct 11 '20 at 22:18

1 Answers1

3

Ballooning only happens under some very specific conditions. For VMware ESXi to "inflate" the balloon driver in a VM, the host must be under very heavy memory contention, commonly less than 4% of free memory on the host.

Note that the balloon driver just asks the OS on the VM for memory, and any memory pages given to it are promptly deleted by the hypervisor since the VM wasn't using them for anything. So the balloon driver isn't actually using memory, it's just the way the hypervisor tricks the OS into telling it which memory pages it doesn't need.

If that doesn't solve the memory contention issue the host is having, the hypervisor inflates the balloon driver even more, to force the OS on the VM to start swapping memory to disk. This isn't ideal, but it's a lot better than the alternative, which is that the hypervisor start swapping to disk, since the OS on the VM actually knows what it's swapping to disk.

The way to limit ballooning is not the alter the presets as you've asked, but instead to assign a memory reservation to the VM that's more than 35% percent of the total memory of the VM (as the default limit for the balloon driver is 65%, reservations of 35% or less will have no effect on ballooning). This guaranties that the VM can get at least the reservation of memory, so this should in your case be the minimum amount of memory required to start your application on your VM.

Keep in mind that ballooning indicates very heavy memory contention of less than 4% free memory on the host, aka. that your host is almost completely out of memory, which is why it's taking such drastic measures.

Add more physical memory to the host, or move some VMs away from it to lessen memory demand!

Tweaking ballooning isn't going to fix anything! It's like applying a band-aid to a small cut to your hand while your leg is stuck under a car.

Stuggi
  • 3,506
  • 4
  • 19
  • 36
  • based on what you said , I think to do the following test on all VM machines , for example when vmware-toolbox-cmd stat balloon value is more then 30% then memory machine then it will give alert about this , what you think about this test? – King David Oct 24 '20 at 20:14
  • It depends quite a lot on your environment. If you don't oversubscribe memory at all (aka. you have more host memory available than all your VMs combined), you should never see any balloon inflation. If you do, then you need to find by trial and error a threshold that works for you. Another way to achieve the same thing would be to monitor host memory consumption, as ballooning only happens when you reach really low amounts of free memory on the host. A little balloon memory inflation isn't too bad as long as your VMs doesn't run out of memory and start swapping to disc. – Stuggi Oct 25 '20 at 09:47