Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the pricing of t2.large similar to m4.large?

They all have 2vcpus and 8G ram. But with t2.large, you can only use 60% of a single vcpu, average 30% for each of the two vcpus. Even considering the "cpu credits", t2.large seems far weak than m4.large.

like image 918
Elect2 Avatar asked Dec 11 '16 10:12

Elect2


2 Answers

The main difference between a t2 instance and an m4 instance is the burstable nature of the t2 instance. (See T2 instance type documentation.)

While the machines are of similar specification, a t2.large instance that is bursting has approximately 60% higher performance than an m4.large instance. However, if the instance runs out of credit then it will be limited in performance.

For an explanation, see the T2: From Startups to Enterprise, Performance for a Low Cost presentation from AWS re:Invent 2016. The difference is explained at the 7m:30s point of the presentation:

T2 performance comparison

like image 65
John Rotenstein Avatar answered Oct 08 '22 01:10

John Rotenstein


I researched this myself and everywhere you look everyone is just talking about bursting.

But it's a fact that the hardware specs for e.g. t2.large and m4.large are either exactly or roughly the same. That means even if you burst on a t2 you will get the same performance as on m4.

But AWS, as in the video John Rotenstein linked, claims you still get 60% more performance on t2. This is due to a little difference in how AWS defines a vCPU.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html

Each vCPU is a thread of a CPU core, except for T2 instances.

So while on m4 a vCPU is a just a thread, on t2 you get a full core.

2 vCPUs on m4 is just 1 core with 2 threads and on t2 it is 2 full cores but without hyperhtreading.

You can see this when reading /proc/cpuinfo. I used this script to make it easier to read:

t2.large:

CPU model: Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz 1 CPU,
2 physical cores per CPU, total 2 logical CPU units

m4.large:

CPU model: Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz 1 CPU,
1 physical cores per CPU, total 2 logical CPU units

So depending on your application 2 hyperthreading threads on 1 core might result in the same performance as 2 cores, in other use cases the 2 cores perform up to 60% better.

So this little note, noone seems to mention or know about, in their documentation makes the difference. Hope this clears it up.

like image 37
sebastianreloaded Avatar answered Oct 08 '22 01:10

sebastianreloaded