Amazon’s compute-intensive C5 instance family has multiple instance types which can make it difficult to choose the right instance type for your use-case.

In this post, we will look at the differences between the C5, C5d and C5n instance types.

C5 instance family

Amazon added the C5d instance type at the beginning of 2018. These instances are equipped with local NVMe storage which improves disk performance greatly. Any application which relies on disk I/O performance would benefit from this instance type.

The C5n instance type was announced during latter part of 2018. The C5n instance type builds upon the C5d instance type and includes a lot of performance improvements especially increased network bandwidth.

Let’s take a closer look at the differences between these instance types.

Specs

The specs for these instance types are listed below:

Instance Type Memory vCPUs Network Performance Instance Store
c5d.large 4 GIB 2 vCPUs Up to 10 Gbps 1 x 50 NVMe SSD
c5d.xlarge 8 GIB 4 vCPUs Up to 10 Gbps 1 x 100 NVMe SSD
c5d.2xlarge 16 GIB 8 vCPUs Up to 10 Gbps 1 x 200 NVMe SSD
c5d.4xlarge 32 GIB 16 vCPUs Up to 10 Gbps 1 x 400 NVMe SSD
c5d.9xlarge 72 GIB 36 vCPUs 10 Gigabit 1 x 900 NVMe SSD
c5d.18xlarge 144 GIB 72 vCPUs 25 Gigabit 2 x 900 NVMe SSD
Instance Type Memory vCPUs Network Performance
c5n.large 4 GIB 2 vCPUs Up to 25 Gbps
c5n.xlarge 8 GIB 4 vCPUs Up to 25 Gbps
c5n.2xlarge 16 GIB 8 vCPUs Up to 25 Gbps
c5n.4xlarge 32 GIB 16 vCPUs Up to 25 Gbps
c5n.9xlarge 72 GIB 36 vCPUs 50 Gigabit
c5n.18xlarge 144 GIB 72 vCPUs 100 Gigabit

CPU Performance

We used Geekbench to compare the CPU performance of the two instance families. 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.

C5n instances are (slightly) faster than the C5d instances.

Instance Type c5d score c5n score Improvement
xlarge 4166 4471 7%

Network Performance

We used iperf to compare the network performance of the two instance families. iperf measures maximum achievable bandwidth.

As expected, C5n instances have a much higher network bandwidth available to them.

C5d (c5d.xlarge)
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-60.0 sec  7.75 GBytes  1.11 Gbits/sec
[  7]  0.0-60.0 sec  7.75 GBytes  1.11 Gbits/sec
[  6]  0.0-60.0 sec  23.6 GBytes  3.39 Gbits/sec
[ 14]  0.0-60.0 sec  3.63 GBytes   519 Mbits/sec
[  5]  0.0-60.0 sec  3.72 GBytes   532 Mbits/sec
[  9]  0.0-60.0 sec  4.84 GBytes   693 Mbits/sec
[ 10]  0.0-60.0 sec  4.67 GBytes   668 Mbits/sec
[ 11]  0.0-60.0 sec  3.88 GBytes   555 Mbits/sec
[  8]  0.0-60.0 sec  2.52 GBytes   361 Mbits/sec
[ 13]  0.0-60.0 sec  7.75 GBytes  1.11 Gbits/sec
[SUM]  0.0-60.0 sec  70.1 GBytes  10.0 Gbits/sec

C5n (c5n.xlarge)
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-60.0 sec  11.4 GBytes  1.63 Gbits/sec
[  9]  0.0-60.0 sec  11.4 GBytes  1.63 Gbits/sec
[  7]  0.0-60.0 sec  11.4 GBytes  1.63 Gbits/sec
[ 11]  0.0-60.0 sec  22.4 GBytes  3.21 Gbits/sec
[ 13]  0.0-60.0 sec  21.8 GBytes  3.12 Gbits/sec
[  5]  0.0-60.0 sec  21.8 GBytes  3.11 Gbits/sec
[  6]  0.0-60.0 sec  22.3 GBytes  3.20 Gbits/sec
[  8]  0.0-60.0 sec  21.8 GBytes  3.13 Gbits/sec
[ 10]  0.0-60.0 sec  11.4 GBytes  1.63 Gbits/sec
[ 15]  0.0-60.0 sec  21.8 GBytes  3.12 Gbits/sec
[SUM]  0.0-60.0 sec   178 GBytes  25.4 Gbits/sec

Disk I/O Performance

We ran the following tests to measure the Disk I/O performance of the two instance types:

  • dd: Comparing write performance
  • hdparm: Test reading and caching performance

We did not see any noticeable difference in the disk I/O performance between the two instance types.

C5d (c5d.xlarge)
dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 7.88091 s, 136 MB/s

dd if=/dev/zero of=/tmp/test2.img bs=512 count=1000 oflag=dsync
1000+0 records in
1000+0 records out
512000 bytes (512 kB) copied, 1.34207 s, 382 kB/s
sudo hdparm -Tt /dev/nvme0n1

/dev/nvme0n1:
 Timing cached reads:   18662 MB in  1.99 seconds = 9367.78 MB/sec
 Timing buffered disk reads: 514 MB in  3.01 seconds = 170.61 MB/sec
C5n (c5n.xlarge)
dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync

1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 7.74249 s, 139 MB/s
[ec2-user@ip-172-31-40-114 ~]$
[ec2-user@ip-172-31-40-114 ~]$ dd if=/dev/zero of=/tmp/test2.img bs=512 count=1000 oflag=dsync

1000+0 records in
1000+0 records out
512000 bytes (512 kB) copied, 1.43256 s, 357 kB/s
sudo hdparm -Tt /dev/nvme0n1

/dev/nvme0n1:
 Timing cached reads:   16862 MB in  1.99 seconds = 8460.83 MB/sec
 Timing buffered disk reads: 514 MB in  3.01 seconds = 170.48 MB/sec

Pricing

C5n instances are approximately 8-12% more expensive than C5d instances.

Instance Type c5d c5n
xlarge $0.192 $0.216

Conclusion

Overall, the C5n instances offer better performance (compute + network) than C5d instances. However, they are also more expensive than C5d instances. The choice for which instance type should depend on what the use-case is. If you need the extra network bandwidth, then it makes sense to go with the C5n instances otherwise the C5d or C5 instances might be a better choice.