Why Fargate is Still Too Costly?
While Fargate is definitely costlier than EC2, its surprising how costly it is for the very small set problems it solves. Capacity Providers and Managed Node Groups solve a number of problems that fargate aims to solve for no extra cost.
But a proper cost analysis(TCO) requires calculating the operational costs and the underlying infrastructure costs. Since operational costs are highly subjective and differs between org to org, Below analysis primarily examines the infrastructure cost component of the TCO. To effectively assess infrastructure costs, it's important to understand the break even points for cost and efficiency i.e understanding at what efficiency level Fargate becomes cheaper than Capacity Provider / Managed Node Groups or vice versa.
Pricing Dimensions and Limits
Even though fargate pricing for vcpu and memory is independent, there are certain limits to what kind of vcpu and memory combinations are allowed.
The supported cpu to memory ratios are strictly between 1:2 to 1:8, i.e you can’t launch a fargate pod with 1 vcpu and 1GB memory, for 1 vcpu, you need to at-least pay for 2GB
No granular control over the resources i.e fargate has restrictions around the configurations that you could use i.e 0.25, 0.5, 1, 2, 4, 8 and 16 vcpu and the minimum cpu to memory ratio supported is 1:2 .
Memory can only be increased in the units of 1GB
Fargate Pricing
To build a mental model around fargate pricing, let’s compare it with EC2 instances that offer same amount of resources.
Below chart shows how much costly Fargate is when compared with EC2 in us-east-1 region. for example Fargate charges 16.9% more than EC2 for graviton 4vcpu and 8GB memory (c6g.xlarge)
As seen from above graph/table fargate costs almost 16-21% more than EC2 for the same amount of resources.
Considering Efficiency of ECS/EKS on EC2
One major thing to consider when evaluating ECS/EKS on EC2 is how efficiently you could run the cluster. For example, running a 3vCPU container on a 4vCPU EC2 instance leads to a 25% waste of resources. Larger instances or better sizing of containers can reduce waste, but it's quite challenging to balance and maintain due to fluctuating workloads.
Even after solving all those challenges, it is extremely hard to get cluster reservation of more than 90%, don’t believe me? check your ECS cluster reservation or EKS cpu/memory reservation metric once.
So considering this inefficiency, you could conclude that fargate is 6-11% costly than ECS/EKS on EC2.
but even at decent enough scale (> 3 instances attached to ECS/EKS), that 6-11% extra cost isn’t worth enough when you compare other offerings like ECS Capacity Provider, EKS Managed Node Groups that offer almost same features as Fargate.
Other Regions
The above graph only shows pricing comparison for us-east-1. it gets much much worse when you start to compare with other regions, some of the regions like ap-south-1 are almost 37% more costly than using EC2.
Break Even Point
as seen from above graph, 16-21% extra cost of fargate in us-east-1 provides a key insight to evaluate EC2 and Fargate. it essentially means that even if the 16-21% of the resources are wasted in ECS Capacity Provider / EKS Managed Node Group, it would still be cheaper to use EC2 than Fargate. And for a region like Mumbai(ap-south-1), the fargate pricing almost gets ridiculous when compared to its counter part i.e 37% more costly than EC2 for arm workloads.
So, When does it make sense to use fargate?
Very Low Cluster Reservation
Check your last 12 months cluster reservation, chances are that if in the last 12 months the cluster reservation is lower than the break even point, then the same can be said true for next 12 months. So in us-east-1, if your cluster reservation is below 80% consistently over the last 12 months, then it might be a good opportunity to evaluate fargate to save costs.
Low Scale
If your total cluster size is very small, like you have to run at-least 3 instances even during off-peak times then it might be a good time to evaluate fargate as it removes the dependency on the scaling granularity of underlying EC2 instances and saves costs.
Final Thoughts
Fargate is an exciting product for the container workloads, but I just wish that the pricing comes down a little further by 10-15% to make it a no-brainer for all container workloads. We need to remember that AWS internally is using same hosts for multiple tenants which means they could achieve much much better reservation on the hosts (> 90%). So it wouldn't make sense for fargate to be any more costly than 10%.
Are you looking to streamline and efficiently maintain your ECS & EKS costs throughout the year? Get started with Opti Owl today! In case you wish to directly block a time with us, please schedule a slot here :)