How to speed up provisioning of ECS Fargate task


We are currently experiencing slow provisioning times (30-40 seconds) for an ECS task triggered by an endpoint.

This Fargate task performs complex database and S3 operations and is expected to handle a high volume of requests. We are seeking solutions to significantly reduce provisioning time while maintaining the use of Fargate.

Please assist with is blockage.

2 Answers

This document explains couple of ways to improve the speed :

profile picture
answered 3 months ago

It is normal for new AWS Fargate tasks to take 30-45 seconds or longer to start. That's because each Fargate task runs in its own isolated compute instance that is launched on demand to fit your task's declared size, and there are multiple steps that must take place to launch your task. These steps include launching the compute instance, allocating and attaching a network interface, downloading your task image from the registry, unpacking the image layers, starting the program, and possibly attaching it to a configured Load Balancer.

When using Fargate to process asynchronous jobs, the recommended architecture to minimize latency is to have a pool of work consumers (with a minimum pool size of 1) that consume from a work queue (such as an Amazon SQS queue), and that scales in and out smoothly according to demand. In such architectures, using queue depth as a target metric for scaling is a good choice.

If this design does not suit your needs, and each job or unit of work will take less than 15 minutes to process, and you need only 10 GiB or less of ephemeral storage, consider using AWS Lambda to perform your database and Amazon S3 operations instead.

answered 3 months 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.

Guidelines for Answering Questions