AWS EC2 Instance Comparison: I3 vs M6g vs R6g
AWS has a lot of different instance types and it can be difficult to decide which instance type would be the best for your application. In this article, we will compare three instance types, I3, R6g and M6g offers across various dimensions such as their specs, performance and cost.
Comparing I3, M6g and R6g instance families
I3 Instances
Amazon EC2 I3 instances are optimized for storage I/O. I3 instances offer the best price per I/O performance for workloads such as NoSQL databases, in-memory databases, data warehousing, Elasticsearch, and analytics workloads.
M6g Instances
Amazon EC2 M6g Instances use AWS’ new Graviton2 processors and offer a balance of compute, memory and networking resources and thus they are ideal for a broad range of workloads.
R6g Instances
Amazon EC2 R6g instances also use AWS’ new Graviton2 processors and they are memory-optimized instances. R6g instances are well suited for memory-intensive applications such as high-performance databases, distributed web scale in-memory caches, mid-size in-memory databases, real-time big data analytics, and other enterprise applications.
Performance
We compared the performance between these instance families by running a bunch of tests on the following instances:
- i3.2xlarge
- m6g.2xlarge
- r6g.2xlarge
Instance Type | Number of cores | Memory (GB) |
---|---|---|
i3.2xlarge | 8 | 61 |
m6g.2xlarge | 8 | 32 |
r6g.2xlarge | 8 | 64 |
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, m6g.2xlarge
was marginally better on this benchmark.
i3.2xlarge
General statistics:
total time: 10.0030s
total number of events: 21554
m6g.2xlarge
General statistics:
total time: 10.0008s
total number of events: 86274
r6g.xlarge
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, r6g.2xlarge
performed the best.
i3.2xlarge
Total operations: 102400 (46179.54 per second)
102400.00 MiB transferred (46179.54 MiB/sec)
m6g.2xlarge
Total operations: 102400 (101209.29 per second)
102400.00 MiB transferred (101209.29 MiB/sec)
r6g.2xlarge
Total operations: 102400 (101260.04 per second)
102400.00 MiB transferred (101260.04 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.
I3 instances include Non-Volatile Memory Express (NVMe) SSD-based storage which is significantly faster than SSD storage. i3.2xlarge
performed significantly better in this particular benchmark.
i3.2xlarge
Write
sudo dd bs=16k count=102400 oflag=direct if=/dev/zero of=/data/test_data
102400+0 records in
102400+0 records out
1677721600 bytes (1.7 GB, 1.6 GiB) copied, 7.3984 s, 227 MB/s
Read
dd bs=16K count=102400 iflag=direct if=/data/test_data of=/dev/null
102400+0 records in
102400+0 records out
1677721600 bytes (1.7 GB, 1.6 GiB) copied, 6.34042 s, 265 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
r6g.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, 68.3376 s, 24.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, 45.2198 s, 37.1 MB/s
Pricing
We compared the prices between these instance families by looking at the price per hour for each instance type.
M6g instances are the cheapest amongst the three instance families whereas the I3 instances are the most expensive.
Price/core for Linux on-demand instances:
Instance Type | Price / hour |
---|---|
i3.2xlarge | $0.6240 |
m6g.2xlarge | $0.3080 |
r6g.2xlarge | $0.4032 |
Conclusion
Choosing between the two instances eventually comes down to your use-case.
- If your application is memory-intensive, then the R6g instances will be a good fit.
- If your application is disk I/O intensive, then the I3 instances are a good fit.
- 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).