Fotolia

Tip

M EC2 instance family offers versatile compute, at a price

General-purpose EC2 instances, like the M and T series, fit many types of applications. But before you rush to use them, know your workloads and how much capacity they need.

Amazon Elastic Compute Cloud is AWS' most popular cloud service, and it provides compute capacity for an enormous number of workloads.

AWS users can choose between a variety of Elastic Compute Cloud (EC2) instance types -- totaling roughly 100 options in all. Despite these many options, 46% of EC2 usage is with the M family of instances, according to the Botmetric Public Cloud Usage Report for 2017. Given the breadth of available choices, that's hardly a random result, and experts agree this general-purpose EC2 instance family fits a variety of needs.

"EC2 is M-centric because it's the [best] class for production use cases," said Mark Wilcox, vice president of business development at ICSynergy, a provider of identity and authentication services based in Plano, Texas. "Whether you need consistent CPU or more memory or faster network, M is where it's at."

Bill Supernor, CTO of ParkMyCloud, a provider of cloud cost management tools in Sterling, Va., agreed the M series in the EC2 instance family offers a good balance of CPU, RAM and disk size, and it most closely matches the typical server one would buy from a provider such as Dell Technologies or Hewlett Packard Enterprise. "For a normal web or application server workload, the M instance type is probably the best tool for the job," Supernor said.

While M series instances can be more expensive than specialized instances, which might offer similar performance, they do offer more flexibility, said Guillaume Salva, a student and full-stack software engineer at the Holberton School of Software Engineering in San Francisco.

"You might pay more for the machine, but you will spend less expensive engineering time trying to [optimize] the code base or redeploy a service to another type of instance," he said.

M instances can also handle multiple application types. For example, Salva added, you can deploy a database, web server, web app and image processing all on the same server.

Specialized alternatives to the M series

If developers need more specialized hardware, they can make a choice that best fits their needs.

"With one exception [the T family], the other instance types specialize in different ways, providing above-average CPU, RAM, or disk size or performance, and include a price premium," Supernor said. For example, C instances focus on CPU performance, while R and X instance types come with lots of memory.

The T EC2 instance family -- like the M family -- aims at general-purpose workloads, but with a lower price point. Some developers might find the T family a better fit than the M for simple tasks, such as hosting a bare-bones website or demo application, Wilcox said.

But with the T family, EC2 restricts CPU to high performance bursts that AWS tracks through a system of CPU credits. Credits build up when the system is idle, and the instance uses them when it fully utilizes the CPU. The CPU throttles to a fraction of its full speed after it uses all the credits. This is an important restriction to keep in mind, but the T instance has its uses.

"T instances are good for low-load web servers and nonproduction systems, such as those used by developers or testers, where continuous, predictable, high performance is not needed," Supernor said.

"You can achieve the same results [as an M instance] with a larger cluster of T instances, [but] that means more management," said Phil Zona, technical writer at Linux Academy, a cloud training company in Keller, Texas.

Developers can also use C or P instances, but Zona said this is overkill for most use cases, like databases and SharePoint back ends. However, he added that a C or P instance is your best bet for machine learning or large-scale image processing, because M instances just don't have the resources to do these tasks efficiently.

Think before you provision

Organizations shouldn't rush a decision to use the M series, or any EC2 instance family, Salva said. Once you spin up an instance, there are certain dependencies that go along with it.

"Changing [the] type of instances means reinstalling all packages and redeploying your entire application," he said. Administration tools like Terraform, Chef or Puppet make the task easier, "but that's still more work and could cause potential instability for production."

[A] general-purpose M instance [is] like a Swiss-army-knife server -- you can do whatever you want with it.
Guillaume Salvasoftware engineer, Holberton School

"Companies do not really understand how their application workloads behave," said Steve Haines, principal software architect at Turbonomic, an enterprise cloud and virtualization software company in Boston. For example, companies might believe an application is memory-bound, "but what happens if it also has significant CPU utilization?" he asked. "How is that going to impact performance if a memory-optimized instance is used?"

Consequently, companies tend to opt for general-purpose virtual machines to cover unforeseen cases.

"In a world long ago, it was said that no one was ever fired for overprovisioning, but they were fired for outages and poor performance," Haines said. The same sort of thing happens today in the cloud. Companies choose a general-purpose instance and then size it to their desired capacity, but then might pay significantly more for the resources they don't use.

"The solution is to gain a deeper understanding of workload behavior and choose the most appropriate template family to match demand," he said.

"[A] general-purpose M instance [is] like a Swiss-army-knife server -- you can do whatever you want with it," Salva said. But when an organization gets a more precise idea of how their applications consume resources, it might be best to move to another instance type. "The truth is that a lot of companies don't spend time on optimization and prefer to focus on their product," he said.

Dig Deeper on AWS infrastructure