VMware Horizon Community
hbowlin
Contributor
Contributor
Jump to solution

Questions about host memory usage

I was wondering if someone could provide some insight on the following situation. We have vSphere host set up with 32 GB of RAM. On it, we have 10 VMware View desktops and a couple server VMs. We have configured each to have 2GB of RAM. The host is showing an alarm for host memory usage, but if you look at each of the Windows XP VMs, the memory granted is WAY higher than the memory active. We don't have any reservations set and shares are set at normal. I am just wondering why the system is reporting a memory constraint when most of the memory it is alocating isn't active. Also, the memory shared is showing 0. So does this mean that memory page sharing is not taking plac? Am I missing something?

Reply
0 Kudos
1 Solution

Accepted Solutions
RParker
Immortal
Immortal
Jump to solution

ESX has something called overhead. A VM has 2 ways to manage memory. a physical machine has one, physical RAM, and when that physical RAM is gone, the OS is left with one option, swap.

VM's work the same way. A hardware divides the VM's into smaller sections, only they have hard limits. So your VM's are set to 2G, the OS and the VM only sees 2 GB of RAM. When that RAM is gone, the OS has to decide where the supplement RAM is to come from. Since it's a Vritual machine, the machine RAM can ALSO be swapped.

So when you create a VM, and you don't have reservations, you are telling the Virtual Machine to get RAM from the host, if that fails, get RAM from a swap file on disk. Failing that THEN the OS can use internal swap, but ESX forces a VM to use it's "balloon" driver to drive up internal RAM and tricking the OS into thinking it MUST use internal swap. That's probably where you are confused.

The RAM usage you see is the VM taking ALL RAM from the host. If the host has say 48GB of RAM, and you have 10 VMs' running, that's at most 20GB of RAM in use. There is PLENTY of RAM left for other VM's, so in this case the host memory is high (usage) but not ACTIVE, meaning it's allocated for the VM but the OS isn't really "using it" for the moment.

As you add more VM's you will see this drop. Also keep in mind that with similar VM's ( like Windows) they can actually share memory also, so among those 20 VM's they are all Windows (lets suppose) and 30% of that is shared among those 20 VM's, so 30% of 20GB is 7GB, so 13GB of which is actually being used, so in a perfect world, ideal conditions your host should be approx 15GB used, probably less than 6GB active, but EVERY VM is showing 2GB host memory, right?

That's normal. When you get closer to the host memory limit these numbers will change, based on need and OS, and what the OS do.. and to complicate it even more, reservations, and VM limits and priority will ALSO skew these numbers.

Isn't ESX fun? Smiley Wink

View solution in original post

Reply
0 Kudos
7 Replies
mittim12
Immortal
Immortal
Jump to solution

If I'm not mistaken the alert is based on the memory consumed and not the active memory. So if your consumed memory is 90% of your available memory than the alarm will trigger.






If you found this or any other post helpful please consider the use of the Helpful/Correct buttons to award points

Reply
0 Kudos
hbowlin
Contributor
Contributor
Jump to solution

The consumed memory is over 90%. I guess what I asking is the following. If I have 10 Windows XP VMs each with 2 GB each, I have an expectation that ESX isn't going to hand over 20 GB of memory since the active memory is only showing about 4 GB. Additionally, the shared memory shows 0. With 10 VMs all the same I would expect this number to be high. I am not seeing why ESX thinks it is memory constrained with 80% of the memory it has alocated to VMs isn't being used. Is the right move to decrease the memory per VM??

Reply
0 Kudos
RParker
Immortal
Immortal
Jump to solution

ESX has something called overhead. A VM has 2 ways to manage memory. a physical machine has one, physical RAM, and when that physical RAM is gone, the OS is left with one option, swap.

VM's work the same way. A hardware divides the VM's into smaller sections, only they have hard limits. So your VM's are set to 2G, the OS and the VM only sees 2 GB of RAM. When that RAM is gone, the OS has to decide where the supplement RAM is to come from. Since it's a Vritual machine, the machine RAM can ALSO be swapped.

So when you create a VM, and you don't have reservations, you are telling the Virtual Machine to get RAM from the host, if that fails, get RAM from a swap file on disk. Failing that THEN the OS can use internal swap, but ESX forces a VM to use it's "balloon" driver to drive up internal RAM and tricking the OS into thinking it MUST use internal swap. That's probably where you are confused.

The RAM usage you see is the VM taking ALL RAM from the host. If the host has say 48GB of RAM, and you have 10 VMs' running, that's at most 20GB of RAM in use. There is PLENTY of RAM left for other VM's, so in this case the host memory is high (usage) but not ACTIVE, meaning it's allocated for the VM but the OS isn't really "using it" for the moment.

As you add more VM's you will see this drop. Also keep in mind that with similar VM's ( like Windows) they can actually share memory also, so among those 20 VM's they are all Windows (lets suppose) and 30% of that is shared among those 20 VM's, so 30% of 20GB is 7GB, so 13GB of which is actually being used, so in a perfect world, ideal conditions your host should be approx 15GB used, probably less than 6GB active, but EVERY VM is showing 2GB host memory, right?

That's normal. When you get closer to the host memory limit these numbers will change, based on need and OS, and what the OS do.. and to complicate it even more, reservations, and VM limits and priority will ALSO skew these numbers.

Isn't ESX fun? Smiley Wink

Reply
0 Kudos
mittim12
Immortal
Immortal
Jump to solution

I think RParker gave a good explanation of the memory usage. If your ESX host needs memory for other VM's it will active the balloon drive to pull the inactive memory from other VM's and allocate that to the VM that needs it. When I'm looking at counters I always look at active memory, swapping, and ballooning.






If you found this or any other post helpful please consider the use of the Helpful/Correct buttons to award points

hbowlin
Contributor
Contributor
Jump to solution

Thanks a lot for the explanation. So is the host memory alarm referenced earlier in the post basically useless?

Reply
0 Kudos
RParker
Immortal
Immortal
Jump to solution

> Thanks a lot for the explanation. So is the host memory alarm referenced earlier in the post basically useless?

It's more keeping you on your toes, not useless, once you learn how your VM's are consuming memory, and what your needs are, the alarms make sure you don't go too far afield, but advanced users probably turn them off, I do, because I know we are short on memory, I don't need to be reminded every day.. Smiley Happy

Reply
0 Kudos
NuggetGTR
VMware Employee
VMware Employee
Jump to solution

so you have 10 workstations and 2 servers? you said a couple but how many?

each machine will have a memory overhead of around 80 - 90MB of RAM so with your amount of machines you would be looking at about of 1GB or more on overhead. so effectivly you have less than 31GB to go to the machines.

The memory shared in the performance logs means how much physical ram is available to be shared with other vms, for eg if you allocate 2GB of RAM to a vm but its only using 1.2GB it has 800MB of memory available to be shared. With it saying 0 means that there is either not enough memory to go around and its swapping and or the machine is using everything it has been given.

________________________________________ Blog: http://virtualiseme.net.au VCDX #201 Author of Mastering vRealize Operations Manager
Reply
0 Kudos