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

Charles Sounder picture Charles Sounder · Feb 14, 2015 · Viewed 32.5k times · Source

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?

Answer

BobMcGee picture BobMcGee · Jan 6, 2016

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."