How should i understand 70% value in this Azure Batch formula?

Copper Contributor

Hi everyone,

I'm trying to understand the following formula.


startingNumberOfVMs = 1;
maxNumberofVMs = 25;
pendingTaskSamplePercent = $PendingTasks.GetSamplePercent(180 * TimeInterval_Second);
pendingTaskSamples = pendingTaskSamplePercent < 70 ? startingNumberOfVMs : avg($PendingTasks.GetSample(180 * TimeInterval_Second));
$TargetDedicatedNodes=min(maxNumberofVMs, pendingTaskSamples);


We start with 1 node, then if pending task percentage < 70, it would automatically increase amount of node.

But how is 70% calculated? what slash what equal 70?

Someone can give an step by step example on how to scale from 1 to 25 node? 


1 Reply

@Khoi Thinh Azure batch service extracts samples of different kind of metrics about your pool every 30 seconds , when you specify $PendingTasks.GetSamplePercent(180 * TimeInterval_Second); what you are doing essentially is telling batch to calculate the number of samples it collected during 180 seconds , if you think about it, the right answer seems to be how many 30 seconds are there in 180 seconds ? 180/30 is 6 samples during 180 seconds, 6 here is 100% but because of how batch works the samples are sometimes delayed and not collected as expected , 70% represents the percentage of the actual collected samples which is equal to 4.

the collected samples using $PendingTasks.GetSample(180 * TimeInterval_Second) represents a vector of values (pending tasks) and the average number on that list will dictate the number of nodes you will end up using