We’ve spoken about Resource Pools a couple of times over the last months and specifically about shares. (The Resource Pool Priority-Pie Paradox, Resource Pools and Shares.) The common question I received was how can we solve this. The solution is simple: Custom Shares.
However, the operational overhead associated with custom shares is something most people want to avoid. Luckily for those who have the requirement to use share based resource pools one my colleague Andrew Mitchell shared a powershell script. This powershell script defines custom shares based on a pre-defined weight and the amount of VMs / vCPUs in the resource pool. I would recommend to schedule the script to run on a weekly basis and ensure the correct amount of shares have been set to avoid running into one of the scenarios described in the articles above.
Please keep in mind that if you use nested resource pools you will need to run a separate script for each level in the hierarchy.
Eg. If the resource pools are setup like this the following you will need one script to set the shares for RP1, RP2 and RP3, and another script to set the shares for RP1-Child1 and RP1-Child2.
RP1
>>RP1-Child1
>>RP1-Child2
RP2
RP3
Download the script here. Again to emphasize it I am not the author, we would appreciate it though if you could share any modifications / enhancements to this script.
Andrew Mitchell says
Thanks for putting this up Duncan. Although I’ve tested it thoroughly, if anyone tries this script and finds a problem with it please let me know via twitter (@amitchell01)
Horst Mundt says
Thanks Andrew and Duncan, comes very handy. Just went through the exercise of adjusting RP shares with some customers. Not really looking forward to doing it manually again.
May I suggest an adjustment?
The script sets an upper limit of 8000 for the shares that are granted to the highest priority resource pool. Now if somebody creates a new resource pool with default settings, that resource pool will get 4000 shares. So until the script runs again, there will be a (probably not desired) imbalance.
That’s why I suggested to my customers to give their really important resource pools a higher share value (say 80.000 instead of 8.000). Just to make sure that their resource planning is not overly sensitive to “default values”.
Doug Youd says
Thanks for this, was just thinking of writing something myself…. but beaten to it.
Nice and clean, except one type-oh.
$MinPoolCPUshares = 100
$MinPoolMemShare = 100
Should be:
$MinPoolCPUshares = 100
$MinPoolMemShares = 100
Was wondering why my that wasn’t applying properly, logic looked sound…. simple things are so easy to miss.
🙂
Doug Youd says
Hi Duncan / Andrew,
It’s a bit late… but I made some modifications to suit my environment that I thought might be helpful to others.
My modified version is available Here
Hopefully it’s of some help to others.
-Doug
Manish Patel says
Hi Doug,
Pl check the location of your modified script as its not working. I can highlight “Here” but not actually linked to anything.
Loren Gordon says
I modified this script (with Doug’s edits) so it would set custom shares on child resource pools and vApps. Let me know if you’re interested and I’ll send it to you (loren)@(fleet-it.com).