Real-time docker container scaling

I have a few basic questions about scaling Docker containers:

I have 5 different applications. They are not related to each other. Before the containers, I ran 1 application on the VM and scaled them up and down individually in the cloud.

Now with containers I get isolation on top of the VM, so now I can potentially run one host with 5 docker containers, where each application is isolated in its own container.

As long as I have enough resources on my host, I can scale up and down these containers individually, as my traffic grows or decreases. for example I have 3 containers with application 1, but only 1 container works with application 2.

At peak times, application 3 receives a lot of traffic, and I need to start a second host that only runs containers for application 3.

My first question is: if the above makes sense, what am I saying, or if I misunderstood something. My second question is what technology is currently available so that all this can be done in an automatic way. I need a load balancer and an autoscale group that is capable of the scenario described above, without the need for manual intervention.

I looked at AWS ECS and am not quite sure if it can satisfy my needs, as I outlined above.

Does anyone know how to achieve this, or is there a better way to manage and scale my 5 applications that I am missing?

UPDATE:

Via Twitter I was tagged on Kubernetes and, in particular, on the documents Horizontal autoscanner .

May be useful for others. I will clarify this question when I learn more.

+5
source share
3 answers

There are several options, but none of them knows what everything does: you will need two things: auto-scan hosts according to signals, then auto-scale containers on hosts.

The following are solutions for deploying and scaling containers on hosts (not necessarily autoscaling):

Kubernetes is an orchestration tool that allows you to plan and (using an optional auto-scaler) auto-scale containers (groups of containers) in a cluster. This ensures that your containers will work somewhere if the host is down. The Google Container Engine (GKE) offers this as a service, but I'm not sure that they have the same features as auto-scaling the number of virtual machines in a cluster, as AWS does.

Mesos : somewhat similar to Kubernetes, but not intended to run containers.

Docker Swarm : A solution for deploying multiple Docker hosts, allows you to manage multiple hosts as if they were the only Docker host. I don’t believe that he has any “auto-scan” features, and I don’t believe that he cares to make sure that the containers always work somewhere: this is basically a docker for the cluster.

[EDIT] Docker supports restarting fault-tolerant containers with the option restart=always , as well as with Docker 1.11 Docker Swarm is a mode in Docker Daemon and supports redistributing containers when a node fails: it will restart containers to another node if node is no longer available.

Docker 1.11+ is a lot like Kubernetes in terms of functionality. It has some cool features (like TLS between hosts by default), but still lacks things like static IPs and storage

None of these solutions will auto-scale the number of hosts for you, but they can scale the number of containers on the hosts.

For autosave hosts, the solutions are specific to your cloud provider, so they are a dedicated solution. The key part for you is the integration of the two: AWS allows you to deploy Kubernetes on CoreOS; I don’t think they offer this as a service, so you need to deploy your own cluster of CoreOS and Kubernetes.

Now my personal opinion (and disclaimer)

I mainly used Kubernetes on GKE and bare-metal, as well as Swarm about 6 months ago, and I start infra using ~ 35 services on GKE:

Frankly, GKE with Kubernetes as a service offers most of what you want, but it's not AWS. Host scaling is still a bit more complicated and will require some work.

Setting up your own Kubernets or Meso on AWS or bare metal is very possible, but there is a pretty learning curve: it all depends on whether you really feel like on AWS and are ready to spend time.

Swarm is probably the easiest to work with, but more limited, but the built-in script can do the main job: use the AWS API to scale hosts and deploy Swarm. Guaranteed availability, but will require you to monitor and take care of re-launching containers if node fails.

Besides this, there are also hosting providers for containers that can do the job for you:

+4
source

I would look at Tutum (recently acquired by docker). It is associated with CI, and I believe that it has autoscaling capabilities.

https://www.tutum.co/

0
source

UPDATE: This is supported by AWS ECS with task placement restrictions .

  • Your ECS cluster has two autoscale groups (ASGs).
  • In the first ASG, set min , max and desired size to just 1.

    Mark this instance with the attribute ALLOW_ALL_APPS = TRUE . Do this in a custom data script.

  • In the second ASG, set min and desired to 0 and max 1 (I assume you only need 2 instances).

    Flag this instance with the custom attribute ALLOW_ALL_APPS = FALSE . Again in the user data script.

  • The scaling alarm for the second ASG will be determined by the load on the first ASG.

    If you know when the peak time for application 3 is, you can beat it with the planned zoom action.

  • Scaling for the second ASG is when its load drops so much that the first ASG can handle it on its own.

  • In the service definitions for applications 1, 2, 4, and 5, you will have placement restrictions that restrict their launch only to nodes where ALLOW_ALL_APPS = TRUE .

  • There are no placement restrictions in the service definition for application 3.

  • Automatic scaling of the service is configured for all applications based on container or application metrics.

0
source

Source: https://habr.com/ru/post/1239884/


All Articles