Scripting a PVS Capacity on Demand Model with XenApp 6.5 Part 1

I’ve loved PVS as a XenApp solution for years now.  It really is the ideal way to provide XenApp at scale given the serious savings on hardware cost and maintenance.  In my ideal XenApp design you don’t even need disk because you can just cache entirely in RAM (thank god for 384GB blades!).  Because you don’t (or shouldn’t!) overprovision XenApp on the hosts, you have a very set amount of capacity which lends itself well to creating a capacity on demand model that allows you to dynamically manage the number of clients assigned to any vdisk.  And because of the XenApp 6.5 architecture and the capacity to use worker groups (essential in this design) adding and removing servers from a gold disk is a piece of cake.

This will be a multi-part post with a guest author tossed in for good measure.  Although I laid out clearly how I wanted to accomplish this I relied on the far superior scripting skills of a colleague to make it a reality.  So he’ll be along in the coming weeks to lay out that code and how he turned the somewhat abysmal PVS PoSH into something useful :).  Also I freely admit this is a poor man’s config.  I am sure once Workspace Manager comes out for instance this may not even be needed.  But in the meantime it kind of rocks.


PVS 6.1 or higher
XenApp 6.5
PoSH cmdlets for everything
Service Account with rights in AD to move machines between OUs and rights in PVS to perform all tasks related to gold disk assignment/unassignment/location management and rights in XenApp to query user load and in the hypervisor to spin up/spin down the machines
AD machine groups (1 per gold disk)
XenApp worker groups (1 per gold disk)
Folders in PVS (1 per gold disk) not required but strongly recommended!
A folder to contain your excess capacity PVS guests
A plan for how many users you want per image

The entire concept centers around the AD machine group and the Worker Group associated to that.  The idea is that you have virtual machines in an AD machine group.  That machine group is what the Worker Group in XenApp is based off of.  Apps and desktops are published to the worker group, and when a new machine is dropped in to the AD group it gets picked up by XenApp and added to the capacity.  Based on non-scientific observation that happened within minutes in our org.  Nice and easy right?

Well, here’s where we get to the on demand part.  Every gold disk in our environment has a max number of users associated depending on the app load particular to that silo.  Is it the most scientific method?  Nope.  But with RES doing CPU management and not redlining our servers in terms of users it worked fine for us.  Using the XenApp PoSH you can return how many users are currently on every server.  But you can also filter it out and determine how many users are on every server in a specific worker group.  Say we know that Image A maxes out at 20 users.  Every 15 minutes you can query that worker group’s servers and see that hey, those servers when averaged out are at about 85% of the max.  Since your SLAs say you won’t go over 80% capacity you need to add a new server or two.  Now the script heads over to PVS and grabs some guests from your capacity pool and assigns them that gold disk.  At the same time it moves the machine accounts over to the correct AD machine group so that when it comes up they are ready to deliver that capacity.

Now the work day is over and you are REALLY over provisioned on that gold disk.  Maybe you want to save some electricity, or maybe your night shift has a totally different workload.  So you spin them down and remove them from that gold disk and AD group and put them elsewhere until you need them again the next day.  In our environment we also set minimum capacity numbers so that we never had less than X amount of servers online.

So that’s the concept.  Simple, but I admit it’s a lot of scripting!  Next up we will actually look at the script and what it takes to make this hum.

, , ,

One Comment

Leave a Reply to Arthur Blakely

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">