21
votes

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)

1
if landing here to get more information about AWS Fargate for EKS, please vote on this ticket: github.com/aws/containers-roadmap/issues/649 (not sure if that will also improve ECS)unthought
@unthought +1 voting, I see some useful details were added to the ticket by developersesboych

1 Answers

13
votes

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