-
Notifications
You must be signed in to change notification settings - Fork 8
Auto Scaler
You have a workload that is spikey, and want to ensure that you can maximize throughput during heavy workloads. In my years of server side work, I have learned that it is isn't usually easy to maximize a servers resources. On Azure I find that the auto-scale feature (by processor usage) isn't that useful, as the servers aren't typically CPU bound; secondly, I never use the scale by queue length feature, as the servers are working off a number of varied workloads.
It makes perfect sense then to do micro-scaling based on needed throughput within a server. Dequeue at a rate of 10-60s; and maintain 1-10 instances. When there is no work your task would be checking the queue every 60s. When under load your server would be processing messages at a rate of 1 per second.
public class DynamicScaler : AutoScaler<Configuration>
{
public override IEnumerable<IScalable> ScaleUnit(Configuration data)
{
yield return new AdaptiveRunner(new ScalableTask(data));
}
}
Configuration allows you to pass in the data that service needs in order to run, I like to pass connection strings this way; however you can omit it if you want to.
Currently anything that extends DynamicTask can be auto-scaled. Or if you implement the IScalable interface.