Friday, March 09, 2012

Don't Forget the Pagefile!

Working on a project recently I had a bit of a rude reminder of the realities of sizing storage for VMs on vSphere.

I wrote a few days ago about using RAM to store Provisioning services cache. With that config we have an option to create VMs with very little storage...or so I thought.

Turns out there is some important storage you need to account for. In my case I wanted to create around 50 virtual machines each with 24GB of memory. Figured they'd be fully non persistent and keep the cache in ram. PVS needs a small disk on the VM to allow the SCSI driver to load so I figured 1GB would be plenty. With 1GB per VM, I thought that a 100GB datastore would would be a nice size and offer headroom for additional VM's down the road.

If you read the subject of this post you already know the punch line.  I forgot something important.

vSphere creates a page file equal to the size of memory for each vm which typically resides with the VM. And it does this when the VM is powered on.  As a result instead of needing 50GB of disk for my VMs, I needed 1250GB! A rude awakening since I'd thought I didn't need much storage! What's more this was disk that I really hoped never to use. What to do?

Well it turns out that using memory reservations can alleviate some of this.   If you reserve 100% of the VM's memory allocation then you get a 0KB vswp file.  But you've removed your ability to overcomitt memory.  We design for no overcommitment but it's good to have the ability to deal with 'bubble' situations where you need some extra capacity to deal with immediate needs (like HA events).   A middle ground here is reserving 50% of VM memory, and then you only end up with a swap file half the size of your RAM. ... in my case I still need 500+GB of disk I didn't plan for.

Also keep in mind that these files are created at VM power on, and deleted at power off;  So they have implications on your I/O behavior.

Moral of the story ... Don't forget the Page files when planning your disk space allocation!




No comments: