Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When should I use a t2.medium vs. a m3.medium instance type within AWS?

They appear to be approximately the same in terms of performance.

Model vCPU Mem (GiB) SSD Storage (GB) m3.medium 1 3.75 1 x 4

Model vCPU CPU Credits / hour Mem (GiB) Storage t2.medium 2 24 4 EBS-Only

t2.medium allows for burst-able performance whereas m3.medium doesn't. t2.medium even has more vCPU (1 vs 2) and memory (3.75 vs 4) than the m3.medium. The only performance gain is the SSD w/a m3.medium, which I recognize could be significant if I'm doing heavy I/O.

Would this be the only scenario where I would choose an m3.medium over a t2.medium?

I'd like to run a web server that gets 20-30k hits a month so I suspect either is okay for my needs, but what's the better option?

like image 249
Charles Sounder Avatar asked Feb 14 '15 19:02

Charles Sounder


People also ask

What is T2 medium in AWS?

T2 instances are Burstable Performance Instances that provide a baseline level of CPU performance with the ability to burst above the baseline. The baseline performance and ability to burst are governed by CPU Credits. T2 instances accumulate CPU Credits when they are idle, and consume CPU Credits when they are active.

What is the best Amazon EC2 instance type to use?

General-Purpose. M3 instances are the newest generation of general-purpose instances, and give you the option of a larger number of virtual CPUs (vCPUs) that provide higher performance. M3 instances are recommended if you are seeking general-purpose instances with demanding CPU requirements.

What is the difference between T2 and T3 instances?

T2 instances launched in Unlimited Mode do not receive launch credits. T3 and T3a instances do not get launch credits at all. If you want full power at the start, use Unlimited mode.

What is m3 medium?

m3.medium: 3.75 GiB of memory, 1 vCPU, 4 GB of SSD-based local instance storage, 64-bit platform. m3.large: 7.5 GiB of memory, 2 VCPUs, 32 GB of SSD-based local instance storage, 64-bit platform. m3.xlarge: 15 GiB of memory, 4 vCPUs, 80 GB of SSD-based local instance storage, 64-bit platform.


2 Answers

30000 hits per month is on average a visitor every 90 seconds. Unless your site is highly atypical, load on the server is likely to be invisibly small. Bursting will handle spikes up to hundreds (or thousands, with some optimizations) of visitors.

With appropriate caching, a VPS server of comparable specs to a t2.micro can serve a Wordpress blog with 30000 hits PER MINUTE. If you were saturating that continuously, you couldn't rely on burst performance for the t2.micro, of course. A t2.medium is roughly 4x as powerful in all regards as a micro, and a m3.medium has similar RAM and bandwidth but less peak CPU.

The instance storage will be a few times faster than a large EBS GP2 (SSD) volume on the m3.medium, of course. The t2 & c3 medium instances will both have roughly 300-400 Mbit/s network bandwidth, t2.micro gets ~60-70 Mbit. One benchmark shows that t2.medium in bursting mode actually beats a c3.large (let alone the m3.medium, which is less than half as powerful, at 3 ECU vs 7).

But as noted, you can probably save money by using something less powerful than either of your suggestions and still have excellent performance.

If you don't need the power to completely configure your server, shared hosting or a platform-as-a-service solution will be easier. I recommend OpenShift, because they explicitly suggest a single small gear for up to 50k hits a month. You get 3 of those for free.

If you do need to configure the server, you really only need enough memory to run your server and/or DB. A t2.nano has 512 MB, and a t2.micro has 1 GB. The real performance bottlenecks will probably be disk I/O and network bandwidth. The first can be improved with a larger general-purpose SSD volume (more IOPS), the second by using multiple instances and an ELB.

Make sure you host all static assets in S3 and use caching well, and even the smaller AWS instances can handle hundreds of requests per second.

Basically: "don't worry about it, use the cheapest and easiest thing that will run it."

like image 134
BobMcGee Avatar answered Sep 18 '22 19:09

BobMcGee


Although the "hardware" specs look similar for the T2.medium instance and the M3.medium instance, the difference is when you consider Burstable vs. Fixed Performance. See this link from Amazon Web Services:

http://aws.amazon.com/ec2/faqs/#burst

The following quote comes from that link:

Q: When should I choose a Burstable Performance Instance, such as T2?

Workloads ideal for Burstable Performance Instances (e.g. web servers, developer environments, and small databases) don’t use the full CPU often or consistently, but occasionally need to burst. If your application requires sustained high CPU performance, we recommend our Fixed Performance Instances, such as M3, C3, and R3.

A T2 instance accrues CPU credits, but only as long as it runs. If it is stopped or terminated, the credits accrued are gone.

There is an important piece of information further down the page concerning the CPU credits for the T2 instances:

Q: What happens to CPU performance if my T2 instance is running low on credits (CPU Credit balance is near zero)?

If your T2 instance has a zero CPU Credit balance, performance will remain at baseline CPU performance. For example, the t2.micro provides baseline CPU performance of 10% of a physical CPU core. If your instance’s CPU Credit balance is approaching zero, CPU performance will be lowered to baseline performance over a 15-minute interval.

This means if you run out of burstable credits, your performance will be limited to a fixed percentage of a single core until you accrue more; 10% for T2.micro, 20% for T2.small, and 40% for T2.medium.

Another important difference that the OP mentions is the M3.medium instance can be provisioned with 4GB of ephemeral storage, which has much greater I/O capacity than persistent, Elastic Block Storage (EBS). T2 instances do not have this option.

Finally, it depends on what a "hit" is. In my opinion, if a hit means a few static page downloads that are less than 64k or small dynamic pages, then I'd explore the T2 option. For longer sessions, more data traffic, or higher numbers of concurrent users, I'd consider the M3. And if performance over an extended time period is a key issue, I think you're definitely in M3 land.

Look at the logs for your present site or a site similar to what you're setting up and determine which situation you're in.

like image 24
Jesuisme Avatar answered Sep 22 '22 19:09

Jesuisme