Allow webjobs to be limited to a specific number of instances when scaling out
It would be good to be able to limit the number of instances of a given webjob when an app service plan scales out.
My use case is a webjob reading from a queue that suddenly receives a glut of messages. As is, if the app is set to autoscale then the webjob quickly eats up CPU percentage, triggers a scale out then the new instance also grabs messages from the queue and triggers another scale out, etc.
I know we can make a given webjob a singleton. Using this option under the scenario described above, the app service plan will scale out but the webjob will only run on one instance.
This works great for situations where we are happy with how quickly the glut of queue messages are processed by a single instance. There are times however where we might want a better balance and want to be able to pay for more instances in order to be able to process queue messages more quickly in the event of a glut. Perhaps to have a webjob that can run on up to 3 instances, for example.
This would allow a modest scale out of the webjob when processing a glut but also also allow the app service plan to scale out further as necessary to keep the other apps in the plan working responsively.
See these Questions on SO and issues on GitHub:
This would be pretty nice to have. Especially when hosting many different kinds of webjobs in a single app service.