@vRobM and I were discussing an unrelated topic when DRS and the mysterious stars came up. (**)? Our first instinct was this was the “special sauce” between the two all beef patties. However after some creative KB searching we came across a formula that describes it quite well:
To understand the stars, you need to understand where to find them and what they mean. The following is taken from the VI3 docs:
Priority for this recommendation, as a number of stars. Five stars, the maximum, indicate a mandatory move because of a host entering maintenance mode or affinity rule violations. Other ratings denote how much the recommendation would improve the cluster’s performance; from four stars (significant improvement) to one star (slight).
So that explains what the stars indicate as far as recommendations go. But what makes a 3 star and what makes a 4 star recommendation?
Calculating the Priority
Turns out that this isn’t exactly the special sauce we thought it was. Rather, there is some carefully reasoned out math that goes into this. This KB article spells it out in detail, but we’ll hit the high points. First the formula:
6 – ceil(LoadImbalanceMetric / 0.1 * sqrt(NumberOfHostsInCluster)).
There are two variables in there and only one of which is obvious, “LoadImbalanceMetric” however can be interesting:
LoadImbalanceMetric is the current host load standard deviation shown on the cluster’s Summary page of the vSphere Client.
For each host, compute the load on the host as sum(expected VM loads)) / (capacity of host). Then compute the standard deviation of the host load metric across all hosts to determine LoadImbalanceMetric.
So where does one find this standard deviation? Select your cluster, then summary and look for the following section:
In our particular case, not much to look at, as well, she is seemingly a well balanced cluster. However let’s work through the formula with the assumption that we have a 2 node cluster and a standard deviation of 0.282 (the “target” from above):
6 – ceil(0.282 / 0.1 * sqrt(2)).
What is Ceilias brother Ceil doing with my numbers?
Turns out, it is not a family of mathematicians busily flicking their abacus’. ‘Ceil’ here, represents the Ceiling function, which I’m sure you’ve heard of before.
According to Wikipedia the Ceiling function is:
In mathematics and computer science, the floor and ceiling functions map a real number to the largest previous or the smallest following integer, respectively. More precisely, floor(x) = ⌊x⌋ is the largest integer not greater than x and ceiling(x) = ⌈x⌉ is the smallest integer not less than x.
6 – the smallest number not less than (0.282 / .1 * sqrt(2)) which equals 2, hence, a 2 star recommendation. (**)!
More info: Duncan Epping @ Yellow-Bricks has put together an excellent Deep-dive page for DRS, where you can get into much greater detail.
WolframAlpha to the Rescue
While this can easily be done in any random calculator (or in the heads of some folk) I used WolframAlpha to good avail. It’s quick and gives you a graphical breakdown of the formula. Just plug in new values and go!
The recommendations and mathematical bits take place behind the scenes seamlessly. After all, that is the magic of DRS. However, it helps to have an understanding of the actual logic and math that goes into those recommendations so you can better understand your cluster, and better plan for new hosts and workloads. As always drop a line in the comments or tweet to either @vRobM or myself on Twitter.
Update: Thanks for the excellent deep-dive page Duncan!
11 thoughts on “The Math Behind the DRS Stars”
Wrote a couple of words around that bit as well in my deepdive.
Excellent page. Not sure how I missed it the first time around. I've updated
my post to include a link. Thanks!
Excellent article and great research. In your calculations did you intend to use the
“target host load standard deviation” being 0.282, on purpose? From my understanding the definition of the LoadImbalanceMetric
is “current host load standard deviation” which from the image is 0? Or I am I missing something?
I want to work in DRS Algorithm for my thesis, I need the source code to simulate this algorithm in cloudsim.
if you have any idea about this ,please help me
first of all – applause.. tremendous one indeed.
May be I am too late, but I just am curious about –
1 – how to calculate a VM load &
2 – how to calculate a host’s capacity
Comments are closed.