Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Fargate startup time

Tags:

Currently I'm researching on how our dockerised microservices could be orchestrated on AWS. The Fargate option of ECS looks promising eliminating the need of managing EC2 instances.

Although it's a surprisingly long time needed to start a "task" in Fargate, even for a simple one-container setup. A 60 seconds to 90 seconds are typical for our Docker app images. And I heard it may take even more time like minutes or so.

So the question is: while Docker containers typically may start in say seconds what is exactly a reason for such an overhead in Fargate case?

P.S. The search on related questions returns such options:

  1. Docker image load/extract time
  2. Load Balancer influence - registering, healthchecks grace period etc

But even in simplest possible config with no Load Balancer deployed and assuming the Docker image is not cached in ECS, it is still at least ~2 times slower to start task with single Docker image in Fargate (~ 60 sec) than launch the same Docker image on bare EC2 instance (25 sec)

like image 752
esboych Avatar asked Aug 07 '19 13:08

esboych


People also ask

How quickly does fargate scale?

When using the Amazon ECS service scheduler for running web and other long-running applications, you will be able to launch up to 500 tasks in under a minute per service, 16X faster than last year. Previously you would have waited for nearly 15 minutes to scale an application to 500 tasks at steady state.

Does fargate run all the time?

If you do so when using Fargate, your tasks will become persistent, which means your containers will run even in case they don't receive any requests. Now, considering your containers are continuously running, Fargate won't cause any additional warmup time.

How long does it take for ECS task to start?

Because Amazon ECS uses the load balancer healthcheck as part of determining container health, this means that by default it takes a minimum of 2 minutes and 30 seconds before ECS considers a freshly launched container to be healthy.


1 Answers

Yes takes a little longer but we can't generalize the startup time for fargate. You can reduce this time tweaking some settings.

vCPU is directly impacting the start up time, So you have to keep in mind that in bare EC2 instance you have complete vCPU at your disposal , while in cases of fargate you may be assigning portion of it.

Since AWS manages servers for you they have to do few underline things. Assigning the VM into your VPC to docker images download/extract, assigning IPs and running the container can take this much time.

It's a nice blog and at the end of following article you can find good practices.

Analyzing AWS Fargate

like image 100
Imran Arshad Avatar answered Oct 10 '22 06:10

Imran Arshad