Auto Scaling groups used in conjunction with auto-scaling policies define when to scale out or scale in instances. These policies define actionable states based on a defined event and time frame (e.g., add instance when CPU utilization is greater than 90% for 5 consecutive minutes). In this session, Electronic Arts (EA) discusses a pro-active approach to scaling. You learn how to analyze past resource usage to help pre-emptively determine when to add or remove instances for a given launch configuration. Past data is retrieved via Amazon CloudWatch APIs, and the application of supervised machine learning models and time series smoothing is discussed.
6. varclient = newAmazon.CloudWatch.AmazonCloudWatchClient(); varresponse = client.GetMetricStatistics( newGetMetricStatisticsRequest{ Dimensions = newList<Dimension> { newDimension{ Name = "InstanceId", Value = instanceId} }, StartTime= startDate, //2014-11-05EndTime= endDate.Date.AddDays(1).Date.AddMilliseconds(-1), //2014-11-06, Namespace = "AWS/EC2", Statistics = newList<string>{ "Average", "Maximum", "Minimum","Sum","SampleCount"}, MetricName= metricName, //CPUUtilization, DiskReadBytes, NetworkIn, more etc.. Period = interval, //seconds –pass 60 * 60 for an hourly range}); //### CloudWatchGetMetricsStatisticsreturns unordered data points, ergo.. response.Datapoints.Sort((a,b) => a.Timestamp.CompareTo(b.Timestamp));
7.
8.
9.
10.
11.
12.
13. Y = a + b X
Time Actual(Y) Deviation X(from mid) XY X2 Yd
8am 83 -3 -249 9 72.22
9am 60 -2 -120 4 61.29
10am 54 -1 -54 1 50.36
11am 21 0 0 0 39.43
12p 22 1 22 1 28.50
1p 13 2 26 4 17.57
2p 23 3 69 9 6.64
N=7 Σ푌 = 276 ΣX=0 ΣXY=-306 ΣX2=28
Here: Y = a + b X
a = Σ푌/푁 = 276/7 = 39.43
b =
Σ푋푌
Σ푋2
= -306/28 = -10.93
Y = 39.43 – 10.93 X
For X = -3 (8am): Y8am = 39.43 – (10.93 * -3) = 72.22 and so on for other times.
ΣY = Na + b ΣX
ΣXY = a ΣX + b ΣX2
14. ΣY = Na + b ΣX + c ΣX2
ΣXY = a ΣX + b ΣX2 + c ΣX3
ΣX2Y = a ΣX2 + b ΣX3 + c ΣX4
Yd = a + b X + c X2
ΣY = Na + c ΣX2
ΣXY = b ΣX2
ΣX2Y = a ΣX2 + c ΣX4
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26. EWMA Article EWMA on Wikipediak-NN lecturek-NN on WikipediaMSESSE Machine Learning Coursesa722@nova.edu