What’s the Best Cost-Effective Option for Deploying a High-Traffic App – Fargate, ECS on EC2, or Plain EC2?

0
0
Asked By TechieNinja27 On

I'm working on a dating platform built with NestJS and PostgreSQL, and I'm gearing up for about 10,000 concurrent users, with plans for more as we grow. My app has several requirements, including multiple cron jobs, persistent WebSocket and SSE connections, and payment gateway integrations. I need high availability and the ability to scale based on incoming traffic, but I'm also very mindful of costs. I'm considering three deployment options: AWS Fargate, ECS on EC2, or basic EC2 instances. Given my app's mix of real-time connections and background jobs, which setup would provide the best mix of performance, scalability, and cost efficiency?

4 Answers

Answered By StartWithFargate On

I recommend starting with ECS Fargate so you can avoid managing EC2 instances and dealing with auto-scaling groups. Think of it this way: ALB -> ECS Service with auto-scaling -> Fargate Tasks -> RDS PostgreSQL. It's a less stressful start!

FellowDev01 -

Totally agree! Fargate is the simplest choice to kick things off without getting too bogged down with infrastructure.

Answered By CostConsciousCoder On

The most cost-effective solution is usually the one you manage yourself. Bare EC2 is the cheapest, followed by ECS on EC2, and then Fargate at the top. However, managing EC2 can be tricky for container orchestration. I personally go with Fargate for peace of mind, even if it costs a bit more. Just be aware that with Fargate, you can't choose your CPU family, and AWS might not use the most efficient options under the hood.

Answered By CloudGuru99 On

It seems your app is likely already containerized, which is great! If you're comfortable with EC2 and Auto-Scaling, you could run your service on EC2 instances. Just set up Auto-Scaling based on CPU and Memory usage, but you'll need the CloudWatch agent installed for accurate monitoring. If you aren’t super savvy with EC2, go with Fargate, as it simplifies scaling and management, although it might be a tad pricier. Make sure to put an Application Load Balancer (ALB) in front, maybe using sticky sessions. And don't forget to choose RDS for PostgreSQL!

NewbieDev22 -

I've hosted a Node.js + MySQL app on EC2 before, but that was just a learning project. For this one, I need to consider everything—cost, scalability, and performance. I'm planning to hire a DevOps engineer for this project, but I want to have a clear idea of the best route to take first.

Answered By DevOpsDude42 On

From my experience, here's the lowdown:
- Choose Fargate if you lack a dedicated DevOps team and want a developer-friendly setup. It's convenient, but costs do add up.
- Opt for EC2 if you need more control and don't mind the complexity. You'll manage everything from deployments to capacity planning, which can get tricky for keeping costs low.
- ECS on EC2 gives a balance of containerization and control. Auto-scaling can handle your load, but you'll deal with AMIs and patching yourself.
The guideline is that if your average CPU usage is low but you manage many connections, ECS on EC2 might be better. For stateless, bursty workloads, Fargate is ideal. Keep an eye on costs as your concurrency grows!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.