7

EC2 Small vs Amazon RDS - which is faster for MySQL?

(I have one database, well-indexed and tuned. About 10,000 rows on each table.)

How's the performance like?

Alex
  • 8,111
  • 24
  • 71
  • 99
  • 1
    RDS is still classed by instance type, so in terms of computing you get the same thing. The difference comes down to 'configuration' - you have much more control over an instance you have setup than over RDS. The appeal of RDS is supposed to be that it requires less intervention (e.g. updates are applied automatically, etc). I believe quite a few people have noted that a well tuned custom setup can outperform RDS - afterall, RDS is a general solution - it is not tailored to each individual's specific use case – cyberx86 Feb 19 '12 at 08:36
  • 1
    @cyberx86 Perhaps put the above as an answer. – gekkz Feb 19 '12 at 09:09

2 Answers2

11

Firstly, I don't use RDS - so don't take this as an absolute. As with EC2, RDS is classed by instance type, so in terms of computing you get the same thing. The difference comes down to 'configuration' and the degree to which the hardware is dedicated.

RDS advantages:

  • Hardware is dedicated to only running RDS - not shared with 'general purpose' instances
  • Possibly better network I/O
  • Provides a good, general purpose, 'out of the box' configuration
  • Updates are managed for you
  • Potentially easier to setup basic replication
  • Good interface for configuring
  • Backup storage is included in cost

RDS disadvantages:

  • Higher cost than equivalent EC2 instance (~40% more)
  • Limited customization
  • Performance can be highly variable (especially disk I/O)
  • Required maintenance may result in downtime if using a single RDS instance (avoidable with multi-AZ deployments)
  • It's more out of your control

EC2 advantages:

  • Can setup RAID arrays to increase disk I/O
  • More flexibility in terms of customization (access to my.ini) and maintenance
  • Lower cost
  • Should be able to achieve equal or better performance if well tuned
  • Allows for more conventional replication and failover
  • Can setup custom monitoring/analysis - and deal with problems directly

EC2 disadvantages:

  • Requires more skill/effort to setup
  • 'Out of the box' performance is not as good as RDS
  • Less stable network I/O

I'd suggest the following:

  • If you don't want the bother and/or can't tune MySQL satisfactorily - go with RDS
  • If the network I/O is going to make a big difference (typically setups with many threads simultaneously in use) - RDS will offer more stable performance
  • If you need fine grained control (or don't need better performance) or are cost conscious - go with EC2
  • If you want to learn about MySQL as you grow - go with EC2

For any specific use case, the best option is probably to benchmark each and see how they stack up - performance will vary for each setup afterall.

Further reading:

cyberx86
  • 20,620
  • 1
  • 60
  • 80
1

I am unable to comment on @cyberx86's answer so I'm forced to chip in with an answer of my own. Re: RDS DB performance being north of EC2 DB out-of-the-box performance...

I've been gradually paring down my AWS resources - changing medium to small instances when possible, optimizing on the application level, etc. My current effort is testing an RDS small instance of MariaDB vs an EC2 small instance with MariaDB (possibly saving $8/mo). I have not attempted to optimize MariaDB on the EC2 instance beyond setting the default charset and collation I want and making Aria the default table type.

My test set is a database containing 150 tables, most with less than 1000 rows, one with roughly 500k and one with 10mil. Archival size, tarred and gzipped sql with drop if exists/create boilerplate, is just under 90m. Installed in a DB, it's 1.4GB. All operations below run from an additional EC2 instance in the same region (us-east) using either mysql or mysqldump as appropriate. The RDS instance and calling EC2 instance are us-east-1a and the EC2 MariaDB instance is us-east-1c.

Export from RDS-small MariaDB to the archival format averaged 51s across 10 tests.
Export from EC2-small with MariaDB to the archival format averaged 40s across 10 tests.
Import to RDS-small MariaDB from the archival format averaged 8:17 across 10 tests.
Import to EC2-small with MariaDB from the archival format averaged 5:33 across 10 tests.

This is not a scientific test, but I've tried to be consistent in my execution. This result was not what I expected. I'd suggest anyone asking the question "EC2 with DB or RDS?" find a benchmark or two from among their application's operations and test... then maybe find another couple, which is what I'm going to do today.

Matt Murphy
  • 233
  • 2
  • 3