I'm running an API with two identical AWS Fargate tasks (8 vCPU / 16 GB RAM) within the same ECS cluster and region. I've load-balanced them using an Application Load Balancer (ALB) with round-robin routing. Both tasks use the same container image, task definition, VPC, subnets, and security groups. However, I'm noticing a significant performance difference: one task consistently responds in about 3 seconds while the other takes around 9 seconds. I've run this test multiple times, and the results are the same. It's not due to load, cold starts, or any differences in the application code. What could be causing this disparity in performance?
2 Answers
You're definitely not alone with this issue! One thing to keep in mind is that Fargate selects the CPU chip from available options, which could mean one of your tasks is running on older hardware. If you're really looking for consistent performance, ECS with EC2 launch type might be a better route for you.
Fargate doesn't guarantee consistent performance. I faced similar issues needing very precise processing times and ended up switching back to EC2 where I could choose my instance types. That gives you much better control over the hardware you're using.

Exactly! I was about to mention this too. It's crucial to understand the performance variability with Fargate.