(VMware) Will a guest VM swap when RAM usage is high even though Active is not?
pwjohnston
Member Posts: 441
We are currently having a discussion in my environment. The assumptions are that
In the VM guest (SLES 11) we’re seeing RAM utilization at around 93%. However in the vSphere/vCops is showing 5072309 kb Active Write of 8388608 (8GB) KB of allocated RAM. Roughly about 60.46 % utilization rate.
The question, is the above assumption correct and if so:
If top inside the guest is inaccurate in the VM and it reaches 100% RAM utilization does the VM guest then swap and if so I presume with the vswp which is located on the SAN and cause a slowdown on the VM Guest?
“The tools that are designed for a physical infrastructure memory management in Linux such as top, free, vmstat, /proc/meminfo don’t work on a VM in an ESXi hypervisor because they rely on the OS’s ability to monitor the physical RAM directly in a bare metal system. In a virtual infrastructure, the guest OS can't see the physical hardware, only the virtual hardware that has been emulated by the (ESXi) hypervisor. Because an OS can't directly access most of the host server's physical hardware, traditional performance monitoring tools won't function properly in a virtual infrastructure.”
In the VM guest (SLES 11) we’re seeing RAM utilization at around 93%. However in the vSphere/vCops is showing 5072309 kb Active Write of 8388608 (8GB) KB of allocated RAM. Roughly about 60.46 % utilization rate.
The question, is the above assumption correct and if so:
If top inside the guest is inaccurate in the VM and it reaches 100% RAM utilization does the VM guest then swap and if so I presume with the vswp which is located on the SAN and cause a slowdown on the VM Guest?
Comments
-
jibbajabba Member Posts: 4,317 ■■■■■■■■□□First: Yes, things like "top" in Linux or the "taskmanager" in Windows can be false in a virtual environment.
The guest OS doesn't "know" visualization features such as Transparent Page Sharing, Ballooning, Compression and last but not least, swapping.
The whole point in virtualisation is of course overcomittment, so you don't waste allocated resources. Say a VM is assigned 8GB of RAM but uses only half that. The remaining 4GB of RAM can be allocated to other VMs needing it. Now assume the VM uses 100% of memory - all 8GB of RAM - for a while. Now you got two of those VMs using the same page in memory, VMware effectively gets rid of one copy, freeing up some memory (somewhat like deduplication).
The Guest OS would not know anything about it, still thinking it needs 100% ..
I am so bad in explaining things like that - I hope it makes vaguely sense
If all those features are exhausted, the last step is indeed swapping, that is where it goes really dirty and poor. Because of this actually you NEED to monitor the performance from VMware point of view - which you do with vcops anyway.
As for OS swap - if the OS thinks you are out of RAM, it will indeed swap. Therefore a lot of people would put the virtual machine swap on separate datastores for example.
In fact, a lot of times people even disable swap in Linux / Pagefile in Windows when they are VMs. Most providers I worked with won't allow swap because of the risk of disk performance issues.My own knowledge base made public: http://open902.com -
pwjohnston Member Posts: 441jibbajabba wrote: »As for OS swap - if the OS thinks you are out of RAM, it will indeed swap. Therefore a lot of people would put the virtual machine swap on separate datastores for example.
This is actually not a bad idea. Maybe I can get them spring for some RAMdisks to put in the SAN.jibbajabba wrote: »In fact, a lot of times people even disable swap in Linux / Pagefile in Windows when they are VMs. Most providers I worked with won't allow swap because of the risk of disk performance issues.
Is that even safe? If the guest doesn't think it has RAM or SWAP to work with won't it crash? -
scott28tt Member Posts: 686 ■■■■■□□□□□pwjohnston wrote: »
If top inside the guest is inaccurate in the VM and it reaches 100% RAM utilization does the VM guest then swap and if so I presume with the vswp which is located on the SAN and cause a slowdown on the VM Guest?
The guest OS has no awareness of the vswp file - that file belongs to ESXi if it needs to swap memory at the host level (where an overcommitted host begins to run out of physical RAM). If it needs to, the guest OS will swap to the same place as it would do if it were running on a physical system - to the swap partition or file configured as part of the OS installation, this will sit inside one of the vmdk files of the VM.VCP2 / VCP3 / VCP4 / VCP5 / VCAP4-DCA / VCI / vExpert 2010-2012
Blog - http://vmwaretraining.blogspot.com
Twitter - http://twitter.com/vmtraining
Email - vmtraining.blog@gmail.com -
dave330i Member Posts: 2,091 ■■■■■■■■■■pwjohnston wrote: »This is actually not a bad idea. Maybe I can get them spring for some RAMdisks to put in the SAN
Setting aside SSD for vswap dir is an inefficient use of resources. You get better performance using the SSD as read/write cache.2018 Certification Goals: Maybe VMware Sales Cert
"Simplify, then add lightness" -Colin Chapman -
JasminLandry Member Posts: 601 ■■■□□□□□□□This kind of topic is the reason why I just love this forum, you get to learn so much just reading experienced people's posts.
-
lsud00d Member Posts: 1,571On the Hyper-V side of things...same deal, guest OS has no idea of the underpinnings related to the host OS/hardware. This makes things interesting with dynamic memory allocation because the only "true view" is running perfmon from the host but it does allow you to maximize RAM usage (as long as you plan and adjust properly!).
Also regarding the page file for Windows VM's--rule of thumb in my shop is add a separate disk and move the page file there, however retain 512mb on C:\ for crashdumps. With the pagefile on a separate disk, it can be excluded from things like backup and WAN replication.