How to speed up deployments on AWS Fargate?

孤者浪人 提交于 2019-12-07 02:53:19

问题


After migrating from EC2 cluster instances to AWS Fargate, I realized that deployments take a lot longer. Before they would take 1-2 minutes, now some deplyoments take up to 5 minutes. This post claims that their deployments on Fargate even take up to 10 minutes.

Does anybody know of a way to speed them up? I can't find any documentation on this topic.


回答1:


Through further googling I found this Reddit thread. An AWS employee wrote:

With regard to time to provision and start a container it is definitely longer when using Fargate. We may reduce the length of the provisioning state in the future, but Fargate is doing much more under the hood than ECS on your own self managed hosts. When you self manage hosts they are already up and running, and may even already have your docker image downloaded and cached locally, so ECS is able to launch the container very quickly. That's not the case with Fargate.

So shrinking the image should help a little. But in general I guess I'll have to live with it and hope for optimizations on AWS' side.




回答2:


Two reasons they're slower, in my experience:

  1. awsvpc network mode attaches an ENI to the task. When it has to do this to a Lambda, if the Lambda is running in a VPC, it is known to dramatically increase the initial spin up time.

  2. Docker image size also affects startup time, since the image will usually need to be downloaded to whatever hidden host for a task to launch. I've done some benchmarking with a small 200MB container and a 2.5GB container. The former did start up quicker.

You can't do much about awsvpc, since Fargate requires it. Shrinking down that image would be your next biggest impact.



来源:https://stackoverflow.com/questions/51618252/how-to-speed-up-deployments-on-aws-fargate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!