## Question

H.H.LilanMadusanka on Thu, 02 Feb 2017 10:57:23

I want to auto scale batch pool nodes. if CPU increase more than 75% and wait more than 5 minutes then pool size should increase.

If CPU decrees less than 25% and wait more than 20 minutes then pool size should decrees.

but minimum size of pool should be 10 and maximum size should be 100

Any one can help me to write formula for auto scaling ?

## Replies

Li Li (MSFT) on Fri, 10 Feb 2017 22:05:37

Hello,

I've attached a sample formula which could be close to what you are looking for:

CPUSampe10Mins=\$CPUPercent.GetSamplePercent(TimeInterval_Minute*10);
\$CPUIncrease=CPUSampe10Mins<70? 1:avg(\$CPUPercent.GetSample(TimeInterval_Minute*5))/avg(\$CPUPercent.GetSample(TimeInterval_Minute*5, TimeInterval_Minute*10));
CPUSampe40Mins=\$CPUPercent.GetSamplePercent(TimeInterval_Minute*40);
\$CPUDecrease=CPUSampe40Mins<70? 1:avg(\$CPUPercent.GetSample(TimeInterval_Minute*20))/avg(\$CPUPercent.GetSample(TimeInterval_Minute*20, TimeInterval_Minute*40));
\$TargetDedicated=\$CPUIncrease>1.75? \$CurrentDedicated+1:\$CurrentDedicated;
\$TargetDedicated=\$CPUDecrease<0.75? \$CurrentDedicated-1:\$CurrentDedicated;
\$TargetDedicated=max(\$TargetDedicated,10);
\$TargetDedicated=min(\$TargetDedicated,100);

where

\$CPUIncrease denotes the ratio of the average CPU percentage of recent 5 mins to the average from last 5mins to last 10mins

\$CPUDecreasedenotes the ratio of the average CPU percentage of recent 20 mins to the average from last 20 mins to last 40mins

I am not sure this is exact what you are looking for. Please let me know if there any thing I can assistant.

Thanks,

Li

Latest posts in the category

sql server masterdata