Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.6k views
in Technique[技术] by (71.8m points)

amazon ec2 - Cost Savings of ECS/EKS over Straight EC2

I've read plenty of blogs that talk about 25-50% cost savings of moving a micro services fleet from straight EC2 VMs to containers on either ECS or EKS. While that's compelling, I'm scratching my head on how that might be, given the cost estimations using some simple models with the AWS Pricing Calculator. I'm sure I'm oversimplifying the problem here with my estimations below, but the scale of price difference is nearly a factor of five ($68 vs. $319), which begs the question, where are the cost savings?

For instance, assume a small cluster of eight services that work well on a [small t4g][2]:

| Instance   | EC2 Type  | vCPU | Mem (GB) | Storage (GB) | Monthly Cost |
| ---------- | --------- | ---- | -------- | ------------ | ------------:|
| Service 1  | t4g.small | 2    | 2        | 8            | USD 8.47     |
| Service 2  | t4g.small | 2    | 2        | 8            | USD 8.47     |
| Service 3  | t4g.small | 2    | 2        | 8            | USD 8.47     |
| Service 4  | t4g.small | 2    | 2        | 8            | USD 8.47     |
| Service 5  | t4g.small | 2    | 2        | 8            | USD 8.47     |
| Service 6  | t4g.small | 2    | 2        | 8            | USD 8.47     |
| Service 7  | t4g.small | 2    | 2        | 8            | USD 8.47     |
| Service 8  | t4g.small | 2    | 2        | 8            | USD 8.47     |
| **Totals** |           | 16   | 16       | 64           | USD 67.76    |

If I were to move to ECS/EKS and purchase some larger c5's with equivalent vCPU, this is what I'm guessing I'd need to accomplish the same thing:

| Instance   | EC2 Type   | vCPU | Mem (GB) | Storage (GB) | Monthly Cost |
| ---------- | ---------- | ---- | -------- | ------------ | ------------:|
| Service 1  | c5.2xlarge | 8    | 16       | 32           | USD 159.42   |
| Service 2  |            |      |          |              |              |
| Service 3  |            |      |          |              |              |
| Service 4  |            |      |          |              |              |
| Service 5  | c5.2xlarge | 8    | 16       | 32           | USD 159.42   |
| Service 6  |            |      |          |              |              |
| Service 7  |            |      |          |              |              |
| Service 8  |            |      |          |              |              |
| **Totals** |            | 16   | [32][1]  | 64           | USD 318.84   |

As I mentioned, I'm sure this is a naive comparison, but I figured I'd end up in the same ballpark and not be off by a factor of 5. I understand that ECS/EKS will give me better resource utilization, but it would need to increase efficiency 470% just to break even, which seems unreasonable.

[1]: While the c5's have twice the memory, given the 1:10 ratio of mem:vCPU, I don't believe this is contributing significantly to the delta.

[2]: Assuming 1 Year Reservation, EC2 Instance Savings Plan, No Upfront


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The comparison are not valid because they are different products, so like Vikrant said it is comparing Apples to Oranges.

t4g is a burstable CPU instance

  • Suitable for websites with spike traffic
  • relatively small number of users (spike in numbers of visitors)

Before t4g came out, there are t3a, t3, t2, t1... each newer generation offer better performance at lower price. It is also based on graviton processors, not the Intel Xeon C5 is using. Additionally you are also factoring in reserved instance.

When CPU credits runs out for t4g instance...

T instances are so affordable because once the CPU credits run out, the CPU will be slowed down to a crawl. (for example 10% in micro instances)

C5 is for high and constant CPU load

  • Firstly the pricing is not as competitive with new products released few months ago.
  • Also it does not offer burstable CPU performance
  • C5 provide high constant raw CPU power
  • Focus on CPU and relatively less RAM
  • C5 offers better network bandwidth

C5 is suitable for applications with constantly heavy CPU load. Web server is usually not demanding for the CPU, and the workload spikes when traffic pattern changes.

Unless for websites with very fast response time requirement that involves CPU heavy calculations, T family instances are more suitable for web servers.

Of course, if the website is serving large amount of people from multiple timezones, then the workload will be high and more stable. In this situation C5 may be a better choice.

You can run the CPU at 100% all the time if you need, there is nothing about CPU credit and it will not slow down. It provide constant and high CPU performance you can use all the time.

Using C5 with T4g

A tactical setup for a high visitors web server is to use C5 to provide a very solid baseline performance, and use T instance to handle extra traffic during busy hours. For example a food ordering platform can use C5 to handle baseline customer orders, and have T instance to take care of peak hours around lunch and dinner.

This way, when traffic drops, the T instance will slowly gain CPU credits. Also you will not have to worry the servers becoming very slow (10% speed) if the CPU runs out because you have a very fast C5 instance to back it up even if all T instances are slowing down.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...