Rancher Host Autoscaling


First off all I would like to say that I’m really excited about Rancher :smiley: ! I think I’ll be using rancher for allot of my future projects! Currently I’m using Amazons Elastic Beanstalk for our startup. We’ve enabled autoscaling which works pretty well for us, but I find amazon to be expensive. I would like to try if I could replicate this using rancher in combination with Digital Ocean.

My goal is to:

  1. Automatically add hosts when the average CPU usage goes up
  2. Automatically remove hosts when the average CPU usage goes down

Today I started writing a GO app which should be able to do this, but maybe there is already some tool that does this. Does anyone know if someone already did this? If so, I’d be better of working on something else :stuck_out_tongue:

Also because I’m still pretty new to Rancher, I would like to have some opinions if this would actually work?

1 Like

This should be doable… Depending on how quickly you want to scale up/down there is some stats on the host resources in the Rancher API that have things like load average updated every few minutes. For higher resolution there’s a websocket you can open to get stats on each host every second.

The hard part is really deciding when to scale up or down. Once you’ve decided that you can use docker-machine (via /v1/machines) to scale up or delete host resources to scale down.

Thanks for your reply Vincent. So there is nothing yet out there which does this for Rancher? Is this something that would be on the rancher roadmap? I could see this work when this would be configureable in the rancher-composer.yml. Problem of course is that it would only work with cloud providers like DO. I’ll probably start by developing this as a stand-alone service.

Like you said I’m using the websocket stats for each host. As for deciding when to scale I’ll try to implement something like what Netflix wrote about in 2012:

It’s a shame Netflix didn’t release Scryer as open-source. I can’t imagine the millions they saved by implementing this predictive machine scaling algorithm.

We are also writing a machine scaling algorithm but based on the new containers to run. If there are not enough resources to launch the newly scheduled containers, new machines will be allocated. It will scale down as the work load goes down.

Hi there,
+1 for this feature request.
It would be great to be able to configure the amount or “scale” of containers and/or hosts based on the metrics that rancher is already monitoring.

I don’t believe a Github request has been made, so @boedy, @jloisel, @LRancez please feel free to open a request. :slight_smile:

Thanks for the response denise!
I leave the request here:

@boedy, @jloisel please, feel free to share your comments and ideas in that ticket.