How to speed up deployments on AWS Fargate?

后端 未结 3 1114
暖寄归人
暖寄归人 2021-02-13 07:03

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 m

3条回答
  •  难免孤独
    2021-02-13 07:38

    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.

提交回复
热议问题