Solved

Vmware Swap file

Posted on 2014-02-23
5
710 Views
Last Modified: 2014-03-10
per vmware  whenever a VM is powered on , it creates a swap file with the same size as the dedicated RAM, and if it has memory reservation, then the swap file will be equal to Dediated RAM minus size of reserved RAM.

can someone explain the latter (why when there is memory reserved, the swap file will be smaller)?



Also I wonder if this swap file gets automatically removed without powering off the VM, seeing that VMs swap files can take a lot of disk space, if many of them are powered on.
by the way, is swap file the same as windows memory page (temporary memory)?

i
Thanks
0
Comment
Question by:jskfan
  • 2
  • 2
5 Comments
 
LVL 117

Assisted Solution

by:Andrew Hancock (VMware vExpert / EE MVE)
Andrew Hancock (VMware vExpert / EE MVE) earned 250 total points
ID: 39880916
Because that is the guaranteed size of memory which is required to start the VM, as you have defined by RESERVING the Memory requirement.

a virtual machine is configured with a reservation then the swap file will be an empty file with the size of (virtual machine memory configuration – VM memory reservation). e.g. , an 8GB virtual machine is configured with a 1024MB memory reservation, the size of the swap file will be 7168MB.

If the VM is Powered OFF, the SWAP file is removed, from the datastore, it's not required.

Remember this SWAP file is emprty, and only EVER used, if there is memory contention on the host, e.g. Host runs out our memory, and the VMs will then swap to disk!

If this happens performance will be poor, never let the host run out of memory.
0
 

Author Comment

by:jskfan
ID: 39881108
<<>Remember this SWAP file is emprty, and only EVER used, if there is memory contention on the host, e.g. Host runs out our memory, and the VMs will then swap to disk!>

even if it is empty , it will count on the capacity of datastore?

for instance if there is 2 GB disk space free on datastore and you power up a VM that has 4GB of RAM provisioned, VMware will not let it power on.
0
 
LVL 117
ID: 39881135
Correct, the space is allocated, but it's empty!

and it does not contain any zeros, or zeroed out!

see here......

http://frankdenneman.nl/2012/11/14/alternative-vm-swap-file-locations-qa/

for instance if there is 2 GB disk space free on datastore and you power up a VM that has 4GB of RAM provisioned, VMware will not let it power on.

correct, because the hypervisor, cannot create the swap file, because you have no storage space.
0
 
LVL 13

Accepted Solution

by:
Abhilash earned 250 total points
ID: 39882415
A swap file is always created when the VM is powered on.
Remember that Swap space = Allocated memory- reserved memory.
It is needed only when the VM runs out of memory and it is the last step VMKernel takes after trying Transparent page Sharing, memory compression and Ballooning.
This is to ensure that guest does not run out of memory.
The swapping causes a high performance degradation so always avoid it.

<<Also I wonder if this swap file gets automatically removed without powering off the VM, seeing that VMs swap files can take a lot of disk space, if many of them are powered on.
by the way, is swap file the same as windows memory page (temporary memory)?>>

Yes swap file goes off when you power off the machine.
As you have already mentioned. If you have enough RAm you can reserve the memory so swap file creation does not take place.

Windows paging is controlled by OS. And happens on the disk assigned to VM. The swapping to the swap file is controlled by kernel and it is triggered by kernel only when it runs out of memory.
They are totally different from one another.
0
 

Author Closing Comment

by:jskfan
ID: 39918755
Thank you Guys!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is an update and follow-up of my previous article:   Storage 101: common concepts in the IT enterprise storage This time, I expand on more frequently used storage concepts.
Last article we focus in how to VMware: How to create and use VMs TAGs – Part 1 so before follow this article and perform the next tasks, you should read the first article how to create the TAG before using them in Veeam Backup Jobs.
Teach the user how to edit .vmx files to add advanced configuration options Open vSphere Web Client: Edit Settings for a VM: Choose VM Options -> Advanced: Add Configuration Parameters:
This video shows you how easy it is to boot from ISO images for virtual machines with the ISO images stored on a local datastore on the ESXi host.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now