Cloudability logo
451 Report: Cost Management in the Cloud Age
Optimization

Amazon EC2 Comparisons: M5 vs. C5

By Gavin Cahill on December 12, 2018
On the surface, choosing between M5 and C5 instances seems straight-forward. But what if your workload falls between high-compute and full-balanced? That’s where this post comes in.

What They’re Designed For

The M instance family is classified as a general-purpose instance family, while the C instance family is optimized for compute-intensive workloads. Compute-intensive means that the system tends to run at close to 100% CPU utilization. This is very different from other applications, which tend to have periods where the CPU runs as partial utilization — or isn’t used at all.

If you look at the M5 and C5 specs, you’ll see this workload distinction is reflected in the processors they use, the ratio of memory to vCPUs, bandwidth and, of course, the cost.

What Processors They Use

M5 instances use the Intel Xeon Platinum 8000 series (Skylake-SP) processor with a sustained all core Turbo CPU clock speed of up to 3.1 GHz. This processor supports the Intel Advanced Vector Extensions 512 (AVX-512) instruction set. The AVX-512 uses ultra-wide 512-bit vector registers and has other enhancements that accelerate computational operations.

C5 instances also use the Intel Xeon Platinum 8000 series (Skylake-SP) processor with AVX-512 support, but there are differences in clock speed. The C5 processor has a sustained all core Turbo CPU clock speed of up to 3.4GHz, and single core turbo up to 3.5 GHz using Intel Turbo Boost Technology. Intel Turbo Boost is a feature that automatically raises the processor’s operating frequency, and thus its performance, when demanding tasks are running.

How Much Memory They Have

In terms of the ratio of memory to vCPU, the M5 family has a 4:1 ratio and the C5 family has a 2:1 ratio. For example, the m5.large has 2 vCPUs and 8 GiB of memory. The c5.large has 2 vCPUs and 4 GiB of memory.

This is a tip off that the M5 family is better suited to applications that need more memory. For example, if an application is I/O bound and its frequently accessed data can be cached, then you may want to keep that information in main memory. In this case, an M5 instance is probably the better choice. If you have an application that’s compute bound rather than memory bound, go with the C5 family. Many compute-intensive applications don’t need a large memory footprint.

C5n and Network Bandwidth

At re:Invent 2018, AWS introduced C5n instances. Both M5 and C5 instances offered up to 25 Gbps of network bandwidth, but C5n instances can utilize up to 100 Gbps of network bandwidth. C5n instances offer significantly higher network performance across all instance sizes, ranging from 25 Gbps of peak bandwidth on smaller instance sizes to 100 Gbps of network bandwidth on the largest instance size. In addition, C5n instances also feature a 33% higher memory footprint compared to C5 instances. If you need the bandwidth, then there’s no contest: choose C5n over M5.

Similarities Between C5 & M5

M5 and C5 share a few key similarities where their traits overlap.

Instance storage

M5 and C5 instances use EBS and have the same EBS bandwidth. For example, for m5.large and the c5.large, the bandwidth is 3,500 Mbps. Both families peak at 14,000 Mbps for their largest instances. Remember that EBS costs are in addition to instance costs, and both families also have a “d” option which uses SSDs instead of EBS.

The Nitro system

Both M5 and C5 instances are built on the Nitro system, a hypervisor for Amazon EC2. It’s a collection of AWS-built hardware and software components that enable high performance, high availability, high security and bare metal capabilities to eliminate virtualization overhead.

Elastic MapReduce

You can use the Elastic MapReduce (EMR) service with either family. EMR incurs its own monthly bill, in addition to any EC2 instances that you use as part of the EMR job.

The Costs

When it comes to cost, C5 is cheaper, so if you’re running a compute-intensive application that isn’t constrained by memory requirements, take a good look at the C5 family. C5 instances feature the highest performing processors and the lowest price/compute performance. As an illustration, the current On-Demand price for an m5.large instance in the US West (Oregon) region is $0.09/hr, but only $0.085 for a similar c5.large.

Of course, if you’re using reserved instances the savings are even greater. Here’s a cost comparison for a standard 1-year term reserved instance.

m5.large

Payment option Upfront Monthly Effective Hourly Savings over On-Demand
No upfront $0.00 $44.53 $0.061 36%
Partial upfront $256.00 $21.17 $0.058 39%
All Upfront $501.00 $0.00 $0.057 40%

c5.large

Payment option Upfront Monthly Effective Hourly Savings over On-Demand
No upfront $0.00 $39.42 $0.054 36%
Partial upfront $223.00 $18.98 $0.051 39%
All Upfront $438.00 $0.00 $0.05 41%

C5 and M5 Comparison in Action

You’ve done your evaluations and allocated your workloads to M5 or C5 instances. Well done. But you need to make sure those are still the right decisions over time. Are these choices the best in terms of cost and efficiency?

One way to stay on top of costs is to use a cloud management platform such as Cloudability. Cloudability has a feature called Rightsizing, which constantly evaluates if you’re using the correct resources for the job. If it sees room for improvement, it makes recommendations that balance risk with savings. The first recommendation always has the least risk and the last recommendation has the most risk. Interestingly enough, the best choice for rightsizing might not always be what you think. To illustrate this, let’s look at this example of a workload currently running on a c4.8xlarge instance.

 

Currently, the instance costs $19.95 every 10 days, which can add up to quite a bit over thousands of instances.

Looking at the possibilities above, you can see how Rightsizing can help drastically reduce your spend — and how your options each have different risk values. At first glance, it seems to make sense to upgrade a C4 to the latest generation of C5, since it saves 42% and is pretty low risk. But let’s look at the actual performance numbers.

 

A c5.2xlarge can handle the CPU and network load easily, but may suffer from memory peaking.

The recommended C5 instance is the cheapest option that can handle the workload, but it doesn’t have the memory required. That means it’s at risk of peaking and causing performance issues. But what about the M5?

 

An m5a.2xlarge has similar compute ability, but more memory.

By using an M5a instead, the workload can run smoothly with no risk of memory peaking. The trade-off is that you’ll save 1% less. This where you need to compare the data to your infrastructure and needs. If your application regularly spins up 1,000 of these instances, then savings 41% will lower the 10-day cost from $19,950 to $11,771. Saving 42% will lower it to $11,571. Over a year, that comes to a difference of $7,300, which may be worth the risk if the only difference is slightly slower performance of internal systems.

——

Want to get the most out of your AWS EC2 spend? Cloudability is loaded with features like Rightsizing and Automation to cost-optimize your cloud. Sign up for a free trial today and see for yourself.

Being in the know feels great