DEV Community

Abhishek Ray
Abhishek Ray

Posted on • Originally published at learnaws.org

AWS EC2 Instance Comparison: M5 vs R5 vs C5

Originally published at https://www.learnaws.org.

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 of the most popular instance types (M5, R5 and C5) AWS offers across various dimensions such as their specs, their performance as well the cost.

Comparing M5, R5 and C5 instance families

M5 Instances

Amazon EC2 M5 Instances offer a balance of compute, memory and networking resources and thus they are ideal for a broad range of workloads.

m5-instance-specs

R5 Instances

Amazon EC2 R5 instances are memory-optimized instances. R5 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.

r5-instance-specs

C5 Instances

Amazon EC2 C5 instances are optimized for compute. C5 instances offer the lowest price per vCPU in the Amazon EC2 family and are ideal for running advanced compute-intensive workloads.

c5-instance-specs

Performance

We compared the performance between these instance families by running a bunch of tests on the following instances:

  • m5.xlarge
  • r5.xlarge
  • c5.xlarge
Instance Type Number of cores Memory (GB)
m5.xlarge 4 16
r5.xlarge 4 32
c5.xlarge 4 8

Processor performance

We used Geekbench to compare the performance of these instance types. Geekbench is a processor benchmarking program. It runs a series of tests on a processor and times how long the processor takes to complete the tasks. The faster the CPU, the higher the score.

All three instance types use the Intel Xeon Platinum 8000 series (Skylake-SP) processor. However, one key difference is the CPU clock speed. Both the M5 and R5 instances families have a core Turbo CPU clock speed of up to 3.1 GHz whereas the C5 instances have a clock speed of up to 3.4 GHz.

As expected, the c5 instances perform the best on the Geekbench tests.

Instance Type Single-core score Multi-core score
m5.xlarge 3905 8697
r5.xlarge 4112 9132
c5.xlarge 4215 9415

Memory performance

We used Stream benchmark to compare the memory performance across these instance types. Stream is used to measure the sustained memory bandwidth.

In this test, the r5 instances performed the best as expected. R5 instances are memory-optimized and have the most amount of memory as compared to M5 and C5. The M5 instances have more memory available than the C5 instances and have better memory performance than the C5 instances.

m5.xlarge

-------------------------------------------------------------

Function    Best Rate MB/s  Avg time     Min time     Max time

Copy:           27275.6     0.006025     0.005866     0.006193

Scale:          27054.6     0.006070     0.005914     0.006232

Add:            28308.0     0.008854     0.008478     0.009080

Triad:          28298.5     0.008879     0.008481     0.009268

-------------------------------------------------------------

Enter fullscreen mode Exit fullscreen mode
r5.xlarge

-------------------------------------------------------------

Function    Best Rate MB/s  Avg time     Min time     Max time

Copy:           28324.3     0.005796     0.005649     0.005914

Scale:          27793.0     0.005834     0.005757     0.005905

Add:            28616.2     0.008505     0.008387     0.008691

Triad:          28704.4     0.008515     0.008361     0.008679

-------------------------------------------------------------

Enter fullscreen mode Exit fullscreen mode
c5.xlarge
-------------------------------------------------------------

Function    Best Rate MB/s  Avg time     Min time     Max time

Copy:           26445.8     0.006110     0.006050     0.006173

Scale:          26306.9     0.006143     0.006082     0.006235

Add:            27072.4     0.008962     0.008865     0.009093

Triad:          27002.7     0.008980     0.008888     0.009053

-------------------------------------------------------------

Enter fullscreen mode Exit fullscreen mode

Disk performance

We also ran simple read & write benchmarks to test the performance of the EBS volumes on each of these instance types.

The R5 instances performed the best on the disk performance benchmarks.

m5.xlarge

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, 77.5204 s, 21.6 MB/s
Enter fullscreen mode Exit fullscreen mode

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, 57.9766 s, 28.9 MB/s
Enter fullscreen mode Exit fullscreen mode
r5.xlarge

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, 58.0189 s, 28.9 MB/s
Enter fullscreen mode Exit fullscreen mode

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, 40.6274 s, 41.3 MB/s

Enter fullscreen mode Exit fullscreen mode
c5.xlarge

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, 63.4356 s, 26.4 MB/s
Enter fullscreen mode Exit fullscreen mode

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, 46.5171 s, 36.1 MB/s

Enter fullscreen mode Exit fullscreen mode

Pricing

We compared the prices between these instance families by looking at the price per hour for each instance type.

C5 instances are the cheapest amongst the three instance families whereas the R5 instances are the most expensive. R5 instances are almost 50% more expensive than C5 instances.

Price/core for Linux on-demand instances:

Instance Type Price / hour
m5.xlarge $0.192
r5.xlarge $0.252
c5.xlarge $0.170

Conclusion

The new C5 instances offer the best processor performance as well as price and should be the go-to instance type for most use-cases.

If the use-case requires a lot of memory, then the choice becomes either between M5 and R5. Critical applications such as in-memory databases and caches should use the R5 instances since they are optimized for such use-cases.

Applications such as batch processing systems are probably better suited for M5 instances since they need the additional memory but are not as performance-critical.


Top comments (0)