VMware Cloud Community
xuping1
Contributor
Contributor

The memory and cpu usage displayed by vsphere does not match the actual

System version centos 7.6

Vsphere vm

xuping1_0-1638173470163.png

 

xuping1_1-1638173512738.png

 

0 Kudos
6 Replies
vbondzio
VMware Employee
VMware Employee

vSphere and Guest OS metrics measure different things. Memory usage for a VM object tracks "active" or "touched" memory, which is a heuristic of how many pages where actively read from / written to. 24 is 75% of 32 so either that VM was just powered on when you took the screenshot or it's memory is preallocated. In any case, not the same metrics, they are not supposed to match.

Tibmeister
Expert
Expert

Seems to be an ongoing conversation with business teams and management that I have had since 2013 at least.  Trying to explain why the metrics are different is always fun, and why CPU seems higher in the guest than in ESXi is always great as well.  Explaining watchdog timers used by the OS, COSTOP/IOWAIT/etc to developers and managers is always fun.

0 Kudos
vbondzio
VMware Employee
VMware Employee

Yeah, I'm hoping we can improve on how we communicate that difference in the UI and metric names in the future, until then it remains something that just has to be understood ... I did write up a "ELI5" take on how active / touched works in case someone else stumbles over it: https://communities.vmware.com/t5/ESXi-Discussions/Reported-Memory-usage-on-SQL-VMs/m-p/2876282/high...

0 Kudos
Tibmeister
Expert
Expert

I think it's more of the understanding on how the two vastly different pieces view the environment, and what they each can see.  Windows still, as far as I can tell, doesn't properly report Zero pages, it just kinda lumps that into Free/Cache, which is a misnomer in itself within Windows.  Plus, you get some applications (looking at you SQL Server) that will consume all available memory unless otherwise told not to, and writes random junk to the memory addresses it's not actually using so that it doesn't get marked as Zero page by the hypervisor and used somewhere else.  This has the effect of reserving the memory, but screws up reporting horribly when trying to right-size the environment.

0 Kudos
vbondzio
VMware Employee
VMware Employee

Windows tracks Zero / Free / Standby Lists under "Available", you can't separate Free and Zero via publicly available metrics / APIs but you can see it with e.g. Sysinternals Rammap. Even for some opportunistic applications that allocate what they can, unless they use it for cache it will remain zero and can be shared by TPS (assuming small page guest and host backing). The question of course is whether the "random junk" has any significant or even noticeable benefit for the workload :-). I think we are in agreement, both points of view are important and I hope we can find a way to make the distinction and their individual value more intuitively accessible in the future. 

0 Kudos
Tibmeister
Expert
Expert

I think the public API piece is the key because that's all that VMware Tools would be able to use, AFAIK.

0 Kudos