VMware Cloud Community
maxkachalin
Enthusiast
Enthusiast
Jump to solution

ESXi 3.5u4 host swap size and guest memory

Hi all!

I have VM (Debian Linux), performance graphs on it shows swap usage about 250 Mb,real vswp file size is 1,6 G, but there is output from guest OS:

linux:~# vmstat

procs -


memory--


-swap -
io-- -system-- -


cpu----

r b swpd free buff cache si so bi bo in cs us sy id wa

1 0 0 739896 135300 208828 0 0 2 42 20 68 1 1 98 0

As seen, no swap used. Why VI Client counters and swap file size differs so much from guest OS usage counters.

Tags (3)
Reply
0 Kudos
1 Solution

Accepted Solutions
zanmk
Enthusiast
Enthusiast
Jump to solution

Hi,

You are looking at two different levels of memory usage. From VI Client you can read information regarding real ESX memory and swap utilization. It usually differs from you can read from within guest OS eg Linux. VM swap file (not guest) if used by VMkernel in situation when memory contention occurs. Lacking memory is mapped in swap. This is last resort and causes significant performance degradation.

Guest os swap is "higher" level from what VM swap. It is entirely managed by guest OS. It size is based on memory configured for VM and guest OS configuration. Only situation when VMkernel can influence on guest swapping is the balloon driver. This is an advanced memory saving technique enabling ESX to "tell" the guest OS to free some memory and use more swap (guest swap!) file. Freed memory can be reclaimed by VMkernel and used by other VMs. This driver is available for guest with VM Tools installed.

regards

Martin

View solution in original post

Reply
0 Kudos
6 Replies
zanmk
Enthusiast
Enthusiast
Jump to solution

Hi,

You are looking at two different levels of memory usage. From VI Client you can read information regarding real ESX memory and swap utilization. It usually differs from you can read from within guest OS eg Linux. VM swap file (not guest) if used by VMkernel in situation when memory contention occurs. Lacking memory is mapped in swap. This is last resort and causes significant performance degradation.

Guest os swap is "higher" level from what VM swap. It is entirely managed by guest OS. It size is based on memory configured for VM and guest OS configuration. Only situation when VMkernel can influence on guest swapping is the balloon driver. This is an advanced memory saving technique enabling ESX to "tell" the guest OS to free some memory and use more swap (guest swap!) file. Freed memory can be reclaimed by VMkernel and used by other VMs. This driver is available for guest with VM Tools installed.

regards

Martin

Reply
0 Kudos
maxkachalin
Enthusiast
Enthusiast
Jump to solution

Thank you for an answer.

But why .vswp file sized 1.6 GB in time when 'swap usage' about 250 MB? Or there are another swap techologie rather then 1 B used swap space ~= 1 B on disk?

Reply
0 Kudos
zanmk
Enthusiast
Enthusiast
Jump to solution

Hi!

size of the vswp file equals the difference between memory configured and the reservation. Memory reservation is a value of ESX RAM that will always be avaialble for virtual machine whereas configured memory is what guest OS see. If there is a difference between these two values (usually is) VMkernel is allowed to swap the difference. This happens in situation of memory resource contention.

Can you post real information about the VM you wrote about ? Configured memory, reservation, limit.

regards

Martin

maxkachalin
Enthusiast
Enthusiast
Jump to solution

VM configured with 2 vCPU, 1.5 GB RAM. No limits or reservations made.

UPD: I've understood, .vswp file reservation size on filesystem equal to configured RAM size, but really VMKernel using only part of it. Thank you for all your answers!

Message was edited by: maxkachalin

Reply
0 Kudos
zanmk
Enthusiast
Enthusiast
Jump to solution

1,5 GB configured memory, no reservations -> VM swap is 1,5 GB - 0 = 1,5 GB

Please look at this document: Verifying sufficient free disk space for an ESX virtual machine

>>> But why .vswp file sized 1.6 GB in time when 'swap usage' about 250 MB?

As I wrote, only influence of ESX on guest OS swap has balloon driver. 250MB swap is result of your system activity and eventually ballooning process. If you want to know if you VM has been "balloned" open VI performance charts, switch to Memory statistics and select Ballon. If it shows value other that 0, VMkernel sent signal to ballon driver to inflate.

regards

Martin

Reply
0 Kudos
maxkachalin
Enthusiast
Enthusiast
Jump to solution

In my case there is no balloning.

It seems, I've understood swaps specific because of your posts. One more time thank you!

Reply
0 Kudos