AWS EC2 Instance Comparison: T4g vs M6g
AWS has a lot of different instance types and it can be difficult to decide which instance type would be the best for a particular use-case. In this article, we will compare three popular instance types: T4g and M6g across various dimensions such as their specs, their performance as well theircost.
Comparing T4g and M6g instance families
Both the T4g and M6g instance families are powered by the new Arm-based AWS Graviton2 processes.
T4g Instances
Amazon’s T4 instance family is optimized for “burstable” workloads. These workloads generally have low CPU utilization and occasional periods for high CPU activity (called bursts). The T3 instance family is a good fit for this type of workload and can be pretty cost-effective.
M6g Instances
Amazon EC2 M6g Instances offer a balance of compute, memory and networking resources and thus they are ideal for a broad range of workloads.
Performance
We compared the performance between these instance families by running a bunch of tests on the following instances:
- t4g.2xlarge
- m6g.2xlarge
Instance Type | Number of cores | Memory (GB) |
---|---|---|
t4g.2xlarge | 8 | 32 |
m6g.2xlarge | 8 | 32 |
We will be using Sysbench to run various tests to measure the CPU, Memory and Disk performance.
CPU
We ran the CPU benchmark using the following command: sysbench cpu --cpu-max-prime=20000 --threads=8 run
.
We will be comparing the total time
as well as the total number of events
for the benchmark from start to end.
As we can see from the results below, performance for both instance types is comparable.
t4g.2xlarge
General statistics:
total time: 10.0009s
total number of events: 86212
m6g.2xlarge
General statistics:
total time: 10.0009s
total number of events: 86191
Memory
We ran the CPU benchmark using the following command: sysbench memory --memory-block-size=1M --memory-total-size=100G --num-threads=8 run
.
We will be comparing the Operations performed
for the different instance types.
In this benchmark, m6g.2xlarge
performed better than t4g.2xlarge
.
t4g.2xlarge
Total operations: 102400 (95927.34 per second)
102400.00 MiB transferred (95927.34 MiB/sec)
m6g.2xlarge
Total operations: 102400 (101209.29 per second)
102400.00 MiB transferred (101209.29 MiB/sec)
Disk performance
We also ran simple read & write benchmarks to test the performance of the EBS volumes on each of these instance types.
m6g.2xlarge
performed better than t4g.2xlarge
instances.
t4g.2xlarge
Write
dd bs=16k count=102400 oflag=direct if=/dev/zero of=test_data
102400+0 records in
102400+0 records out
1677721600 bytes (1.7 GB, 1.6 GiB) copied, 144.165 s, 11.6 MB/s
Read
dd bs=16K count=102400 iflag=direct if=test_data of=/dev/null
102400+0 records in
102400+0 records out
1677721600 bytes (1.7 GB, 1.6 GiB) copied, 48.4135 s, 34.7 MB/s
m6g.2xlarge
Write
dd bs=16k count=102400 oflag=direct if=/dev/zero of=test_data
102400+0 records in
102400+0 records out
1677721600 bytes (1.7 GB, 1.6 GiB) copied, 72.2482 s, 23.2 MB/s
Read
dd bs=16K count=102400 iflag=direct if=test_data of=/dev/null
102400+0 records in
102400+0 records out
1677721600 bytes (1.7 GB, 1.6 GiB) copied, 35.2356 s, 47.6 MB/s
Pricing
We compared the prices between these instance families by looking at the price per hour for each instance type.
T4g instances are 10%+ cheaper than the M6g instances on average.
Price/core for Linux on-demand instances:
Instance Type | Price / hour |
---|---|
t4g.2xlarge | $0.2688 |
m6g.2xlarge | $0.3080 |
Conclusion
The M6g instance performed slightly better than the T4g instance in our benchmark whereas the T4g instances are cheaper than the M6g instances.
Choosing between the two instances eventually comes down to your usecase. M6g is a good choice if you aren’t sure about the performance characteristics of your workload. M6g is optimized for a balanced workload (CPU, RAM and storage).
T4g is also aimed at general purpose workloads. However, the T4g instance family is ideal for applications that are CPU-intensive in short-busts. If your application is always CPU-intensive, then T4g instances are probably not a good choice. It is also crucial to understand how CPU credits work for EC2 instances to maximize the benefit of these instances.