Skip to content

Container Cloning or Pooling to optimize the container startup time.

0

I am maintaining a single task definition in which each revision has a different container with a different base image. Now every time the container takes around 20-30 seconds to start and come to the Running state. But I want some idea on how can I decrease it, is there any way I can have a container started before hand, and every time we want to have a new container it makes a copy of the running container, so similarly we can multiple isolated copies of it. Or can we have something like container pooling, that once we initiate a service it creates n numbers of containers and initiates it. and whenever the user wants a container with that specific container one of the available containers is assigned to it. What can be the most efficient and scalable solution to this issue?

2 Answers
0

One solution is to preload the container image in the AMI itself, which can significantly reduce the startup delay . When the image is present in the instance, ECS agent only needs to compare checksums with the ECS repository, starts in less than a second for image download . For tasks running frequent jobs, you can implement a persistent container that runs continuously rather than creating new containers each time. This can be achieved by using a task scheduler like node-cron within the main application code, allowing the same container instance to be reused for multiple job executions

answered 2 years ago

-1

Hi,

You may be interested in "Reducing AWS Fargate Startup Times with zstd Compressed Container Images": see https://aws.amazon.com/blogs/containers/reducing-aws-fargate-startup-times-with-zstd-compressed-container-images/

Also the re:Invent presentation "Reducing AWS Fargate startup times by lazy loading container images" proposes different paths to explore to reduce startup time: https://d1.awsstatic.com/events/Summits/reinvent2023/CON307_Reducing-AWS-Fargate-startup-times-by-lazy-loading-container-images.pdf

Best,

Didier

EXPERT

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.