Scaling applications
It’s a fairly common requirement for applications to be horizontally scalable these days. For lightweight microservice-based infrastructures it’s an assumption that this will be possible.
DC/OS handles this in a couple of different ways, with Marathon being responsible for handling the actual ramping up of capacity. The DC/OS tutorial provides an example python script ( https://dcos.io/docs/1.8/usage/ tutorials/autoscaling/cpu-memory) which monitors the amount of CPU and memory utilisation by a Marathon service. Based on presupplied metrics, this script will increase the number of app instances up to a ceiling when it calculates that the conditions have been met.
A bit more sophisticated is an advanced feature of Marathon-LB that scales up based on the number of requests an application is seeing over a defined time period. The autoscale script polls the HAProxy stats endpoint (on which Marathon-LB is based) and automatically scales app instances based on the incoming requests. This is done by dividing the number of requests being seen per second by the target number of requests per application instance. There are other possibilities as well,e.g. http://bit.ly/
MicroscalingQueue gives an example of ‘microscaling’ based on the number of requests in an Azure Storage Queue and where jobs deemed of higher importance are scaled ahead of less important background tasks. All of these examples can be seen on GitHub and so offer the possibility of developing bespoke options.